codeceptjs 4.0.0-rc.23 → 4.0.0-rc.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +9 -10
  2. package/docs/ai.md +3 -51
  3. package/docs/architecture.md +16 -0
  4. package/docs/bootstrap.md +1 -1
  5. package/docs/continuous-integration.md +16 -44
  6. package/docs/custom-helpers.md +1 -1
  7. package/docs/detox.md +1 -1
  8. package/docs/docker.md +1 -30
  9. package/docs/examples.md +0 -1
  10. package/docs/helpers/Appium.md +16 -2
  11. package/docs/helpers/Playwright.md +161 -160
  12. package/docs/helpers/Puppeteer.md +143 -250
  13. package/docs/helpers/WebDriver.md +134 -177
  14. package/docs/hooks.md +11 -1
  15. package/docs/index.md +1 -1
  16. package/docs/installation.md +2 -19
  17. package/docs/locators.md +1 -1
  18. package/docs/migrate-from-cypress.md +98 -0
  19. package/docs/migrate-from-java.md +108 -0
  20. package/docs/migrate-from-protractor.md +101 -0
  21. package/docs/migrate-from-testcafe.md +99 -0
  22. package/docs/migration-4.md +195 -8
  23. package/docs/plugins/aiTrace.md +49 -0
  24. package/docs/plugins/analyze.md +66 -0
  25. package/docs/plugins/auth.md +241 -0
  26. package/docs/plugins/autoDelay.md +48 -0
  27. package/docs/plugins/browser.md +41 -0
  28. package/docs/plugins/coverage.md +39 -0
  29. package/docs/plugins/customLocator.md +119 -0
  30. package/docs/plugins/customReporter.md +16 -0
  31. package/docs/plugins/expose.md +75 -0
  32. package/docs/plugins/heal.md +44 -0
  33. package/docs/plugins/junitReporter.md +51 -0
  34. package/docs/plugins/pageInfo.md +34 -0
  35. package/docs/plugins/pause.md +43 -0
  36. package/docs/plugins/pauseOnFail.md +18 -0
  37. package/docs/plugins/retryFailedStep.md +75 -0
  38. package/docs/plugins/screencast.md +55 -0
  39. package/docs/plugins/screenshot.md +58 -0
  40. package/docs/plugins/screenshotOnFail.md +18 -0
  41. package/docs/plugins/stepTimeout.md +65 -0
  42. package/docs/plugins.md +40 -862
  43. package/docs/reports.md +18 -4
  44. package/docs/retry.md +48 -18
  45. package/docs/store.md +94 -0
  46. package/docs/timeouts.md +1 -1
  47. package/docs/tutorial.md +207 -155
  48. package/docs/webdriver.md +6 -73
  49. package/lib/actor.js +0 -35
  50. package/lib/command/run-multiple.js +1 -2
  51. package/lib/helper/Playwright.js +1 -15
  52. package/lib/helper/Puppeteer.js +0 -103
  53. package/lib/helper/WebDriver.js +1 -28
  54. package/lib/helper/extras/PlaywrightLocator.js +10 -0
  55. package/lib/locator.js +0 -13
  56. package/lib/plugin/analyze.js +3 -4
  57. package/lib/plugin/pauseOnFail.js +3 -1
  58. package/lib/plugin/retryFailedStep.js +7 -7
  59. package/lib/plugin/screenshot.js +0 -5
  60. package/lib/plugin/screenshotOnFail.js +3 -1
  61. package/lib/plugin/stepTimeout.js +1 -1
  62. package/lib/recorder.js +1 -1
  63. package/lib/workers.js +0 -4
  64. package/package.json +3 -4
  65. package/docs/helpers/Mochawesome.md +0 -8
  66. package/docs/helpers/MockServer.md +0 -212
  67. package/docs/helpers/Polly.md +0 -44
  68. package/docs/helpers/Protractor.md +0 -1769
  69. package/docs/helpers/SoftExpectHelper.md +0 -352
  70. package/docs/react.md +0 -70
  71. package/lib/helper/Mochawesome.js +0 -96
  72. package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -61
  73. package/lib/helper/extras/React.js +0 -65
