codeceptjs 3.5.12-beta.5 → 3.5.12-beta.7
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/lib/helper/MockServer.js +215 -0
- package/lib/helper/Playwright.js +43 -22
- package/lib/helper/Puppeteer.js +25 -6
- package/lib/helper/WebDriver.js +25 -4
- package/lib/helper/errors/ElementAssertion.js +38 -0
- package/package.json +6 -5
- package/typings/index.d.ts +16 -0
- package/typings/promiseBasedTypes.d.ts +182 -0
- package/typings/types.d.ts +182 -0
- package/docs/advanced.md +0 -351
- package/docs/ai.md +0 -248
- package/docs/api.md +0 -323
- package/docs/basics.md +0 -979
- package/docs/bdd.md +0 -539
- package/docs/best.md +0 -237
- package/docs/books.md +0 -37
- package/docs/bootstrap.md +0 -135
- package/docs/build/ApiDataFactory.js +0 -410
- package/docs/build/Appium.js +0 -2027
- package/docs/build/Expect.js +0 -422
- package/docs/build/FileSystem.js +0 -228
- package/docs/build/GraphQL.js +0 -229
- package/docs/build/GraphQLDataFactory.js +0 -309
- package/docs/build/JSONResponse.js +0 -338
- package/docs/build/Mochawesome.js +0 -71
- package/docs/build/Nightmare.js +0 -2152
- package/docs/build/OpenAI.js +0 -126
- package/docs/build/Playwright.js +0 -5110
- package/docs/build/Protractor.js +0 -2706
- package/docs/build/Puppeteer.js +0 -3905
- package/docs/build/REST.js +0 -344
- package/docs/build/TestCafe.js +0 -2125
- package/docs/build/WebDriver.js +0 -4240
- package/docs/changelog.md +0 -2572
- package/docs/commands.md +0 -266
- package/docs/community-helpers.md +0 -58
- package/docs/configuration.md +0 -157
- package/docs/continuous-integration.md +0 -22
- package/docs/custom-helpers.md +0 -306
- package/docs/data.md +0 -379
- package/docs/detox.md +0 -235
- package/docs/docker.md +0 -136
- package/docs/email.md +0 -183
- package/docs/examples.md +0 -149
- package/docs/helpers/ApiDataFactory.md +0 -266
- package/docs/helpers/Appium.md +0 -1374
- package/docs/helpers/Detox.md +0 -586
- package/docs/helpers/Expect.md +0 -275
- package/docs/helpers/FileSystem.md +0 -152
- package/docs/helpers/GraphQL.md +0 -151
- package/docs/helpers/GraphQLDataFactory.md +0 -226
- package/docs/helpers/JSONResponse.md +0 -254
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockRequest.md +0 -377
- package/docs/helpers/Nightmare.md +0 -1305
- package/docs/helpers/OpenAI.md +0 -70
- package/docs/helpers/Playwright.md +0 -2759
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/Puppeteer-firefox.md +0 -86
- package/docs/helpers/Puppeteer.md +0 -2317
- package/docs/helpers/REST.md +0 -218
- package/docs/helpers/TestCafe.md +0 -1321
- package/docs/helpers/WebDriver.md +0 -2547
- package/docs/hooks.md +0 -340
- package/docs/index.md +0 -111
- package/docs/installation.md +0 -75
- package/docs/internal-api.md +0 -266
- package/docs/locators.md +0 -339
- package/docs/mobile-react-native-locators.md +0 -67
- package/docs/mobile.md +0 -338
- package/docs/pageobjects.md +0 -291
- package/docs/parallel.md +0 -400
- package/docs/playwright.md +0 -632
- package/docs/plugins.md +0 -1259
- package/docs/puppeteer.md +0 -316
- package/docs/quickstart.md +0 -162
- package/docs/react.md +0 -70
- package/docs/reports.md +0 -392
- package/docs/secrets.md +0 -36
- package/docs/shadow.md +0 -68
- package/docs/shared/keys.mustache +0 -31
- package/docs/shared/react.mustache +0 -1
- package/docs/testcafe.md +0 -174
- package/docs/translation.md +0 -247
- package/docs/tutorial.md +0 -271
- package/docs/typescript.md +0 -180
- package/docs/ui.md +0 -59
- package/docs/videos.md +0 -28
- package/docs/visual.md +0 -202
- package/docs/vue.md +0 -143
- package/docs/webapi/amOnPage.mustache +0 -11
- package/docs/webapi/appendField.mustache +0 -11
- package/docs/webapi/attachFile.mustache +0 -12
- package/docs/webapi/blur.mustache +0 -18
- package/docs/webapi/checkOption.mustache +0 -13
- package/docs/webapi/clearCookie.mustache +0 -9
- package/docs/webapi/clearField.mustache +0 -9
- package/docs/webapi/click.mustache +0 -25
- package/docs/webapi/clickLink.mustache +0 -8
- package/docs/webapi/closeCurrentTab.mustache +0 -7
- package/docs/webapi/closeOtherTabs.mustache +0 -8
- package/docs/webapi/dontSee.mustache +0 -11
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +0 -10
- package/docs/webapi/dontSeeCookie.mustache +0 -8
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +0 -10
- package/docs/webapi/dontSeeElement.mustache +0 -8
- package/docs/webapi/dontSeeElementInDOM.mustache +0 -8
- package/docs/webapi/dontSeeInCurrentUrl.mustache +0 -4
- package/docs/webapi/dontSeeInField.mustache +0 -11
- package/docs/webapi/dontSeeInSource.mustache +0 -8
- package/docs/webapi/dontSeeInTitle.mustache +0 -8
- package/docs/webapi/doubleClick.mustache +0 -13
- package/docs/webapi/downloadFile.mustache +0 -12
- package/docs/webapi/dragAndDrop.mustache +0 -9
- package/docs/webapi/dragSlider.mustache +0 -11
- package/docs/webapi/executeAsyncScript.mustache +0 -24
- package/docs/webapi/executeScript.mustache +0 -26
- package/docs/webapi/fillField.mustache +0 -16
- package/docs/webapi/focus.mustache +0 -13
- package/docs/webapi/forceClick.mustache +0 -28
- package/docs/webapi/forceRightClick.mustache +0 -18
- package/docs/webapi/grabAllWindowHandles.mustache +0 -7
- package/docs/webapi/grabAttributeFrom.mustache +0 -10
- package/docs/webapi/grabAttributeFromAll.mustache +0 -9
- package/docs/webapi/grabBrowserLogs.mustache +0 -9
- package/docs/webapi/grabCookie.mustache +0 -11
- package/docs/webapi/grabCssPropertyFrom.mustache +0 -11
- package/docs/webapi/grabCssPropertyFromAll.mustache +0 -10
- package/docs/webapi/grabCurrentUrl.mustache +0 -9
- package/docs/webapi/grabCurrentWindowHandle.mustache +0 -6
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +0 -20
- package/docs/webapi/grabElementBoundingRect.mustache +0 -20
- package/docs/webapi/grabGeoLocation.mustache +0 -8
- package/docs/webapi/grabHTMLFrom.mustache +0 -10
- package/docs/webapi/grabHTMLFromAll.mustache +0 -9
- package/docs/webapi/grabNumberOfOpenTabs.mustache +0 -8
- package/docs/webapi/grabNumberOfVisibleElements.mustache +0 -9
- package/docs/webapi/grabPageScrollPosition.mustache +0 -8
- package/docs/webapi/grabPopupText.mustache +0 -5
- package/docs/webapi/grabSource.mustache +0 -8
- package/docs/webapi/grabTextFrom.mustache +0 -10
- package/docs/webapi/grabTextFromAll.mustache +0 -9
- package/docs/webapi/grabTitle.mustache +0 -8
- package/docs/webapi/grabValueFrom.mustache +0 -9
- package/docs/webapi/grabValueFromAll.mustache +0 -8
- package/docs/webapi/grabWebElement.mustache +0 -9
- package/docs/webapi/grabWebElements.mustache +0 -9
- package/docs/webapi/moveCursorTo.mustache +0 -12
- package/docs/webapi/openNewTab.mustache +0 -7
- package/docs/webapi/pressKey.mustache +0 -12
- package/docs/webapi/pressKeyDown.mustache +0 -12
- package/docs/webapi/pressKeyUp.mustache +0 -12
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +0 -60
- package/docs/webapi/refreshPage.mustache +0 -6
- package/docs/webapi/resizeWindow.mustache +0 -6
- package/docs/webapi/rightClick.mustache +0 -14
- package/docs/webapi/saveElementScreenshot.mustache +0 -10
- package/docs/webapi/saveScreenshot.mustache +0 -12
- package/docs/webapi/say.mustache +0 -10
- package/docs/webapi/scrollIntoView.mustache +0 -11
- package/docs/webapi/scrollPageToBottom.mustache +0 -6
- package/docs/webapi/scrollPageToTop.mustache +0 -6
- package/docs/webapi/scrollTo.mustache +0 -12
- package/docs/webapi/see.mustache +0 -11
- package/docs/webapi/seeAttributesOnElements.mustache +0 -9
- package/docs/webapi/seeCheckboxIsChecked.mustache +0 -10
- package/docs/webapi/seeCookie.mustache +0 -8
- package/docs/webapi/seeCssPropertiesOnElements.mustache +0 -9
- package/docs/webapi/seeCurrentUrlEquals.mustache +0 -11
- package/docs/webapi/seeElement.mustache +0 -8
- package/docs/webapi/seeElementInDOM.mustache +0 -8
- package/docs/webapi/seeInCurrentUrl.mustache +0 -8
- package/docs/webapi/seeInField.mustache +0 -12
- package/docs/webapi/seeInPopup.mustache +0 -8
- package/docs/webapi/seeInSource.mustache +0 -7
- package/docs/webapi/seeInTitle.mustache +0 -8
- package/docs/webapi/seeNumberOfElements.mustache +0 -11
- package/docs/webapi/seeNumberOfVisibleElements.mustache +0 -10
- package/docs/webapi/seeTextEquals.mustache +0 -9
- package/docs/webapi/seeTitleEquals.mustache +0 -8
- package/docs/webapi/selectOption.mustache +0 -21
- package/docs/webapi/setCookie.mustache +0 -16
- package/docs/webapi/setGeoLocation.mustache +0 -12
- package/docs/webapi/switchTo.mustache +0 -9
- package/docs/webapi/switchToNextTab.mustache +0 -10
- package/docs/webapi/switchToPreviousTab.mustache +0 -10
- package/docs/webapi/type.mustache +0 -21
- package/docs/webapi/uncheckOption.mustache +0 -13
- package/docs/webapi/wait.mustache +0 -8
- package/docs/webapi/waitForClickable.mustache +0 -11
- package/docs/webapi/waitForDetached.mustache +0 -10
- package/docs/webapi/waitForElement.mustache +0 -11
- package/docs/webapi/waitForEnabled.mustache +0 -6
- package/docs/webapi/waitForFunction.mustache +0 -17
- package/docs/webapi/waitForInvisible.mustache +0 -10
- package/docs/webapi/waitForNumberOfTabs.mustache +0 -9
- package/docs/webapi/waitForText.mustache +0 -13
- package/docs/webapi/waitForValue.mustache +0 -10
- package/docs/webapi/waitForVisible.mustache +0 -10
- package/docs/webapi/waitInUrl.mustache +0 -9
- package/docs/webapi/waitNumberOfVisibleElements.mustache +0 -10
- package/docs/webapi/waitToHide.mustache +0 -10
- package/docs/webapi/waitUrlEquals.mustache +0 -10
- package/docs/webdriver.md +0 -701
- package/docs/wiki/Books-&-Posts.md +0 -27
- package/docs/wiki/Community-Helpers-&-Plugins.md +0 -53
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -61
- package/docs/wiki/Examples.md +0 -145
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
- package/docs/wiki/Home.md +0 -16
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +0 -83
- package/docs/wiki/Release-Process.md +0 -24
- package/docs/wiki/Roadmap.md +0 -23
- package/docs/wiki/Tests.md +0 -1393
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
- package/docs/wiki/Videos.md +0 -19
package/docs/reports.md
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
permalink: /reports
|
|
3
|
-
title: Reporters
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Reporters
|
|
7
|
-
|
|
8
|
-
## Cli
|
|
9
|
-
|
|
10
|
-
By default, CodeceptJS provides cli reporter with console output.
|
|
11
|
-
Test names and failures will be printed out on screen.
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
GitHub --
|
|
15
|
-
✓ search in 2577ms
|
|
16
|
-
✓ signin in 2170ms
|
|
17
|
-
✖ register in 1306ms
|
|
18
|
-
|
|
19
|
-
-- FAILURES:
|
|
20
|
-
|
|
21
|
-
1) GitHub: register:
|
|
22
|
-
Field q not found by name|text|CSS|XPath
|
|
23
|
-
|
|
24
|
-
Scenario Steps:
|
|
25
|
-
|
|
26
|
-
- I.fillField("q", "aaa") at examples/github_test.js:29:7
|
|
27
|
-
- I.fillField("user[password]", "user@user.com") at examples/github_test.js:28:7
|
|
28
|
-
- I.fillField("user[email]", "user@user.com") at examples/github_test.js:27:7
|
|
29
|
-
- I.fillField("user[login]", "User") at examples/github_test.js:26:7
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Run with --verbose flag to see NodeJS stacktrace
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
output steps use `--steps` option:
|
|
38
|
-
```
|
|
39
|
-
npx codeceptjs run --steps
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Output:
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
GitHub --
|
|
46
|
-
search
|
|
47
|
-
• I am on page "https://github.com"
|
|
48
|
-
• I am on page "https://github.com/search"
|
|
49
|
-
• I fill field "Search GitHub", "CodeceptJS"
|
|
50
|
-
• I press key "Enter"
|
|
51
|
-
• I see "Codeception/CodeceptJS", "a"
|
|
52
|
-
✓ OK in 2681ms
|
|
53
|
-
|
|
54
|
-
signin
|
|
55
|
-
• I am on page "https://github.com"
|
|
56
|
-
• I click "Sign in"
|
|
57
|
-
• I see "Sign in to GitHub"
|
|
58
|
-
• I fill field "Username or email address", "something@totest.com"
|
|
59
|
-
• I fill field "Password", "123456"
|
|
60
|
-
• I click "Sign in"
|
|
61
|
-
• I see "Incorrect username or password.", ".flash-error"
|
|
62
|
-
✓ OK in 2252ms
|
|
63
|
-
|
|
64
|
-
register
|
|
65
|
-
• I am on page "https://github.com"
|
|
66
|
-
Within .js-signup-form:
|
|
67
|
-
• I fill field "user[login]", "User"
|
|
68
|
-
• I fill field "user[email]", "user@user.com"
|
|
69
|
-
• I fill field "user[password]", "user@user.com"
|
|
70
|
-
• I fill field "q", "aaa"
|
|
71
|
-
✖ FAILED in 1260ms
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
To get additional information about test execution use `--debug` option.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
npx codeceptjs run --debug
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
This will show execution steps
|
|
83
|
-
as well as notices from test runner. To get even more information with more technical details like error stack traces,
|
|
84
|
-
and global promises, or events use `--verbose` mode.
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
npx codeceptjs run --verbose
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
```sh
|
|
91
|
-
GitHub --
|
|
92
|
-
register
|
|
93
|
-
[1] Starting recording promises
|
|
94
|
-
Emitted | test.before
|
|
95
|
-
> WebDriver._before
|
|
96
|
-
[1] Queued | hook WebDriver._before()
|
|
97
|
-
[1] Queued | amOnPage: https://github.com
|
|
98
|
-
Emitted | step.before (I am on page "https://github.com")
|
|
99
|
-
• I am on page "https://github.com"
|
|
100
|
-
Emitted | step.after (I am on page "https://github.com")
|
|
101
|
-
Emitted | test.start ([object Object])
|
|
102
|
-
...
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Please use verbose output when reporting issues to GitHub.
|
|
106
|
-
|
|
107
|
-
### Dry Run
|
|
108
|
-
|
|
109
|
-
There is a way to list all tests and their steps without actually executing them. Execute tests in `dry-run` mode to see all available tests:
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
npx codeceptjs dry-run
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Output:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
Tests from /home/davert/projects/codeceptjs/examples:
|
|
119
|
-
|
|
120
|
-
Business rules --
|
|
121
|
-
☐ do something
|
|
122
|
-
Google --
|
|
123
|
-
☐ test @123
|
|
124
|
-
GitHub -- /home/davert/projects/codeceptjs/examples/github_test.js
|
|
125
|
-
☐ Visit Home Page @retry
|
|
126
|
-
☐ search @grop
|
|
127
|
-
☐ signin @normal @important @slow
|
|
128
|
-
☐ signin2
|
|
129
|
-
☐ register
|
|
130
|
-
|
|
131
|
-
Total: 3 suites | 7 tests
|
|
132
|
-
|
|
133
|
-
--- DRY MODE: No tests were executed ---
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Pass `--steps` or `--debug` option as in `run` command to also get steps and substeps to be printed. In this mode **tests will be executed** but all helpers and plugins disabled, so no real actions will be performed.
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
npx codecepjs dry-run --debug
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
> ℹ If you use custom JavaScript code inside tests, or rely on values from `grab*` commands, dry-run may produce error output.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## Testomat.io
|
|
146
|
-
|
|
147
|
-
[Testomat.io](https://testomat.io) is a modern test management tool focused on CodeceptJS and **created by CodeceptJS team**.
|
|
148
|
-
Testomat.io is commercial SaaS service that can receive run reports from local runs or CI. Out of box Testomat.io supports parallel runs, uploading of screenshots and videos.
|
|
149
|
-
|
|
150
|
-

|
|
151
|
-
|
|
152
|
-
> 😻 **Testomat.io is free** for small teams, so you can use its reporting features with CodeceptJS.
|
|
153
|
-
|
|
154
|
-
To receive run reports you should:
|
|
155
|
-
|
|
156
|
-
* [Sign up](https://app.testomat.io/users/sign_up) at Testomat.io
|
|
157
|
-
* Create a new "Classical" project (select "BDD" project if you use CodeceptJS in BDD mode)
|
|
158
|
-
* Select "Import from Source Code"
|
|
159
|
-
* Select "CodeceptJS" as testing framework and JavaScript or TypeScript as a language. If you use BDD select "Gherkin" as language.
|
|
160
|
-
* Execute provided command in a terminal with your project. This will be "check-tests" or "check-cucmber" command. It scans all your test files and imports them into Testomat.io. This way all your e2e tests will be visible in one UI.
|
|
161
|
-
* After tests are imported, go to Runs tab and select "Setup automated tests".
|
|
162
|
-
* Follow the instructions:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-

|
|
166
|
-
|
|
167
|
-
* You will need to install `@testomatio/reporter` package and enable it as a plugin in codeceptjs config:
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
plugins: {
|
|
171
|
-
testomatio: {
|
|
172
|
-
enabled: true,
|
|
173
|
-
require: '@testomatio/reporter/lib/adapter/codecept',
|
|
174
|
-
apiKey: process.env.TESTOMATIO,
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
* Run tests with `TESTOMATIO=` env variable and API key provided by Testomat.io
|
|
180
|
-
* See the run report is created and updated in realtime.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
[Testomat.io](https://testomat.io) reporter works in the cloud, so it doesn't require you to install additional software. It can be integrated with your CI service to rerun only failed tests, launch new runs from UI, and send report notifications by email or in Slack, MS Teams, or create issue in Jira.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
## ReportPortal
|
|
188
|
-
|
|
189
|
-
For enterprise grade we reporting we recommend using [ReportPortal](https://reportportal.io).
|
|
190
|
-
|
|
191
|
-

|
|
192
|
-
|
|
193
|
-
[ReportPortal](https://reportportal.io) is open-source self-hosted service for aggregating test execution reports.
|
|
194
|
-
Think of it as Kibana but for test reports.
|
|
195
|
-
|
|
196
|
-
Use official [CodeceptJS Agent for ReportPortal](https://github.com/reportportal/agent-js-codecept/) to start publishing your test results.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
## XML
|
|
200
|
-
|
|
201
|
-
Use default xunit reporter of Mocha to print xml reports. Provide `--reporter xunit` to get the report to screen.
|
|
202
|
-
It is recommended to use more powerful [`mocha-junit-reporter`](https://www.npmjs.com/package/mocha-junit-reporter) package
|
|
203
|
-
to get better support for Jenkins CI.
|
|
204
|
-
|
|
205
|
-
Install it via NPM (locally or globally, depending on CodeceptJS installation type):
|
|
206
|
-
|
|
207
|
-
```sh
|
|
208
|
-
npm i mocha-junit-reporter
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Additional configuration should be added to `codecept.conf.js` to print xml report to `output` directory:
|
|
212
|
-
|
|
213
|
-
```json
|
|
214
|
-
"mocha": {
|
|
215
|
-
"reporterOptions": {
|
|
216
|
-
"mochaFile": "output/result.xml"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Execute CodeceptJS with JUnit reporter:
|
|
222
|
-
|
|
223
|
-
```sh
|
|
224
|
-
codeceptjs run --reporter mocha-junit-reporter
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
Result will be located at `output/result.xml` file.
|
|
228
|
-
|
|
229
|
-
## Html
|
|
230
|
-
|
|
231
|
-
Best HTML reports could be produced with [mochawesome](https://www.npmjs.com/package/mochawesome) reporter.
|
|
232
|
-
|
|
233
|
-

|
|
234
|
-
|
|
235
|
-
Install it via NPM:
|
|
236
|
-
|
|
237
|
-
```sh
|
|
238
|
-
npm i mochawesome
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
If you get an error like this
|
|
242
|
-
```sh
|
|
243
|
-
"mochawesome" reporter not found
|
|
244
|
-
|
|
245
|
-
invalid reporter "mochawesome"
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Make sure to have mocha installed or install it:
|
|
249
|
-
|
|
250
|
-
```sh
|
|
251
|
-
npm i mocha -D
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Configure it to use `output` directory to print HTML reports:
|
|
255
|
-
|
|
256
|
-
```json
|
|
257
|
-
"mocha": {
|
|
258
|
-
"reporterOptions": {
|
|
259
|
-
"reportDir": "output"
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Execute CodeceptJS with HTML reporter:
|
|
265
|
-
|
|
266
|
-
```sh
|
|
267
|
-
codeceptjs run --reporter mochawesome
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Result will be located at `output/index.html` file.
|
|
271
|
-
|
|
272
|
-
### Advanced usage
|
|
273
|
-
|
|
274
|
-
Want to have screenshots for failed tests?
|
|
275
|
-
Then add Mochawesome helper to your config:
|
|
276
|
-
|
|
277
|
-
```json
|
|
278
|
-
"helpers": {
|
|
279
|
-
"Mochawesome": {
|
|
280
|
-
"uniqueScreenshotNames": "true"
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Then tests with failure will have screenshots.
|
|
286
|
-
|
|
287
|
-
### Configuration
|
|
288
|
-
|
|
289
|
-
This helper should be configured in codecept.conf.ts
|
|
290
|
-
|
|
291
|
-
- `uniqueScreenshotNames` (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites. This option should be the same as in common helper.
|
|
292
|
-
- `disableScreenshots` (optional, default: false) - don't save screenshot on failure. This option should be the same as in common helper.
|
|
293
|
-
|
|
294
|
-
Also if you will add Mochawesome helper, then you will able to add custom context in report:
|
|
295
|
-
|
|
296
|
-
#### addMochawesomeContext
|
|
297
|
-
|
|
298
|
-
Adds context to executed test in HTML report:
|
|
299
|
-
|
|
300
|
-
```js
|
|
301
|
-
I.addMochawesomeContext('simple string');
|
|
302
|
-
I.addMochawesomeContext('http://www.url.com/pathname');
|
|
303
|
-
I.addMochawesomeContext('http://www.url.com/screenshot-maybe.jpg');
|
|
304
|
-
I.addMochawesomeContext({title: 'expected output',
|
|
305
|
-
value: {
|
|
306
|
-
a: 1,
|
|
307
|
-
b: '2',
|
|
308
|
-
c: 'd'
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
##### Parameters
|
|
314
|
-
|
|
315
|
-
- `context` string, url, path to screenshot, object. See [this](https://www.npmjs.com/package/mochawesome#adding-test-context)
|
|
316
|
-
|
|
317
|
-
## Multi Reports
|
|
318
|
-
|
|
319
|
-
Want to use several reporters in the same time? Try to use [mocha-multi](https://www.npmjs.com/package/mocha-multi) reporter
|
|
320
|
-
|
|
321
|
-
Install it via NPM:
|
|
322
|
-
|
|
323
|
-
```sh
|
|
324
|
-
npm i mocha-multi
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Configure mocha-multi with reports that you want:
|
|
328
|
-
|
|
329
|
-
```json
|
|
330
|
-
"mocha": {
|
|
331
|
-
"reporterOptions": {
|
|
332
|
-
"codeceptjs-cli-reporter": {
|
|
333
|
-
"stdout": "-",
|
|
334
|
-
"options": {
|
|
335
|
-
"verbose": true,
|
|
336
|
-
"steps": true,
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
"mochawesome": {
|
|
340
|
-
"stdout": "./output/console.log",
|
|
341
|
-
"options": {
|
|
342
|
-
"reportDir": "./output",
|
|
343
|
-
"reportFilename": "report"
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
"mocha-junit-reporter": {
|
|
347
|
-
"stdout": "./output/console.log",
|
|
348
|
-
"options": {
|
|
349
|
-
"mochaFile": "./output/result.xml",
|
|
350
|
-
"attachments": true //add screenshot for a failed test
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
Execute CodeceptJS with mocha-multi reporter:
|
|
358
|
-
|
|
359
|
-
```sh
|
|
360
|
-
npx codeceptjs run --reporter mocha-multi
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
This will give you cli with steps in console and HTML report in `output` directory.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
## Testrail
|
|
367
|
-
|
|
368
|
-
Testrail integration with CodeceptJS is now so seamless. The test run is created automatically afterwards. The screenshots of failed tests are also attached to test results.
|
|
369
|
-
|
|
370
|
-
Try to use [codeceptjs-testrail](https://www.npmjs.com/package/codeceptjs-testrail) plugin
|
|
371
|
-
|
|
372
|
-
Install it via NPM:
|
|
373
|
-
|
|
374
|
-
```sh
|
|
375
|
-
npm i codeceptjs-testrail --save
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-

|
|
379
|
-
|
|
380
|
-
Now there is new feature, add the configuration to test run of test plan
|
|
381
|
-

|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
## Tesults
|
|
385
|
-
|
|
386
|
-
Submit test results data from CodeceptJS to [Tesults](https://www.tesults.com) easily with the [codeceptjs-tesults](https://www.npmjs.com/package/codeceptjs-tesults) plugin. Test results data is submitted automatically after a test run completes.
|
|
387
|
-
|
|
388
|
-
```sh
|
|
389
|
-
npm i codeceptjs-tesults --save
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
Once installed, follow the [quick and easy integration instructions](https://www.tesults.com/docs/codeceptjs) to get setup in no time.
|
package/docs/secrets.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Secrets
|
|
2
|
-
|
|
3
|
-
It is possible to **mask out sensitive data** when passing it to steps. This is important when filling password fields, or sending secure keys to API endpoint.
|
|
4
|
-
|
|
5
|
-
Wrap data in `secret` function to mask sensitive values in output and logs.
|
|
6
|
-
|
|
7
|
-
For basic string `secret` just wrap a value into a string:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
I.fillField('password', secret('123456'));
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
When executed it will be printed like this:
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
I fill field "password" "*****"
|
|
17
|
-
```
|
|
18
|
-
**Other Examples**
|
|
19
|
-
```js
|
|
20
|
-
I.fillField('password', secret('123456'));
|
|
21
|
-
I.append('password', secret('123456'));
|
|
22
|
-
I.type('password', secret('123456'));
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
For an object, which can be a payload to POST request, specify which fields should be masked:
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
I.sendPostRequest('/login', secret({
|
|
29
|
-
name: 'davert',
|
|
30
|
-
password: '123456'
|
|
31
|
-
}, 'password'))
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The object created from `secret` is as Proxy to the object passed in. When printed password will be replaced with ****.
|
|
35
|
-
|
|
36
|
-
> ⚠️ Only direct properties of the object can be masked via `secret`
|
package/docs/shadow.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
permalink: /shadow
|
|
3
|
-
title: Locating Shadow Dom Elements
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Locating Shadow Dom Elements
|
|
7
|
-
|
|
8
|
-
> ℹ Shadow DOM locators is supported only in WebDriver helper
|
|
9
|
-
|
|
10
|
-
Shadow DOM is one of the key browser features that make up web components. Web components are a really great way to build reusable elements, and are able to scale all the way up to complete web applications. Style encapsulation, the feature that gives shadow DOM it's power, has been a bit of a pain when it comes to E2E or UI testing. Things just got a little easier though, as CodeceptJS introduced built-in support for shadow DOM via locators of type `shadow`. Let's dig into what they're all about.
|
|
11
|
-
|
|
12
|
-
Generated HTML code may often look like this (ref: [Salesforce's Lighting Web Components](https://github.com/salesforce/lwc)):
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
<body>
|
|
16
|
-
<my-app>
|
|
17
|
-
<recipe-hello>
|
|
18
|
-
<button>Click Me!</button>
|
|
19
|
-
</recipe-hello>
|
|
20
|
-
<recipe-hello-binding>
|
|
21
|
-
<ui-input>
|
|
22
|
-
<input type="text" class="input">
|
|
23
|
-
</ui-input>
|
|
24
|
-
</recipe-hello-binding>
|
|
25
|
-
</my-app>
|
|
26
|
-
</body>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This uses custom elements, `my-app`, `recipe-hello`, `recipe-hello-binding` and `ui-input`. It's quite common that clickable elements are not actual `a` or `button` elements but custom elements. This way `I.click('Click Me!');` won't work, as well as `fillField('.input', 'value)`. Finding a correct locator for such cases turns to be almost impossible until `shadow` element support is added to CodeceptJS.
|
|
30
|
-
|
|
31
|
-
## Locate Shadow Dom
|
|
32
|
-
|
|
33
|
-
For Web Components or [Salesforce's Lighting Web Components](https://github.com/salesforce/lwc) with Shadow DOM's, a special `shadow` locator is available. It allows to select an element by its shadow dom sequences and sequences are defined as an Array of `elements`. Elements defined in the array of `elements` must be in the ordered the shadow elements appear in the DOM.
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
{ shadow: ['my-app', 'recipe-hello', 'button'] }
|
|
37
|
-
{ shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
In WebDriver, you can use shadow locators in any method where locator is required.
|
|
41
|
-
|
|
42
|
-
For example, to fill value in `input` field or to click the `Click Me!` button, in above HTML code:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
I.fillField({ shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }, 'value');
|
|
46
|
-
I.click({ shadow: ['my-app', 'recipe-hello', 'button'] });
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Example
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
Feature('Shadow Dom Locators');
|
|
53
|
-
|
|
54
|
-
Scenario('should fill input field within shadow elements', ({I}) => {
|
|
55
|
-
|
|
56
|
-
// navigate to LWC webpage containing shadow dom
|
|
57
|
-
I.amOnPage('https://recipes.lwc.dev/');
|
|
58
|
-
|
|
59
|
-
// click Click Me! button
|
|
60
|
-
I.click({ shadow: ['my-app', 'recipe-hello', 'button'] });
|
|
61
|
-
|
|
62
|
-
// fill the input field
|
|
63
|
-
I.fillField({ shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }, 'value');
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
|
|
2
|
-
|
|
3
|
-
- `'Add'`,
|
|
4
|
-
- `'Alt'`,
|
|
5
|
-
- `'ArrowDown'` or `'Down arrow'`,
|
|
6
|
-
- `'ArrowLeft'` or `'Left arrow'`,
|
|
7
|
-
- `'ArrowRight'` or `'Right arrow'`,
|
|
8
|
-
- `'ArrowUp'` or `'Up arrow'`,
|
|
9
|
-
- `'Backspace'`,
|
|
10
|
-
- `'Command'`,
|
|
11
|
-
- `'Control'`,
|
|
12
|
-
- `'Del'`,
|
|
13
|
-
- `'Divide'`,
|
|
14
|
-
- `'End'`,
|
|
15
|
-
- `'Enter'`,
|
|
16
|
-
- `'Equals'`,
|
|
17
|
-
- `'Escape'`,
|
|
18
|
-
- `'F1 to F12'`,
|
|
19
|
-
- `'Home'`,
|
|
20
|
-
- `'Insert'`,
|
|
21
|
-
- `'Meta'`,
|
|
22
|
-
- `'Multiply'`,
|
|
23
|
-
- `'Numpad 0'` to `'Numpad 9'`,
|
|
24
|
-
- `'Pagedown'` or `'PageDown'`,
|
|
25
|
-
- `'Pageup'` or `'PageUp'`,
|
|
26
|
-
- `'Pause'`,
|
|
27
|
-
- `'Semicolon'`,
|
|
28
|
-
- `'Shift'`,
|
|
29
|
-
- `'Space'`,
|
|
30
|
-
- `'Subtract'`,
|
|
31
|
-
- `'Tab'`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
This action supports [React locators](https://codecept.io/react#locators)
|