codeceptjs 4.0.0-beta.1 → 4.0.0-beta.10.esm-aria
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.
- package/README.md +133 -120
- package/bin/codecept.js +107 -96
- package/bin/test-server.js +64 -0
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +5 -1
- package/lib/actor.js +71 -103
- package/lib/ai.js +159 -188
- package/lib/assert/empty.js +22 -24
- package/lib/assert/equal.js +30 -37
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +43 -48
- package/lib/assert/throws.js +11 -11
- package/lib/assert/truth.js +22 -22
- package/lib/assert.js +20 -18
- package/lib/codecept.js +238 -162
- package/lib/colorUtils.js +50 -52
- package/lib/command/check.js +206 -0
- package/lib/command/configMigrate.js +56 -51
- package/lib/command/definitions.js +96 -109
- package/lib/command/dryRun.js +77 -79
- package/lib/command/generate.js +234 -194
- package/lib/command/gherkin/init.js +42 -33
- package/lib/command/gherkin/snippets.js +76 -74
- package/lib/command/gherkin/steps.js +20 -17
- package/lib/command/info.js +74 -38
- package/lib/command/init.js +300 -290
- package/lib/command/interactive.js +41 -32
- package/lib/command/list.js +28 -27
- package/lib/command/run-multiple/chunk.js +51 -48
- package/lib/command/run-multiple/collection.js +5 -5
- package/lib/command/run-multiple/run.js +5 -1
- package/lib/command/run-multiple.js +97 -97
- package/lib/command/run-rerun.js +19 -25
- package/lib/command/run-workers.js +68 -92
- package/lib/command/run.js +39 -27
- package/lib/command/utils.js +80 -64
- package/lib/command/workers/runTests.js +388 -226
- package/lib/config.js +124 -50
- package/lib/container.js +751 -260
- package/lib/data/context.js +60 -61
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +32 -32
- package/lib/data/table.js +22 -22
- package/lib/effects.js +307 -0
- package/lib/element/WebElement.js +327 -0
- package/lib/els.js +160 -0
- package/lib/event.js +173 -163
- package/lib/globals.js +141 -0
- package/lib/heal.js +89 -85
- package/lib/helper/AI.js +131 -41
- package/lib/helper/ApiDataFactory.js +107 -75
- package/lib/helper/Appium.js +542 -404
- package/lib/helper/FileSystem.js +100 -79
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +52 -52
- package/lib/helper/JSONResponse.js +126 -88
- package/lib/helper/Mochawesome.js +54 -29
- package/lib/helper/Playwright.js +2547 -1316
- package/lib/helper/Puppeteer.js +1578 -1181
- package/lib/helper/REST.js +209 -68
- package/lib/helper/WebDriver.js +1482 -1342
- package/lib/helper/errors/ConnectionRefused.js +6 -6
- package/lib/helper/errors/ElementAssertion.js +11 -16
- package/lib/helper/errors/ElementNotFound.js +5 -9
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
- package/lib/helper/extras/Console.js +11 -11
- package/lib/helper/extras/PlaywrightLocator.js +110 -0
- package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
- package/lib/helper/extras/PlaywrightReactVueLocator.js +17 -8
- package/lib/helper/extras/PlaywrightRestartOpts.js +25 -11
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/helper/extras/React.js +27 -28
- package/lib/helper/network/actions.js +36 -42
- package/lib/helper/network/utils.js +78 -84
- package/lib/helper/scripts/blurElement.js +5 -5
- package/lib/helper/scripts/focusElement.js +5 -5
- package/lib/helper/scripts/highlightElement.js +8 -8
- package/lib/helper/scripts/isElementClickable.js +34 -34
- package/lib/helper.js +2 -3
- package/lib/history.js +23 -19
- package/lib/hooks.js +8 -8
- package/lib/html.js +94 -104
- package/lib/index.js +38 -27
- package/lib/listener/config.js +30 -23
- package/lib/listener/emptyRun.js +54 -0
- package/lib/listener/enhancedGlobalRetry.js +110 -0
- package/lib/listener/exit.js +16 -18
- package/lib/listener/globalRetry.js +70 -0
- package/lib/listener/globalTimeout.js +181 -0
- package/lib/listener/helpers.js +76 -51
- package/lib/listener/mocha.js +10 -11
- package/lib/listener/result.js +11 -0
- package/lib/listener/retryEnhancer.js +85 -0
- package/lib/listener/steps.js +71 -59
- package/lib/listener/store.js +20 -0
- package/lib/locator.js +214 -197
- package/lib/mocha/asyncWrapper.js +274 -0
- package/lib/mocha/bdd.js +167 -0
- package/lib/mocha/cli.js +341 -0
- package/lib/mocha/factory.js +163 -0
- package/lib/mocha/featureConfig.js +89 -0
- package/lib/mocha/gherkin.js +231 -0
- package/lib/mocha/hooks.js +121 -0
- package/lib/mocha/index.js +21 -0
- package/lib/mocha/inject.js +46 -0
- package/lib/{interfaces → mocha}/scenarioConfig.js +58 -34
- package/lib/mocha/suite.js +89 -0
- package/lib/mocha/test.js +184 -0
- package/lib/mocha/types.d.ts +42 -0
- package/lib/mocha/ui.js +242 -0
- package/lib/output.js +141 -71
- package/lib/parser.js +47 -44
- package/lib/pause.js +173 -145
- package/lib/plugin/analyze.js +403 -0
- package/lib/plugin/{autoLogin.js → auth.js} +178 -79
- package/lib/plugin/autoDelay.js +36 -40
- package/lib/plugin/coverage.js +131 -78
- package/lib/plugin/customLocator.js +22 -21
- package/lib/plugin/customReporter.js +53 -0
- package/lib/plugin/enhancedRetryFailedStep.js +99 -0
- package/lib/plugin/heal.js +101 -110
- package/lib/plugin/htmlReporter.js +3648 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/pauseOnFail.js +12 -11
- package/lib/plugin/retryFailedStep.js +82 -47
- package/lib/plugin/screenshotOnFail.js +111 -92
- package/lib/plugin/stepByStepReport.js +159 -101
- package/lib/plugin/stepTimeout.js +20 -25
- package/lib/plugin/subtitles.js +38 -38
- package/lib/recorder.js +193 -130
- package/lib/rerun.js +94 -49
- package/lib/result.js +238 -0
- package/lib/retryCoordinator.js +207 -0
- package/lib/secret.js +20 -18
- package/lib/session.js +95 -89
- package/lib/step/base.js +239 -0
- package/lib/step/comment.js +10 -0
- package/lib/step/config.js +50 -0
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +50 -0
- package/lib/step/meta.js +99 -0
- package/lib/step/record.js +74 -0
- package/lib/step/retry.js +11 -0
- package/lib/step/section.js +55 -0
- package/lib/step.js +18 -329
- package/lib/steps.js +54 -0
- package/lib/store.js +38 -7
- package/lib/template/heal.js +3 -12
- package/lib/template/prompts/generatePageObject.js +31 -0
- package/lib/template/prompts/healStep.js +13 -0
- package/lib/template/prompts/writeStep.js +9 -0
- package/lib/test-server.js +334 -0
- package/lib/timeout.js +60 -0
- package/lib/transform.js +8 -8
- package/lib/translation.js +34 -21
- package/lib/utils/mask_data.js +47 -0
- package/lib/utils.js +411 -228
- package/lib/workerStorage.js +37 -34
- package/lib/workers.js +532 -296
- package/package.json +115 -95
- package/translations/de-DE.js +5 -3
- package/translations/fr-FR.js +5 -4
- package/translations/index.js +22 -12
- package/translations/it-IT.js +4 -3
- package/translations/ja-JP.js +4 -3
- package/translations/nl-NL.js +76 -0
- package/translations/pl-PL.js +4 -3
- package/translations/pt-BR.js +4 -3
- package/translations/ru-RU.js +4 -3
- package/translations/utils.js +10 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/index.d.ts +546 -185
- package/typings/promiseBasedTypes.d.ts +150 -879
- package/typings/types.d.ts +547 -996
- package/lib/cli.js +0 -249
- package/lib/dirname.js +0 -5
- package/lib/helper/Expect.js +0 -425
- package/lib/helper/ExpectHelper.js +0 -399
- package/lib/helper/MockServer.js +0 -223
- package/lib/helper/Nightmare.js +0 -1411
- package/lib/helper/Protractor.js +0 -1835
- package/lib/helper/SoftExpectHelper.js +0 -381
- package/lib/helper/TestCafe.js +0 -1410
- package/lib/helper/clientscripts/nightmare.js +0 -213
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -63
- package/lib/interfaces/bdd.js +0 -98
- package/lib/interfaces/featureConfig.js +0 -69
- package/lib/interfaces/gherkin.js +0 -195
- package/lib/listener/artifacts.js +0 -19
- package/lib/listener/retry.js +0 -68
- package/lib/listener/timeout.js +0 -109
- package/lib/mochaFactory.js +0 -110
- package/lib/plugin/allure.js +0 -15
- package/lib/plugin/commentStep.js +0 -136
- package/lib/plugin/debugErrors.js +0 -67
- package/lib/plugin/eachElement.js +0 -127
- package/lib/plugin/fakerTransform.js +0 -49
- package/lib/plugin/retryTo.js +0 -121
- package/lib/plugin/selenoid.js +0 -371
- package/lib/plugin/standardActingHelpers.js +0 -9
- package/lib/plugin/tryTo.js +0 -105
- package/lib/plugin/wdio.js +0 -246
- package/lib/scenario.js +0 -222
- package/lib/ui.js +0 -238
- package/lib/within.js +0 -70
package/README.md
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
[](https://stand-with-ukraine.pp.ua)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
3
|
[<img src="https://img.shields.io/badge/slack-@codeceptjs-purple.svg?logo=slack">](https://join.slack.com/t/codeceptjs/shared_invite/enQtMzA5OTM4NDM2MzA4LWE4MThhN2NmYTgxNTU5MTc4YzAyYWMwY2JkMmZlYWI5MWQ2MDM5MmRmYzZmYmNiNmY5NTAzM2EwMGIwOTNhOGQ) [<img src="https://img.shields.io/badge/discourse-codeceptjs-purple">](https://codecept.discourse.group) [![NPM version][npm-image]][npm-url] [<img src="https://img.shields.io/badge/dockerhub-images-blue.svg?logo=codeceptjs">](https://hub.docker.com/r/codeceptjs/codeceptjs)
|
|
6
|
-
[](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
|
|
4
|
+
[](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
|
|
7
5
|
|
|
8
|
-
Build Status
|
|
6
|
+
## Build Status
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Web
|
|
14
|
-
[](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml)
|
|
17
|
-
[](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml)
|
|
8
|
+
| Type | Engine | Status |
|
|
9
|
+
| --------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| 🌐 Web | Playwright | [](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml) |
|
|
11
|
+
| 🌐 Web | Puppeteer | [](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) |
|
|
12
|
+
| 🌐 Web | WebDriver | [](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) |
|
|
13
|
+
| 📱 Mobile | Appium | [](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium_Android.yml) |
|
|
18
14
|
|
|
19
15
|
# CodeceptJS [](https://stand-with-ukraine.pp.ua)
|
|
20
16
|
|
|
@@ -27,28 +23,27 @@ It abstracts browser interaction to simple steps that are written from a user's
|
|
|
27
23
|
A simple test that verifies the "Welcome" text is present on a main page of a site will look like:
|
|
28
24
|
|
|
29
25
|
```js
|
|
30
|
-
Feature('CodeceptJS demo')
|
|
26
|
+
Feature('CodeceptJS demo')
|
|
31
27
|
|
|
32
28
|
Scenario('check Welcome page on site', ({ I }) => {
|
|
33
|
-
I.amOnPage('/')
|
|
34
|
-
I.see('Welcome')
|
|
35
|
-
})
|
|
29
|
+
I.amOnPage('/')
|
|
30
|
+
I.see('Welcome')
|
|
31
|
+
})
|
|
36
32
|
```
|
|
37
33
|
|
|
38
34
|
CodeceptJS tests are:
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
- **Synchronous**. You don't need to care about callbacks or promises or test scenarios which are linear. But, your tests should be linear.
|
|
37
|
+
- Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons.
|
|
38
|
+
- Backend **API agnostic**. We don't know which WebDriver implementation is running this test.
|
|
43
39
|
|
|
44
40
|
CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently, CodeceptJS has these helpers:
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
|
|
42
|
+
- [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
|
|
43
|
+
- [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
|
|
44
|
+
- [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver or Devtools protocol.
|
|
45
|
+
- [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
|
|
46
|
+
- [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
|
|
52
47
|
|
|
53
48
|
And more to come...
|
|
54
49
|
|
|
@@ -56,19 +51,20 @@ And more to come...
|
|
|
56
51
|
|
|
57
52
|
CodeceptJS is a successor of [Codeception](http://codeception.com), a popular full-stack testing framework for PHP.
|
|
58
53
|
With CodeceptJS your scenario-driven functional and acceptance tests will be as simple and clean as they can be.
|
|
59
|
-
You don't need to worry about asynchronous nature of NodeJS or about various APIs of Playwright, Selenium, Puppeteer,
|
|
60
|
-
|
|
54
|
+
You don't need to worry about asynchronous nature of NodeJS or about various APIs of Playwright, Selenium, Puppeteer, etc. as CodeceptJS unifies them and makes them work as they are synchronous.
|
|
61
55
|
|
|
62
56
|
## Features
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
|
|
58
|
+
- 🪄 **AI-powered** with GPT features to assist and heal failing tests.
|
|
59
|
+
- ☕ Based on [Mocha](https://mochajs.org/) testing framework.
|
|
60
|
+
- 💼 Designed for scenario driven acceptance testing in BDD-style.
|
|
61
|
+
- 💻 Uses ES6 natively without transpiler.
|
|
62
|
+
- Also plays nice with TypeScript.
|
|
63
|
+
- </> Smart locators: use names, labels, matching text, CSS or XPath to locate elements.
|
|
64
|
+
- 🌐 Interactive debugging shell: pause test at any point and try different commands in a browser.
|
|
65
|
+
- ⚡ **Parallel testing** with dynamic test pooling for optimal load balancing and performance.
|
|
66
|
+
- 📊 **Built-in HTML Reporter** with interactive dashboard, step-by-step execution details, and comprehensive test analytics.
|
|
67
|
+
- Easily create tests, pageobjects, stepobjects with CLI generators.
|
|
72
68
|
|
|
73
69
|
## Installation
|
|
74
70
|
|
|
@@ -105,7 +101,8 @@ npx codeceptjs def .
|
|
|
105
101
|
Later you can even automagically update Type Definitions to include your own custom [helpers methods](docs/helpers.md).
|
|
106
102
|
|
|
107
103
|
Note:
|
|
108
|
-
|
|
104
|
+
|
|
105
|
+
- CodeceptJS requires Node.js version `12+` or later.
|
|
109
106
|
|
|
110
107
|
## Usage
|
|
111
108
|
|
|
@@ -116,18 +113,18 @@ Learn CodeceptJS by examples. Let's assume we have CodeceptJS installed and WebD
|
|
|
116
113
|
Let's see how we can handle basic form testing:
|
|
117
114
|
|
|
118
115
|
```js
|
|
119
|
-
Feature('CodeceptJS Demonstration')
|
|
116
|
+
Feature('CodeceptJS Demonstration')
|
|
120
117
|
|
|
121
118
|
Scenario('test some forms', ({ I }) => {
|
|
122
|
-
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
123
|
-
I.fillField('Email', 'hello@world.com')
|
|
124
|
-
I.fillField('Password', secret('123456'))
|
|
125
|
-
I.checkOption('Active')
|
|
126
|
-
I.checkOption('Male')
|
|
127
|
-
I.click('Create User')
|
|
128
|
-
I.see('User is valid')
|
|
129
|
-
I.dontSeeInCurrentUrl('/documentation')
|
|
130
|
-
})
|
|
119
|
+
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
120
|
+
I.fillField('Email', 'hello@world.com')
|
|
121
|
+
I.fillField('Password', secret('123456'))
|
|
122
|
+
I.checkOption('Active')
|
|
123
|
+
I.checkOption('Male')
|
|
124
|
+
I.click('Create User')
|
|
125
|
+
I.see('User is valid')
|
|
126
|
+
I.dontSeeInCurrentUrl('/documentation')
|
|
127
|
+
})
|
|
131
128
|
```
|
|
132
129
|
|
|
133
130
|
All actions are performed by `I` object; assertions functions start with `see` function.
|
|
@@ -172,11 +169,11 @@ The same way you can locate element by name, `CSS` or `XPath` locators in tests:
|
|
|
172
169
|
|
|
173
170
|
```js
|
|
174
171
|
// by name
|
|
175
|
-
I.fillField('user_basic[email]', 'hello@world.com')
|
|
172
|
+
I.fillField('user_basic[email]', 'hello@world.com')
|
|
176
173
|
// by CSS
|
|
177
|
-
I.fillField('#user_basic_email', 'hello@world.com')
|
|
174
|
+
I.fillField('#user_basic_email', 'hello@world.com')
|
|
178
175
|
// don't make us guess locator type, specify it
|
|
179
|
-
I.fillField({css: '#user_basic_email'}, 'hello@world.com')
|
|
176
|
+
I.fillField({ css: '#user_basic_email' }, 'hello@world.com')
|
|
180
177
|
```
|
|
181
178
|
|
|
182
179
|
Other methods like `checkOption`, and `click` work in a similar manner. They can take labels or CSS or XPath locators to find elements to interact.
|
|
@@ -187,9 +184,9 @@ Assertions start with `see` or `dontSee` prefix. In our case we are asserting th
|
|
|
187
184
|
However, we can narrow the search to particular element by providing a second parameter:
|
|
188
185
|
|
|
189
186
|
```js
|
|
190
|
-
I.see('User is valid')
|
|
187
|
+
I.see('User is valid')
|
|
191
188
|
// better to specify context:
|
|
192
|
-
I.see('User is valid', '.alert-success')
|
|
189
|
+
I.see('User is valid', '.alert-success')
|
|
193
190
|
```
|
|
194
191
|
|
|
195
192
|
In this case 'User is valid' string will be searched only inside elements located by CSS `.alert-success`.
|
|
@@ -200,13 +197,13 @@ In case you need to return a value from a webpage and use it directly in test, y
|
|
|
200
197
|
They are expected to be used inside `async/await` functions, and their results will be available in test:
|
|
201
198
|
|
|
202
199
|
```js
|
|
203
|
-
Feature('CodeceptJS Demonstration')
|
|
200
|
+
Feature('CodeceptJS Demonstration')
|
|
204
201
|
|
|
205
202
|
Scenario('test page title', async ({ I }) => {
|
|
206
|
-
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
207
|
-
const title = await I.grabTitle()
|
|
208
|
-
I.expectEqual(title, 'Example application with SimpleForm and Twitter Bootstrap')
|
|
209
|
-
})
|
|
203
|
+
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
204
|
+
const title = await I.grabTitle()
|
|
205
|
+
I.expectEqual(title, 'Example application with SimpleForm and Twitter Bootstrap') // Avaiable with Expect helper. -> https://codecept.io/helpers/Expect/
|
|
206
|
+
})
|
|
210
207
|
```
|
|
211
208
|
|
|
212
209
|
The same way you can grab text, attributes, or form values and use them in next test steps.
|
|
@@ -216,25 +213,69 @@ The same way you can grab text, attributes, or form values and use them in next
|
|
|
216
213
|
Common preparation steps like opening a web page, logging in a user, can be placed in `Before` or `Background`:
|
|
217
214
|
|
|
218
215
|
```js
|
|
219
|
-
const { I } = inject()
|
|
216
|
+
const { I } = inject()
|
|
220
217
|
|
|
221
|
-
Feature('CodeceptJS Demonstration')
|
|
218
|
+
Feature('CodeceptJS Demonstration')
|
|
222
219
|
|
|
223
|
-
Before(() => {
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
Before(() => {
|
|
221
|
+
// or Background
|
|
222
|
+
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
223
|
+
})
|
|
226
224
|
|
|
227
225
|
Scenario('test some forms', () => {
|
|
228
|
-
I.click('Create User')
|
|
229
|
-
I.see('User is valid')
|
|
230
|
-
I.dontSeeInCurrentUrl('/documentation')
|
|
231
|
-
})
|
|
226
|
+
I.click('Create User')
|
|
227
|
+
I.see('User is valid')
|
|
228
|
+
I.dontSeeInCurrentUrl('/documentation')
|
|
229
|
+
})
|
|
232
230
|
|
|
233
231
|
Scenario('test title', () => {
|
|
234
|
-
I.seeInTitle('Example application')
|
|
235
|
-
})
|
|
232
|
+
I.seeInTitle('Example application')
|
|
233
|
+
})
|
|
236
234
|
```
|
|
237
235
|
|
|
236
|
+
## HTML Reporter
|
|
237
|
+
|
|
238
|
+
CodeceptJS includes a powerful built-in HTML Reporter that generates comprehensive, interactive test reports with detailed information about your test runs. The HTML reporter is **enabled by default** for all new projects and provides:
|
|
239
|
+
|
|
240
|
+
### Features
|
|
241
|
+
|
|
242
|
+
- **Interactive Dashboard**: Visual statistics, pie charts, and expandable test details
|
|
243
|
+
- **Step-by-Step Execution**: Shows individual test steps with timing and status indicators
|
|
244
|
+
- **BDD/Gherkin Support**: Full support for feature files with proper scenario formatting
|
|
245
|
+
- **System Information**: Comprehensive environment details including browser versions
|
|
246
|
+
- **Advanced Filtering**: Real-time filtering by status, tags, features, and test types
|
|
247
|
+
- **History Tracking**: Multi-run history with trend visualization
|
|
248
|
+
- **Error Details**: Clean formatting of error messages and stack traces
|
|
249
|
+
- **Artifacts Support**: Display screenshots and other test artifacts
|
|
250
|
+
|
|
251
|
+
### Visual Examples
|
|
252
|
+
|
|
253
|
+
#### Interactive Test Dashboard
|
|
254
|
+
|
|
255
|
+
The main dashboard provides a complete overview with interactive statistics and pie charts:
|
|
256
|
+
|
|
257
|
+

|
|
258
|
+
|
|
259
|
+
#### Detailed Test Results
|
|
260
|
+
|
|
261
|
+
Each test shows comprehensive execution details with expandable step information:
|
|
262
|
+
|
|
263
|
+

|
|
264
|
+
|
|
265
|
+
#### Advanced Filtering Capabilities
|
|
266
|
+
|
|
267
|
+
Real-time filtering allows quick navigation through test results:
|
|
268
|
+
|
|
269
|
+

|
|
270
|
+
|
|
271
|
+
#### BDD/Gherkin Support
|
|
272
|
+
|
|
273
|
+
Full support for Gherkin scenarios with proper feature formatting:
|
|
274
|
+
|
|
275
|
+

|
|
276
|
+
|
|
277
|
+
The HTML reporter generates self-contained reports that can be easily shared with your team. Learn more about configuration and features in the [HTML Reporter documentation](https://codecept.io/plugins/#htmlreporter).
|
|
278
|
+
|
|
238
279
|
## PageObjects
|
|
239
280
|
|
|
240
281
|
CodeceptJS provides the most simple way to create and use page objects in your test.
|
|
@@ -248,83 +289,55 @@ It will create a page object file for you and add it to the config.
|
|
|
248
289
|
Let's assume we created one named `docsPage`:
|
|
249
290
|
|
|
250
291
|
```js
|
|
251
|
-
const { I } = inject()
|
|
292
|
+
const { I } = inject()
|
|
252
293
|
|
|
253
294
|
module.exports = {
|
|
254
295
|
fields: {
|
|
255
296
|
email: '#user_basic_email',
|
|
256
|
-
password: '#user_basic_password'
|
|
297
|
+
password: '#user_basic_password',
|
|
257
298
|
},
|
|
258
|
-
submitButton: {css: '#new_user_basic input[type=submit]'},
|
|
299
|
+
submitButton: { css: '#new_user_basic input[type=submit]' },
|
|
259
300
|
|
|
260
301
|
sendForm(email, password) {
|
|
261
|
-
I.fillField(this.fields.email, email)
|
|
262
|
-
I.fillField(this.fields.password, password)
|
|
263
|
-
I.click(this.submitButton)
|
|
264
|
-
}
|
|
302
|
+
I.fillField(this.fields.email, email)
|
|
303
|
+
I.fillField(this.fields.password, password)
|
|
304
|
+
I.click(this.submitButton)
|
|
305
|
+
},
|
|
265
306
|
}
|
|
266
307
|
```
|
|
267
308
|
|
|
268
309
|
You can easily inject it to test by providing its name in test arguments:
|
|
269
310
|
|
|
270
311
|
```js
|
|
271
|
-
Feature('CodeceptJS Demonstration')
|
|
312
|
+
Feature('CodeceptJS Demonstration')
|
|
272
313
|
|
|
273
|
-
Before(({ I }) => {
|
|
274
|
-
|
|
275
|
-
|
|
314
|
+
Before(({ I }) => {
|
|
315
|
+
// or Background
|
|
316
|
+
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
|
|
317
|
+
})
|
|
276
318
|
|
|
277
319
|
Scenario('test some forms', ({ I, docsPage }) => {
|
|
278
|
-
docsPage.sendForm('hello@world.com','123456')
|
|
279
|
-
I.see('User is valid')
|
|
280
|
-
I.dontSeeInCurrentUrl('/documentation')
|
|
281
|
-
})
|
|
320
|
+
docsPage.sendForm('hello@world.com', '123456')
|
|
321
|
+
I.see('User is valid')
|
|
322
|
+
I.dontSeeInCurrentUrl('/documentation')
|
|
323
|
+
})
|
|
282
324
|
```
|
|
283
325
|
|
|
284
326
|
When using Typescript, replace `module.exports` with `export` for autocompletion.
|
|
285
327
|
|
|
286
|
-
|
|
287
328
|
## Contributing
|
|
288
329
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
330
|
+
- ### [Contributing Guide](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CONTRIBUTING.md)
|
|
331
|
+
- ### [Code of conduct](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CODE_OF_CONDUCT.md)
|
|
292
332
|
|
|
293
333
|
## Contributors
|
|
294
334
|
|
|
295
|
-
Thanks
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<a href="https://github.com/reubenmiller"><img src="https://avatars.githubusercontent.com/u/3029781?v=4" title="reubenmiller" width="80" height="80"></a>
|
|
302
|
-
<a href="https://github.com/Arhell"><img src="https://avatars.githubusercontent.com/u/26163841?v=4" title="Arhell" width="80" height="80"></a>
|
|
303
|
-
<a href="https://github.com/APshenkin"><img src="https://avatars.githubusercontent.com/u/14344430?v=4" title="APshenkin" width="80" height="80"></a>
|
|
304
|
-
<a href="https://github.com/fabioel"><img src="https://avatars.githubusercontent.com/u/9824235?v=4" title="fabioel" width="80" height="80"></a>
|
|
305
|
-
<a href="https://github.com/pablopaul"><img src="https://avatars.githubusercontent.com/u/635526?v=4" title="pablopaul" width="80" height="80"></a>
|
|
306
|
-
<a href="https://github.com/mirao"><img src="https://avatars.githubusercontent.com/u/12584138?v=4" title="mirao" width="80" height="80"></a>
|
|
307
|
-
<a href="https://github.com/Georgegriff"><img src="https://avatars.githubusercontent.com/u/9056958?v=4" title="Georgegriff" width="80" height="80"></a>
|
|
308
|
-
<a href="https://github.com/KMKoushik"><img src="https://avatars.githubusercontent.com/u/24666922?v=4" title="KMKoushik" width="80" height="80"></a>
|
|
309
|
-
<a href="https://github.com/nikocanvacom"><img src="https://avatars.githubusercontent.com/u/83254493?v=4" title="nikocanvacom" width="80" height="80"></a>
|
|
310
|
-
<a href="https://github.com/elukoyanov"><img src="https://avatars.githubusercontent.com/u/11647141?v=4" title="elukoyanov" width="80" height="80"></a>
|
|
311
|
-
<a href="https://github.com/gkushang"><img src="https://avatars.githubusercontent.com/u/3663389?v=4" title="gkushang" width="80" height="80"></a>
|
|
312
|
-
<a href="https://github.com/tsuemura"><img src="https://avatars.githubusercontent.com/u/17092259?v=4" title="tsuemura" width="80" height="80"></a>
|
|
313
|
-
<a href="https://github.com/EgorBodnar"><img src="https://avatars.githubusercontent.com/u/63167966?v=4" title="EgorBodnar" width="80" height="80"></a>
|
|
314
|
-
<a href="https://github.com/VikalpP"><img src="https://avatars.githubusercontent.com/u/11846339?v=4" title="VikalpP" width="80" height="80"></a>
|
|
315
|
-
<a href="https://github.com/elaichenkov"><img src="https://avatars.githubusercontent.com/u/29764053?v=4" title="elaichenkov" width="80" height="80"></a>
|
|
316
|
-
<a href="https://github.com/BorisOsipov"><img src="https://avatars.githubusercontent.com/u/6514276?v=4" title="BorisOsipov" width="80" height="80"></a>
|
|
317
|
-
<a href="https://github.com/nitschSB"><img src="https://avatars.githubusercontent.com/u/39341455?v=4" title="nitschSB" width="80" height="80"></a>
|
|
318
|
-
<a href="https://github.com/hubidu"><img src="https://avatars.githubusercontent.com/u/13134082?v=4" title="hubidu" width="80" height="80"></a>
|
|
319
|
-
<a href="https://github.com/jploskonka"><img src="https://avatars.githubusercontent.com/u/669483?v=4" title="jploskonka" width="80" height="80"></a>
|
|
320
|
-
<a href="https://github.com/ngraf"><img src="https://avatars.githubusercontent.com/u/7094389?v=4" title="ngraf" width="80" height="80"></a>
|
|
321
|
-
<a href="https://github.com/maojunxyz"><img src="https://avatars.githubusercontent.com/u/28778042?v=4" title="maojunxyz" width="80" height="80"></a>
|
|
322
|
-
<a href="https://github.com/abhimanyupandian"><img src="https://avatars.githubusercontent.com/u/36107381?v=4" title="abhimanyupandian" width="80" height="80"></a>
|
|
323
|
-
<a href="https://github.com/martomo"><img src="https://avatars.githubusercontent.com/u/1850135?v=4" title="martomo" width="80" height="80"></a>
|
|
324
|
-
<a href="https://github.com/hatufacci"><img src="https://avatars.githubusercontent.com/u/4963181?v=4" title="hatufacci" width="80" height="80"></a>
|
|
325
|
-
<a href="https://github.com/johnyb"><img src="https://avatars.githubusercontent.com/u/86358?v=4" title="johnyb" width="80" height="80"></a>
|
|
326
|
-
|
|
327
|
-
[//]: contributor-faces
|
|
335
|
+
Thanks to our awesome contributors! 🎉
|
|
336
|
+
<a href="https://github.com/codeceptjs/codeceptjs/graphs/contributors">
|
|
337
|
+
<img src="https://contrib.rocks/image?repo=codeceptjs/codeceptjs" />
|
|
338
|
+
</a>
|
|
339
|
+
|
|
340
|
+
Made with [contrib.rocks](https://contrib.rocks).
|
|
328
341
|
|
|
329
342
|
## License
|
|
330
343
|
|