package/README.md CHANGED
@@ -251,20 +251,22 @@ Add the `testomatio` plugin to your `codecept.conf.js`:
251
251
  plugins: {
252
252
  testomatio: {
253
253
  enabled: true,
254
- require: '@testomatio/reporter/lib/adapter/codecept',
254
+ require: '@testomatio/reporter/codecept',
255
+ html: true,
256
+ reportDir: 'output/report',
255
257
  },
256
258
  }
257
259
  ```
258
260
 
259
261
  ### Usage
260
262
 
261
- Generate HTML reports by setting the `TESTOMATIO_HTML_REPORT_SAVE` environment variable:
263
+ Run tests normally:
262
264
 
263
265
  ```sh
264
- TESTOMATIO_HTML_REPORT_SAVE=1 npx codeceptjs run
266
+ npx codeceptjs run
265
267
  ```
266
268
 
267
- The report will be saved to `html-report/testomatio-report.html`.
269
+ The report will be saved to `output/report/testomatio-report.html` by default. You can also keep using `TESTOMATIO_HTML_REPORT_SAVE=1` and related environment variables if you prefer env-based setup.
268
270
 
269
271
  ### Features
270
272
 
@@ -278,14 +280,11 @@ The report will be saved to `html-report/testomatio-report.html`.
278
280
  ### Customization
279
281
 
280
282
  ```sh
281
- # Custom output folder
282
- TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO_HTML_REPORT_FOLDER=./reports npx codeceptjs run
283
-
284
- # Custom filename
285
- TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO_HTML_FILENAME=my-report.html npx codeceptjs run
283
+ # Custom output folder in codecept.conf.js
284
+ # reportDir: './reports'
286
285
 
287
286
  # Integrate with Testomat.io cloud
288
- TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO=your_api_key npx codeceptjs run
287
+ TESTOMATIO=your_api_key npx codeceptjs run
289
288
  ```
290
289
 
291
290
  ## PageObjects
package/docs/ai.md CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  permalink: /ai
3
- title: Testing with AI 🪄
3
+ title: Testing with AI
4
4
  ---
5
5
 
6
- # 🪄 Testing with AI
6
+ # Testing with AI
7
7
 
8
8
  **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...
9
9
 
10
10
  Think of it as your testing co-pilot built into the testing framework
11
11
 
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/).
13
13
 
14
14
  ## How AI Improves Automated Testing
15
15
 
@@ -164,50 +164,6 @@ The AI SDK supports 20+ providers including:
164
164
 
165
165
  See [AI SDK Providers](https://ai-sdk.dev/docs/foundations/providers-and-models) for complete list and configuration details.
166
166
 
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.
211
167
 
212
168
  ## Self-Healing Tests
213
169
 
@@ -409,9 +365,7 @@ ai: {
409
365
 
410
366
  CodeceptJS uses three main prompts for AI features:
411
367
 
412
- - `writeStep` - generates test code in interactive pause mode
413
368
  - `healStep` - suggests fixes for failing tests
414
- - `generatePageObject` - creates page objects from HTML
415
369
 
416
370
  To customize a prompt, generate it using:
417
371
 
@@ -452,9 +406,7 @@ You can also override prompts programmatically in config:
452
406
  ```js
453
407
  ai: {
454
408
  prompts: {
455
- writeStep: (html, input) => [{ role: 'user', content: 'As a test engineer...' }]
456
409
  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...' }]
458
410
  }
459
411
  }
