Skip to content

Commit 9e991a8

Browse files
committed
DOC: Autogenerate and update documentation
1 parent 0852fa9 commit 9e991a8

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

docs/helpers/AI.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ AI Helper for CodeceptJS.
1616
This helper class provides integration with the AI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
1717
This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
1818

19+
Use it only in development mode. It is recommended to run it only inside pause() mode.
20+
1921
## Configuration
2022

2123
This helper should be configured in codecept.json or codecept.conf.js
@@ -26,9 +28,37 @@ This helper should be configured in codecept.json or codecept.conf.js
2628

2729
- `config`
2830

31+
### askForPageObject
32+
33+
Generates PageObject for current page using AI.
34+
35+
It saves the PageObject to the output directory. You can review the page object and adjust it as needed and move to pages directory.
36+
Prompt can be customized in a global config file.
37+
38+
```js
39+
// create page object for whole page
40+
I.askForPageObject('home');
41+
42+
// create page object with extra prompt
43+
I.askForPageObject('home', 'implement signIn(username, password) method');
44+
45+
// create page object for a specific element
46+
I.askForPageObject('home', null, '.detail');
47+
```
48+
49+
Asks for a page object based on the provided page name, locator, and extra prompt.
50+
51+
#### Parameters
52+
53+
- `pageName` **[string][1]** The name of the page to retrieve the object for.
54+
- `extraPrompt` **([string][1] | null)** An optional extra prompt for additional context or information.
55+
- `locator` **([string][1] | null)** An optional locator to find a specific element on the page.
56+
57+
Returns **[Promise][2]<[Object][3]>** A promise that resolves to the requested page object.
58+
2959
### askGptGeneralPrompt
3060

31-
Send a general request to ChatGPT and return response.
61+
Send a general request to AI and return response.
3262

3363
#### Parameters
3464

@@ -68,3 +98,5 @@ Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generate
6898
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
6999

70100
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
101+
102+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

0 commit comments

Comments
 (0)