Skip to content

Commit 54bd14e

Browse files
author
DavertMik
committed
minor docs update
1 parent e37977a commit 54bd14e

2 files changed

Lines changed: 210 additions & 206 deletions

File tree

docs/ai.md

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
permalink: /ai
3-
title: Testing with AI 🪄
3+
title: Testing with AI
44
---
55

6-
# 🪄 Testing with AI
6+
# Testing with AI
77

88
**CodeceptJS is the first open-source test automation framework with AI** features to improve the testing experience. CodeceptJS uses AI provider like OpenAI or Anthropic to auto-heal failing tests, assist in writing tests, and more...
99

1010
Think of it as your testing co-pilot built into the testing framework
1111

12-
> 🪄 **AI features for testing are experimental**. AI works only for web based testing with Playwright, WebDriver, etc. Those features will be improved based on user's experience.
12+
> This is guide on using AI features inside CodeceptJS. To control CodeceptJS via AI Agents, see [Agentic Testing Guide](/agents/).
1313
1414
## How AI Improves Automated Testing
1515

@@ -164,50 +164,6 @@ The AI SDK supports 20+ providers including:
164164

165165
See [AI SDK Providers](https://ai-sdk.dev/docs/foundations/providers-and-models) for complete list and configuration details.
166166

167-
## Writing Tests with AI Copilot
168-
169-
If AI features are enabled when using [interactive pause](/basics/#debug) with `pause()` command inside tests:
170-
171-
For instance, let's create a test to try ai features via `gt` command:
172-
173-
```
174-
npx codeceptjs gt
175-
```
176-
177-
Name a test and write the code. We will use `Scenario.only` instead of Scenario to execute only this exact test.
178-
179-
```js
180-
Feature('ai')
181-
182-
Scenario.only('test ai features', ({ I }) => {
183-
I.amOnPage('https://getbootstrap.com/docs/5.1/examples/checkout/')
184-
pause()
185-
})
186-
```
187-
188-
Now run the test in debug mode with AI enabled:
189-
190-
```
191-
npx codeceptjs run --debug --ai
192-
```
193-
194-
When pause mode started you can ask GPT to fill in the fields on this page. Use natural language to describe your request, and provide enough details that AI could operate with it. It is important to include at least a space char in your input, otherwise, CodeceptJS will consider the input to be JavaScript code.
195-
196-
```
197-
I.fill checkout form with valid values without submitting it
198-
```
199-
200-
![](/img/fill_form_1.png)
201-
202-
GPT will generate code and data and CodeceptJS will try to execute its code. If it succeeds, the code will be saved to history and you will be able to copy it to your test.
203-
204-
![](/img/fill_form2.png)
205-
206-
This AI copilot works best with long static forms. In the case of complex and dynamic single-page applications, it may not perform as well, as the form may not be present on HTML page yet. For instance, interacting with calendars or inputs with real-time validations (like credit cards) can not yet be performed by AI.
207-
208-
Please keep in mind that GPT can't react to page changes and operates with static text only. This is why it is not ready yet to write the test completely. However, if you are new to CodeceptJS and automated testing AI copilot may help you write tests more efficiently.
209-
210-
> 👶 Enable AI copilot for junior test automation engineers. It may help them to get started with CodeceptJS and to write good semantic locators.
211167

212168
## Self-Healing Tests
213169

@@ -409,9 +365,7 @@ ai: {
409365
410366
CodeceptJS uses three main prompts for AI features:
411367
412-
- `writeStep` - generates test code in interactive pause mode
413368
- `healStep` - suggests fixes for failing tests
414-
- `generatePageObject` - creates page objects from HTML
415369
416370
To customize a prompt, generate it using:
417371
@@ -452,9 +406,7 @@ You can also override prompts programmatically in config:
452406
```js
453407
ai: {
454408
prompts: {
455-
writeStep: (html, input) => [{ role: 'user', content: 'As a test engineer...' }]
456409
healStep: (html, { step, error, prevSteps }) => [{ role: 'user', content: 'As a test engineer...' }]
457-
generatePageObject: (html, extraPrompt = '', rootLocator = null) => [{ role: 'user', content: 'As a test engineer...' }]
458410
}
459411
}
460412
```

0 commit comments

Comments
 (0)