460
412
  ```
@@ -35,6 +35,7 @@ import { recorder, event, output, container, config } from 'codeceptjs'
35
35
  | [`recorder`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/recorder.js) | the global promise chain that orders every step |
36
36
  | [`event`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/event.js) | the event dispatcher and the names of all lifecycle events |
37
37
  | [`output`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/output.js) | the printer used for all console output |
38
+ | [`store`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/store.js) | global state of the run — current test/step, run modes, directories |
38
39
  | [`helper`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/helper.js) | the base class every helper extends |
39
40
  | [`actor`](https://github.com/codeceptjs/CodeceptJS/blob/master/lib/actor.js) | the base class behind the `I` object |
40
41
 
@@ -183,6 +184,21 @@ output.log('verbose logging information')
183
184
 
184
185
  Use these instead of `console.log` so messages respect the chosen verbosity.
185
186
 
187
+ ## Store
188
+
189
+ `store` holds the state of the current run — the executing test, suite, and step, the active run modes (`dryRun`, `debugMode`, `workerMode`, …), and the project directories. Listeners, plugins, and helpers read it to know where in the [lifecycle](#events) they are without that information being passed to them:
190
+
191
+ ```js
192
+ import { store } from 'codeceptjs'
193
+
194
+ event.dispatcher.on(event.step.before, () => {
195
+ if (store.dryRun) return // no side effects on a dry run
196
+ output.debug(`in ${store.currentTest?.title}`)
197
+ })
198
+ ```
199
+
200
+ CodeceptJS keeps the state fields up to date for you. See the [Store reference](/store) for every field and when to write to it.
201
+
186
202
  ## Helpers and the Actor
187
203
 
188
204
  The `I` object is an **actor** assembled from the enabled helpers. Each `I.method()` call delegates to the matching helper method and is wrapped as a step. Methods whose names start with `_` are private to the helper and not exposed on `I`. To add your own actions, write a [custom helper](/helpers).
package/docs/bootstrap.md CHANGED
@@ -6,7 +6,7 @@ title: Bootstrap
6
6
  # Bootstrap
7
7
 
8
8
  In case you need to execute arbitrary code before or after the tests,
9
- you can use the `bootstrap` and `teardown` config. Use it to start and stop a webserver, Selenium, etc.
9
+ you can use the `bootstrap` and `teardown` config. Use it to start and stop a webserver, seed a database, etc.
10
10
 
11
11
  When using the [parallel execution](/parallel) mode, there are two additional hooks available; `bootstrapAll` and `teardownAll`. See [bootstrapAll & teardownAll](#bootstrapall-teardownall) for more information.
12
12
 
@@ -34,11 +34,11 @@ CodeceptJS runs in any CI that can install Node.js. This page covers the setup,
34
34
  ## Browsers and drivers
35
35
 
36
36
  - **Playwright** — `npx playwright install --with-deps`. Docs: [Playwright CI](https://playwright.dev/docs/ci), [Playwright Docker image](https://playwright.dev/docs/docker) (pin the tag to your installed `playwright` version).
37
- - **WebDriver** — run a Selenium server: `selenium/standalone-chrome` on port `4444`. Docs: [WebDriver helper](/webdriver), [WebdriverIO Selenium Grid](https://webdriver.io/docs/seleniumgrid), [Selenium Docker images](https://github.com/SeleniumHQ/docker-selenium).
37
+ - **WebDriver** — nothing to provision. WebdriverIO 9 downloads and starts both the browser (Chrome, Chromium, or Firefox) and the matching driver automatically. No Selenium server, no browser-install step. Docs: [WebDriver helper](/webdriver), [WebdriverIO driver/browser management](https://webdriver.io/docs/driverbinaries/).
38
38
 
39
39
  ## Check before running
40
40
 
41
- `npx codeceptjs check` loads the config, opens the browser (or connects to Selenium), and counts tests. Prepend it so a broken environment fails fast with a clear message:
41
+ `npx codeceptjs check` loads the config, opens the browser, and counts tests. Prepend it so a broken environment fails fast with a clear message:
42
42
 
43
43
  ```bash
44
44
  npx codeceptjs check
@@ -61,7 +61,7 @@ Use [`@testomatio/reporter`](https://github.com/testomatio/reporter). It ships p
61
61
 
62
62
  ## CI examples
63
63
 
64
- Each example uses Playwright by default; a WebDriver-with-Selenium variant follows where it differs. A `node:20` base image plus `npx playwright install --with-deps` keeps these configs free of version pins.
64
+ Each example uses Playwright by default; a WebDriver variant follows where it differs. WebdriverIO 9 downloads its own browser and driver, so the WebDriver variants run on a plain `node:20` image with no Selenium service and no browser-install step. For Playwright, a `node:20` base image plus `npx playwright install --with-deps` keeps these configs free of version pins.
65
65
 
66
66
  ### GitHub Actions — Playwright
67
67
 
@@ -98,7 +98,9 @@ jobs:
98
98
  path: output/
99
99
  ```
100
100
 
101
- ### GitHub Actions — WebDriver + Selenium
101
+ ### GitHub Actions — WebDriver
102
+
103
+ WebdriverIO 9 downloads its own browser and driver, so the job is just `npm ci` + run — no Selenium service, no browser-install step. This mirrors [WebdriverIO's own boilerplate CI](https://github.com/webdriverio/jasmine-boilerplate/blob/master/.github/workflows/ci.yaml).
102
104
 
103
105
  ```yaml
104
106
  name: WebDriver Tests
@@ -107,15 +109,7 @@ on: [push, pull_request]
107
109
  jobs:
108
110
  test:
109
111
  runs-on: ubuntu-latest
110
- services:
111
- selenium:
112
- image: selenium/standalone-chrome
113
- ports:
114
- - 4444:4444
115
- options: --shm-size=2g
116
112
  env:
117
- SELENIUM_HOST: localhost
118
- SELENIUM_PORT: 4444
119
113
  FORCE_COLOR: 1
120
114
  steps:
121
115
  - uses: actions/checkout@v4
@@ -217,13 +211,7 @@ playwright:
217
211
 
218
212
  webdriver:
219
213
  stage: test
220
- image: node:20
221
- services:
222
- - name: selenium/standalone-chrome
223
- alias: selenium
224
- variables:
225
- SELENIUM_HOST: selenium
226
- SELENIUM_PORT: "4444"
214
+ image: node:20 # WebdriverIO 9 downloads its own browser and driver
227
215
  script:
228
216
  - npm ci
229
217
  - npx codeceptjs check
@@ -245,10 +233,6 @@ image: node:20
245
233
  definitions:
246
234
  caches:
247
235
  playwright: ~/.cache/ms-playwright
248
- services:
249
- selenium:
250
- image: selenium/standalone-chrome
251
- memory: 2048
252
236
 
253
237
  pipelines:
254
238
  default:
@@ -273,16 +257,16 @@ pipelines:
273
257
  artifacts: [output/**]
274
258
  ```
275
259
 
276
- For WebDriver, attach the Selenium service to the step:
260
+ For WebDriver, no Selenium service or browser image is needed — WebdriverIO 9 downloads its own browser and driver:
277
261
 
278
262
  ```yaml
263
+ image: node:20
264
+
279
265
  pipelines:
280
266
  default:
281
267
  - step:
282
- services: [selenium]
283
268
  script:
284
269
  - npm ci
285
- - export SELENIUM_HOST=localhost SELENIUM_PORT=4444
286
270
  - npx codeceptjs check
287
271
  - npx codeceptjs run-workers 2 --by pool
288
272
  artifacts: [output/**]
@@ -327,19 +311,13 @@ pipeline {
327
311
  }
328
312
  ```
329
313
 
330
- For WebDriver, run Selenium alongside the test container:
314
+ For WebDriver, keep the same `node:20` agent — WebdriverIO 9 downloads its own browser and driver, so no Selenium container is needed:
331
315
 
332
316
  ```groovy
333
317
  stage('Test') {
334
318
  steps {
335
- script {
336
- docker.image('selenium/standalone-chrome').withRun('--shm-size=2g -p 4444:4444') { c ->
337
- withEnv(['SELENIUM_HOST=localhost', 'SELENIUM_PORT=4444']) {
338
- sh 'npx codeceptjs check'
339
- sh 'npx codeceptjs run-workers 2 --by pool'
340
- }
341
- }
342
- }
319
+ sh 'npx codeceptjs check'
320
+ sh 'npx codeceptjs run-workers 2 --by pool'
343
321
  }
344
322
  }
345
323
  ```
@@ -371,11 +349,8 @@ jobs:
371
349
 
372
350
  webdriver:
373
351
  docker:
352
+ # WebdriverIO 9 downloads its own browser and driver
374
353
  - image: cimg/node:20.18
375
- - image: selenium/standalone-chrome
376
- environment:
377
- SELENIUM_HOST: localhost
378
- SELENIUM_PORT: 4444
379
354
  steps:
380
355
  - checkout
381
356
  - run: npm ci
@@ -427,13 +402,10 @@ steps:
427
402
  artifactName: codeceptjs-output-$(System.JobPositionInPhase)
428
403
  ```
429
404
 
430
- For WebDriver, run Selenium as a sidecar before the tests:
405
+ For WebDriver, no extra setup is needed WebdriverIO 9 downloads its own browser and driver:
431
406
 
432
407
  ```yaml
433
- - script: docker run -d --net=host --shm-size=2g selenium/standalone-chrome
434
- displayName: Start Selenium
435
408
  - script: |
436
- export SELENIUM_HOST=localhost SELENIUM_PORT=4444
437
409
  npx codeceptjs check
438
410
  npx codeceptjs run-workers 2 --by pool
439
411
  displayName: Run tests
@@ -446,7 +418,7 @@ The official `codeceptjs/codeceptjs` image runs Playwright, Puppeteer, and WebDr
446
418
  ## See also
447
419
 
448
420
  - [Playwright CI guide](https://playwright.dev/docs/ci) · [Playwright Docker image](https://playwright.dev/docs/docker)
449
- - [WebdriverIO Selenium Grid](https://webdriver.io/docs/seleniumgrid) · [Selenium Docker images](https://github.com/SeleniumHQ/docker-selenium)
421
+ - [WebdriverIO driver management](https://webdriver.io/blog/2023/07/31/driver-management/)
450
422
  - [Parallel Execution](/parallel) · [Reports](/reports) · [Plugins](/plugins) · [Docker](/docker)
451
423
 
452
424
  ## Community recipes
@@ -212,7 +212,7 @@ _before() {
212
212
  }
213
213
  ```
214
214
 
215
- `recorder.retry` acts similarly to `I.retry()` and accepts the same parameters. It expects the `when` parameter to be set so it would handle only specific errors and not to retry for every failed step.
215
+ `recorder.retry` registers a retry rule at the recorder level and accepts the same options as `step.retry()` (`retries`, `minTimeout`, `when`, ...). It expects the `when` parameter to be set so it would handle only specific errors and not to retry for every failed step.
216
216
 
217
217
  Retry rules are available in array `recorder.retries`. The last retry rule can be disabled by running `recorder.retries.pop()`;
218
218
 
package/docs/detox.md CHANGED
@@ -31,7 +31,7 @@ CodeceptJS provides next features over standard Detox:
31
31
 
32
32
  * **Unified API**. The same test can be executed in Appium or Detox. Unified API helps different teams to use the same syntax and easy port tests from one engine to another.
33
33
  * [Interactive pause](/basics#pause). When starting/stopping an application takes a long time, debugging and writing tests can be hard. CodeceptJS solves this by pausing an execution and letting you try different commands and locators. With this feature a test can be writtern during one running session.
34
- * [Auto-retries](/basics#retries) using `retryFailedStepPlugin` and `I.retry()`
34
+ * [Auto-retries](/basics#retries) using the `retryFailedStep` plugin and `step.retry()`
35
35
  * **Cross-Platform testing** - one test can be executed on different engines. When needed, platform-specific actions and locators can be easily applied.
36
36
 
37
37
  ## A Test
package/docs/docker.md CHANGED
@@ -38,7 +38,6 @@ services:
38
38
  codeceptjs:
39
39
  image: codeceptjs/codeceptjs
40
40
  depends_on:
41
- - firefox
42
41
  - web
43
42
  volumes:
44
43
  - .:/tests
@@ -47,38 +46,10 @@ services:
47
46
  command: node app/server.js
48
47
  volumes:
49
48
  - .:/app
50
- firefox:
51
- image: selenium/standalone-firefox-debug:2.53.0
52
- ports:
53
- - '4444'
54
- - '5900'
55
49
  ```
56
50
 
57
- ### Linking Containers
51
+ The official image bundles browsers, and WebdriverIO 9 starts the matching driver automatically — no separate Selenium container or container linking is required for the WebDriver engine.
58
52
 
59
- If using the WebDriver driver, link the container with a Selenium Standalone docker container with an alias of `selenium`. Additionally, make sure your `codeceptjs.conf.js` contains the following to allow CodeceptJS to identify where Selenium is running.
60
-
61
- ```javascript
62
- ...
63
- helpers: {
64
- WebDriver: {
65
- ...
66
- host: process.env.HOST
67
- ...
68
- }
69
- }
70
- ...
71
- ```
72
-
73
- ```sh
74
- $ docker run -d -P --name selenium-chrome selenium/standalone-chrome
75
-
76
- # Alternatively, selenium/standalone-firefox can be used
77
-
78
- $ docker run -it --rm -v /<path_to_codeceptjs_test_dir>/:/tests/ --link selenium-chrome:selenium codeceptjs/codeceptjs
79
- ```
80
-
81
- You may run use `-v $(pwd)/:tests/` if running this from the root of your CodeceptJS tests directory.
82
53
  _Note: The output of your test run will appear in your local directory if your output path is `./output` in the CodeceptJS config_
83
54
 
84
55
  ### Build
package/docs/examples.md CHANGED
@@ -107,7 +107,6 @@ This repository demonstrates usage of
107
107
 
108
108
  - Puppeteer helper
109
109
  - Working with Angular CLI
110
- - Reports with Mochawesome helper
111
110
 
112
111
  ## [REST Example Tests](https://github.com/PeterNgTr/codeceptjs-rest-demo)
113
112
 
@@ -936,8 +936,12 @@ I.click('//form/*[@type=submit]');
936
936
  I.click('Logout', '#nav');
937
937
  // using strict locator
938
938
  I.click({css: 'nav a.login'});
939
+ // using ARIA role locator
940
+ I.click({role: 'button', name: 'Submit'});
939
941
  ```
940
942
 
943
+ > ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][17].
944
+
941
945
  #### Parameters
942
946
 
943
947
  * `locator` **([string][5] | [object][11])** (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator. (optional, default `'//body'`)
@@ -1034,10 +1038,14 @@ I.fillField('password', secret('123456'));
1034
1038
  I.fillField('form#login input[name=username]', 'John');
1035
1039
  // or by strict locator
1036
1040
  I.fillField({css: 'form#login input[name=username]'}, 'John');
1041
+ // by ARIA role locator
1042
+ I.fillField({role: 'textbox', name: 'Email'}, 'hello@world.com');
1037
1043
  // within a context
1038
1044
  I.fillField('Name', 'John', '#section2');
1039
1045
  ```
1040
1046
 
1047
+ > ℹ️ ARIA role locators (`{role, name}`) match fields by their accessible name and survive markup refactors. See [Locators][17].
1048
+
1041
1049
  #### Parameters
1042
1050
 
1043
1051
  * `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator.
@@ -1188,7 +1196,7 @@ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "cent
1188
1196
  #### Parameters
1189
1197
 
1190
1198
  * `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator.
1191
- * `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][7])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][17].
1199
+ * `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][7])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][18].
1192
1200
 
1193
1201
  Returns **void** automatically synchronized promise through #recorderSupported only for web testing
1194
1202
 
@@ -1218,8 +1226,12 @@ The second parameter is a context (CSS or XPath locator) to narrow the search.
1218
1226
  ```js
1219
1227
  I.seeElement('#modal');
1220
1228
  I.seeElement('#modal', '#container');
1229
+ // using ARIA role locator
1230
+ I.seeElement({role: 'dialog'});
1221
1231
  ```
1222
1232
 
1233
+ > ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][17].
1234
+
1223
1235
  #### Parameters
1224
1236
 
1225
1237
  * `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator.
@@ -1402,4 +1414,6 @@ Returns **void** automatically synchronized promise through #recorder
1402
1414
 
1403
1415
  [16]: http://webdriver.io/api/mobile/setImmediateValue.html
1404
1416
 
1405
- [17]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
1417
+ [17]: /locators#aria-locators
1418
+
1419
+ [18]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView