codeceptjs 4.0.0-rc.2 → 4.0.0-rc.20
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 +39 -27
- package/bin/codecept.js +15 -2
- package/bin/codeceptq.js +49 -0
- package/bin/mcp-server.js +1187 -0
- package/docs/advanced.md +201 -0
- package/docs/agents.md +159 -0
- package/docs/ai.md +537 -0
- package/docs/aitrace.md +266 -0
- package/docs/api.md +332 -0
- package/docs/assertions.md +415 -0
- package/docs/auth.md +318 -0
- package/docs/basics.md +424 -0
- package/docs/bdd.md +539 -0
- package/docs/best.md +240 -0
- package/docs/bootstrap.md +132 -0
- package/docs/commands.md +352 -0
- package/docs/community-helpers.md +63 -0
- package/docs/configuration.md +230 -0
- package/docs/continuous-integration.md +497 -0
- package/docs/custom-helpers.md +297 -0
- package/docs/data.md +448 -0
- package/docs/debugging.md +332 -0
- package/docs/detox.md +235 -0
- package/docs/docker.md +136 -0
- package/docs/effects.md +179 -0
- package/docs/element-based-testing.md +295 -0
- package/docs/element-selection.md +125 -0
- package/docs/els.md +328 -0
- package/docs/examples.md +161 -0
- package/docs/heal.md +213 -0
- package/docs/helpers/ApiDataFactory.md +267 -0
- package/docs/helpers/Appium.md +1405 -0
- package/docs/helpers/Detox.md +665 -0
- package/docs/helpers/ExpectHelper.md +275 -0
- package/docs/helpers/FileSystem.md +152 -0
- package/docs/helpers/GraphQL.md +152 -0
- package/docs/helpers/GraphQLDataFactory.md +226 -0
- package/docs/helpers/JSONResponse.md +255 -0
- package/docs/helpers/Mochawesome.md +8 -0
- package/docs/helpers/MockRequest.md +377 -0
- package/docs/helpers/MockServer.md +212 -0
- package/docs/helpers/Playwright.md +2969 -0
- package/docs/helpers/Polly.md +44 -0
- package/docs/helpers/Protractor.md +1769 -0
- package/docs/helpers/Puppeteer-firefox.md +86 -0
- package/docs/helpers/Puppeteer.md +2690 -0
- package/docs/helpers/REST.md +289 -0
- package/docs/helpers/SoftExpectHelper.md +352 -0
- package/docs/helpers/WebDriver.md +2682 -0
- package/docs/hooks.md +339 -0
- package/docs/index.md +111 -0
- package/docs/installation.md +83 -0
- package/docs/internal-api.md +265 -0
- package/docs/internal-test-server.md +89 -0
- package/docs/locators.md +355 -0
- package/docs/mcp.md +485 -0
- package/docs/migration-4.md +556 -0
- package/docs/mobile.md +338 -0
- package/docs/pageobjects.md +399 -0
- package/docs/parallel.md +585 -0
- package/docs/playwright.md +714 -0
- package/docs/plugins.md +866 -0
- package/docs/puppeteer.md +314 -0
- package/docs/quickstart.md +120 -0
- package/docs/react.md +70 -0
- package/docs/reports.md +483 -0
- package/docs/retry.md +274 -0
- package/docs/secrets.md +150 -0
- package/docs/sessions.md +80 -0
- package/docs/shadow.md +68 -0
- package/docs/test-structure.md +275 -0
- package/docs/timeouts.md +183 -0
- package/docs/translation.md +247 -0
- package/docs/tutorial.md +271 -0
- package/docs/typescript.md +374 -0
- package/docs/web-element.md +251 -0
- package/docs/webdriver.md +708 -0
- package/docs/within.md +55 -0
- package/lib/ai.js +3 -2
- package/lib/aria.js +260 -0
- package/lib/assertions.js +18 -0
- package/lib/codecept.js +26 -23
- package/lib/command/check.js +2 -1
- package/lib/command/dryRun.js +24 -5
- package/lib/command/generate.js +2 -0
- package/lib/command/gherkin/snippets.js +5 -4
- package/lib/command/init.js +248 -269
- package/lib/command/list.js +150 -10
- package/lib/command/query.js +218 -0
- package/lib/command/run-multiple.js +2 -0
- package/lib/command/run-workers.js +2 -0
- package/lib/command/run.js +1 -1
- package/lib/command/workers/runTests.js +10 -10
- package/lib/config.js +77 -4
- package/lib/container.js +114 -17
- package/lib/effects.js +17 -0
- package/lib/element/WebElement.js +246 -2
- package/lib/els.js +12 -6
- package/lib/globals.js +32 -19
- package/lib/heal.js +4 -3
- package/lib/helper/ApiDataFactory.js +2 -1
- package/lib/helper/Appium.js +8 -8
- package/lib/helper/FileSystem.js +3 -2
- package/lib/helper/GraphQLDataFactory.js +2 -1
- package/lib/helper/Playwright.js +228 -162
- package/lib/helper/Puppeteer.js +208 -76
- package/lib/helper/WebDriver.js +173 -68
- package/lib/helper/errors/MultipleElementsFound.js +27 -110
- package/lib/helper/errors/NonFocusedType.js +8 -0
- package/lib/helper/extras/Download.js +45 -0
- package/lib/helper/extras/PlaywrightReactVueLocator.js +45 -36
- package/lib/helper/extras/elementSelection.js +58 -0
- package/lib/helper/extras/focusCheck.js +43 -0
- package/lib/helper/extras/richTextEditor.js +178 -0
- package/lib/helper/scripts/dropFile.js +11 -0
- package/lib/history.js +3 -2
- package/lib/html.js +103 -16
- package/lib/index.js +9 -1
- package/lib/listener/config.js +6 -4
- package/lib/listener/emptyRun.js +2 -1
- package/lib/listener/globalRetry.js +32 -6
- package/lib/listener/helpers.js +4 -1
- package/lib/listener/mocha.js +2 -1
- package/lib/listener/pageobjects.js +43 -0
- package/lib/listener/result.js +3 -2
- package/lib/locator.js +126 -3
- package/lib/mocha/cli.js +14 -2
- package/lib/mocha/factory.js +7 -2
- package/lib/mocha/inject.js +1 -1
- package/lib/mocha/scenarioConfig.js +2 -1
- package/lib/mocha/ui.js +5 -6
- package/lib/parser.js +2 -2
- package/lib/pause.js +38 -4
- package/lib/plugin/aiTrace.js +453 -0
- package/lib/plugin/analyze.js +1 -1
- package/lib/plugin/auth.js +3 -3
- package/lib/plugin/browser.js +77 -0
- package/lib/plugin/expose.js +159 -0
- package/lib/plugin/heal.js +44 -1
- package/lib/plugin/pageInfo.js +53 -49
- package/lib/plugin/pause.js +131 -0
- package/lib/plugin/pauseOnFail.js +10 -34
- package/lib/plugin/retryFailedStep.js +28 -19
- package/lib/plugin/screencast.js +287 -0
- package/lib/plugin/screenshot.js +563 -0
- package/lib/plugin/screenshotOnFail.js +8 -171
- package/lib/rerun.js +2 -1
- package/lib/result.js +2 -1
- package/lib/step/base.js +3 -2
- package/lib/step/config.js +15 -2
- package/lib/step/record.js +2 -2
- package/lib/store.js +72 -3
- package/lib/translation.js +2 -1
- package/lib/utils/mask_data.js +2 -1
- package/lib/utils/pluginParser.js +151 -0
- package/lib/utils/trace.js +297 -0
- package/lib/utils.js +77 -3
- package/lib/workers.js +52 -22
- package/package.json +19 -13
- package/typings/index.d.ts +19 -5
- 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 -29
- 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/dontSeeCurrentPathEquals.mustache +0 -10
- 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/dontSeeTraffic.mustache +0 -13
- 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/flushNetworkTraffics.mustache +0 -5
- 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/grabRecordedNetworkTraffics.mustache +0 -10
- 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/seeCurrentPathEquals.mustache +0 -10
- 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/seeTraffic.mustache +0 -36
- package/docs/webapi/selectOption.mustache +0 -21
- package/docs/webapi/setCookie.mustache +0 -16
- package/docs/webapi/setGeoLocation.mustache +0 -12
- package/docs/webapi/startRecordingTraffic.mustache +0 -8
- package/docs/webapi/startRecordingWebSocketMessages.mustache +0 -8
- package/docs/webapi/stopRecordingTraffic.mustache +0 -5
- package/docs/webapi/stopRecordingWebSocketMessages.mustache +0 -7
- 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/waitForCookie.mustache +0 -9
- package/docs/webapi/waitForDetached.mustache +0 -10
- package/docs/webapi/waitForDisabled.mustache +0 -6
- 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/lib/helper/AI.js +0 -214
- package/lib/listener/enhancedGlobalRetry.js +0 -110
- package/lib/plugin/enhancedRetryFailedStep.js +0 -99
- package/lib/plugin/htmlReporter.js +0 -3648
- package/lib/plugin/stepByStepReport.js +0 -427
- package/lib/plugin/subtitles.js +0 -89
- package/lib/retryCoordinator.js +0 -207
- package/typings/promiseBasedTypes.d.ts +0 -9469
- package/typings/types.d.ts +0 -11402
package/docs/reports.md
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
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
|
+
```
|
|
40
|
+
npx codeceptjs run --steps
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Output:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
GitHub --
|
|
47
|
+
search
|
|
48
|
+
• I am on page "https://github.com"
|
|
49
|
+
• I am on page "https://github.com/search"
|
|
50
|
+
• I fill field "Search GitHub", "CodeceptJS"
|
|
51
|
+
• I press key "Enter"
|
|
52
|
+
• I see "Codeception/CodeceptJS", "a"
|
|
53
|
+
✓ OK in 2681ms
|
|
54
|
+
|
|
55
|
+
signin
|
|
56
|
+
• I am on page "https://github.com"
|
|
57
|
+
• I click "Sign in"
|
|
58
|
+
• I see "Sign in to GitHub"
|
|
59
|
+
• I fill field "Username or email address", "something@totest.com"
|
|
60
|
+
• I fill field "Password", "123456"
|
|
61
|
+
• I click "Sign in"
|
|
62
|
+
• I see "Incorrect username or password.", ".flash-error"
|
|
63
|
+
✓ OK in 2252ms
|
|
64
|
+
|
|
65
|
+
register
|
|
66
|
+
• I am on page "https://github.com"
|
|
67
|
+
Within .js-signup-form:
|
|
68
|
+
• I fill field "user[login]", "User"
|
|
69
|
+
• I fill field "user[email]", "user@user.com"
|
|
70
|
+
• I fill field "user[password]", "user@user.com"
|
|
71
|
+
• I fill field "q", "aaa"
|
|
72
|
+
✖ FAILED in 1260ms
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
To get additional information about test execution use `--debug` option.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
npx codeceptjs run --debug
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This will show execution steps
|
|
82
|
+
as well as notices from test runner. To get even more information with more technical details like error stack traces,
|
|
83
|
+
and global promises, or events use `--verbose` mode.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
npx codeceptjs run --verbose
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
GitHub --
|
|
91
|
+
register
|
|
92
|
+
[1] Starting recording promises
|
|
93
|
+
Emitted | test.before
|
|
94
|
+
> WebDriver._before
|
|
95
|
+
[1] Queued | hook WebDriver._before()
|
|
96
|
+
[1] Queued | amOnPage: https://github.com
|
|
97
|
+
Emitted | step.before (I am on page "https://github.com")
|
|
98
|
+
• I am on page "https://github.com"
|
|
99
|
+
Emitted | step.after (I am on page "https://github.com")
|
|
100
|
+
Emitted | test.start ([object Object])
|
|
101
|
+
...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Please use verbose output when reporting issues to GitHub.
|
|
105
|
+
|
|
106
|
+
### Dry Run
|
|
107
|
+
|
|
108
|
+
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:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
npx codeceptjs dry-run
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Output:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Tests from /home/davert/projects/codeceptjs/examples:
|
|
118
|
+
|
|
119
|
+
Business rules --
|
|
120
|
+
☐ do something
|
|
121
|
+
Google --
|
|
122
|
+
☐ test @123
|
|
123
|
+
GitHub -- /home/davert/projects/codeceptjs/examples/github_test.js
|
|
124
|
+
☐ Visit Home Page @retry
|
|
125
|
+
☐ search @grop
|
|
126
|
+
☐ signin @normal @important @slow
|
|
127
|
+
☐ signin2
|
|
128
|
+
☐ register
|
|
129
|
+
|
|
130
|
+
Total: 3 suites | 7 tests
|
|
131
|
+
|
|
132
|
+
--- DRY MODE: No tests were executed ---
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
npx codecepjs dry-run --debug
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
> ℹ If you use custom JavaScript code inside tests, or rely on values from `grab*` commands, dry-run may produce error output.
|
|
142
|
+
|
|
143
|
+
## Testomat.io
|
|
144
|
+
|
|
145
|
+
[Testomat.io](https://testomat.io) is a modern test management tool focused on CodeceptJS and **created by CodeceptJS team**.
|
|
146
|
+
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.
|
|
147
|
+
|
|
148
|
+

|
|
149
|
+
|
|
150
|
+
> 😻 **Testomat.io is free** for small teams, so you can use its reporting features with CodeceptJS.
|
|
151
|
+
|
|
152
|
+
To receive run reports you should:
|
|
153
|
+
|
|
154
|
+
- [Sign up](https://app.testomat.io/users/sign_up) at Testomat.io
|
|
155
|
+
- Create a new "Classical" project (select "BDD" project if you use CodeceptJS in BDD mode)
|
|
156
|
+
- Select "Import from Source Code"
|
|
157
|
+
- Select "CodeceptJS" as testing framework and JavaScript or TypeScript as a language. If you use BDD select "Gherkin" as language.
|
|
158
|
+
- 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.
|
|
159
|
+
- After tests are imported, go to Runs tab and select "Setup automated tests".
|
|
160
|
+
- Follow the instructions:
|
|
161
|
+
|
|
162
|
+

|
|
163
|
+
|
|
164
|
+
- You will need to install `@testomatio/reporter` package and enable it as a plugin in codeceptjs config:
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
plugins: {
|
|
168
|
+
testomatio: {
|
|
169
|
+
enabled: true,
|
|
170
|
+
require: '@testomatio/reporter/lib/adapter/codecept',
|
|
171
|
+
apiKey: process.env.TESTOMATIO,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- Run tests with `TESTOMATIO=` env variable and API key provided by Testomat.io
|
|
177
|
+
- See the run report is created and updated in realtime.
|
|
178
|
+
|
|
179
|
+
[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.
|
|
180
|
+
|
|
181
|
+
## ReportPortal
|
|
182
|
+
|
|
183
|
+
For enterprise grade we reporting we recommend using [ReportPortal](https://reportportal.io).
|
|
184
|
+
|
|
185
|
+

|
|
186
|
+
|
|
187
|
+
[ReportPortal](https://reportportal.io) is open-source self-hosted service for aggregating test execution reports.
|
|
188
|
+
Think of it as Kibana but for test reports.
|
|
189
|
+
|
|
190
|
+
Use official [CodeceptJS Agent for ReportPortal](https://github.com/reportportal/agent-js-codecept/) to start publishing your test results.
|
|
191
|
+
|
|
192
|
+
## XML
|
|
193
|
+
|
|
194
|
+
Use default xunit reporter of Mocha to print xml reports. Provide `--reporter xunit` to get the report to screen.
|
|
195
|
+
It is recommended to use more powerful [`mocha-junit-reporter`](https://www.npmjs.com/package/mocha-junit-reporter) package
|
|
196
|
+
to get better support for Jenkins CI.
|
|
197
|
+
|
|
198
|
+
Install it via NPM (locally or globally, depending on CodeceptJS installation type):
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
npm i mocha-junit-reporter
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Additional configuration should be added to `codecept.conf.js` to print xml report to `output` directory:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
"mocha": {
|
|
208
|
+
"reporterOptions": {
|
|
209
|
+
"mochaFile": "output/result.xml"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Execute CodeceptJS with JUnit reporter:
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
codeceptjs run --reporter mocha-junit-reporter
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Result will be located at `output/result.xml` file.
|
|
221
|
+
|
|
222
|
+
Alternatively, the reporter name can be added to the configuration file as well. In this case, CodeceptJS can be executed without additional CLI options.
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
"mocha": {
|
|
226
|
+
"reporter": "mocha-junit-reporter",
|
|
227
|
+
"reporterOptions": {
|
|
228
|
+
"mochaFile": "output/result.xml"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
codeceptjs run
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Html
|
|
238
|
+
|
|
239
|
+
### Testomat.io HTML Reporter
|
|
240
|
+
|
|
241
|
+
For modern HTML reports, use **[@testomatio/reporter](https://github.com/testomatio/reporter)** package.
|
|
242
|
+
|
|
243
|
+
#### Installation
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
npm install @testomatio/reporter --save-dev
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Configuration
|
|
250
|
+
|
|
251
|
+
Add the `testomatio` plugin to your `codecept.conf.js`:
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
export const config = {
|
|
255
|
+
plugins: {
|
|
256
|
+
testomatio: {
|
|
257
|
+
enabled: true,
|
|
258
|
+
require: '@testomatio/reporter/lib/adapter/codecept',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Usage
|
|
265
|
+
|
|
266
|
+
Generate HTML reports with environment variable:
|
|
267
|
+
|
|
268
|
+
```sh
|
|
269
|
+
TESTOMATIO_HTML_REPORT_SAVE=1 npx codeceptjs run
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Report is saved to `html-report/testomatio-report.html`.
|
|
273
|
+
|
|
274
|
+
#### Configuration Options
|
|
275
|
+
|
|
276
|
+
Customize report location:
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
# Custom folder
|
|
280
|
+
TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO_HTML_REPORT_FOLDER=./reports npx codeceptjs run
|
|
281
|
+
|
|
282
|
+
# Custom filename
|
|
283
|
+
TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO_HTML_FILENAME=my-report.html npx codeceptjs run
|
|
284
|
+
|
|
285
|
+
# With Testomat.io cloud
|
|
286
|
+
TESTOMATIO_HTML_REPORT_SAVE=1 TESTOMATIO=your_api_key npx codeceptjs run
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
For more details, see [documentation](https://docs.testomat.io/test-reporting/pipes/html/).
|
|
290
|
+
### Mochawesome
|
|
291
|
+
|
|
292
|
+
Best HTML reports could be produced with [mochawesome](https://www.npmjs.com/package/mochawesome) reporter.
|
|
293
|
+
|
|
294
|
+

|
|
295
|
+
|
|
296
|
+
Install it via NPM:
|
|
297
|
+
|
|
298
|
+
```sh
|
|
299
|
+
npm i mochawesome
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
If you get an error like this
|
|
303
|
+
|
|
304
|
+
```sh
|
|
305
|
+
"mochawesome" reporter not found
|
|
306
|
+
|
|
307
|
+
invalid reporter "mochawesome"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Make sure to have mocha installed or install it:
|
|
311
|
+
|
|
312
|
+
```sh
|
|
313
|
+
npm i mocha -D
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Configure it to use `output` directory to print HTML reports:
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
"mocha": {
|
|
320
|
+
"reporterOptions": {
|
|
321
|
+
"reportDir": "output"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Execute CodeceptJS with mochawesome reporter:
|
|
327
|
+
|
|
328
|
+
```sh
|
|
329
|
+
codeceptjs run --reporter mochawesome
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Result will be located at `output/index.html` file.
|
|
333
|
+
|
|
334
|
+
Alternatively, the reporter name can be added to the configuration file as well. In this case, CodeceptJS can be executed without additional CLI options.
|
|
335
|
+
|
|
336
|
+
```json
|
|
337
|
+
"mocha": {
|
|
338
|
+
"reporter": "mochawesome",
|
|
339
|
+
"reporterOptions": {
|
|
340
|
+
"reportDir": "output"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
codeceptjs run
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Advanced usage
|
|
350
|
+
|
|
351
|
+
Want to have screenshots for failed tests?
|
|
352
|
+
Then add Mochawesome helper to your config:
|
|
353
|
+
|
|
354
|
+
```json
|
|
355
|
+
"helpers": {
|
|
356
|
+
"Mochawesome": {
|
|
357
|
+
"uniqueScreenshotNames": "true"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Then tests with failure will have screenshots.
|
|
363
|
+
|
|
364
|
+
### Configuration
|
|
365
|
+
|
|
366
|
+
This helper should be configured in codecept.conf.ts
|
|
367
|
+
|
|
368
|
+
- `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.
|
|
369
|
+
- `disableScreenshots` (optional, default: false) - don't save screenshot on failure. This option should be the same as in common helper.
|
|
370
|
+
|
|
371
|
+
Also if you will add Mochawesome helper, then you will able to add custom context in report:
|
|
372
|
+
|
|
373
|
+
#### addMochawesomeContext
|
|
374
|
+
|
|
375
|
+
Adds context to executed test in HTML report:
|
|
376
|
+
|
|
377
|
+
```js
|
|
378
|
+
I.addMochawesomeContext('simple string')
|
|
379
|
+
I.addMochawesomeContext('http://www.url.com/pathname')
|
|
380
|
+
I.addMochawesomeContext('http://www.url.com/screenshot-maybe.jpg')
|
|
381
|
+
I.addMochawesomeContext({
|
|
382
|
+
title: 'expected output',
|
|
383
|
+
value: {
|
|
384
|
+
a: 1,
|
|
385
|
+
b: '2',
|
|
386
|
+
c: 'd',
|
|
387
|
+
},
|
|
388
|
+
})
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
##### Parameters
|
|
392
|
+
|
|
393
|
+
- `context` string, url, path to screenshot, object. See [this](https://www.npmjs.com/package/mochawesome#adding-test-context)
|
|
394
|
+
|
|
395
|
+
## Multi Reports
|
|
396
|
+
|
|
397
|
+
Want to use several reporters in the same time? Try to use [mocha-multi](https://www.npmjs.com/package/mocha-multi) reporter
|
|
398
|
+
|
|
399
|
+
Install it via NPM:
|
|
400
|
+
|
|
401
|
+
```sh
|
|
402
|
+
npm i mocha-multi
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Configure mocha-multi with reports that you want:
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
"mocha": {
|
|
409
|
+
"reporterOptions": {
|
|
410
|
+
"codeceptjs-cli-reporter": {
|
|
411
|
+
"stdout": "-",
|
|
412
|
+
"options": {
|
|
413
|
+
"verbose": true,
|
|
414
|
+
"steps": true,
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
"mochawesome": {
|
|
418
|
+
"stdout": "./output/console.log",
|
|
419
|
+
"options": {
|
|
420
|
+
"reportDir": "./output",
|
|
421
|
+
"reportFilename": "report"
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"mocha-junit-reporter": {
|
|
425
|
+
"stdout": "./output/console.log",
|
|
426
|
+
"options": {
|
|
427
|
+
"mochaFile": "./output/result.xml",
|
|
428
|
+
"attachments": true //add screenshot for a failed test
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Execute CodeceptJS with mocha-multi reporter:
|
|
436
|
+
|
|
437
|
+
```sh
|
|
438
|
+
npx codeceptjs run --reporter mocha-multi
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This will give you cli with steps in console and HTML report in `output` directory.
|
|
442
|
+
|
|
443
|
+
Alternatively, the reporter name can be added to the configuration file as well. In this case, CodeceptJS can be executed without additional CLI options.
|
|
444
|
+
|
|
445
|
+
```json
|
|
446
|
+
"mocha": {
|
|
447
|
+
"reporter": "mocha-multi",
|
|
448
|
+
"reporterOptions": {
|
|
449
|
+
...
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
```sh
|
|
455
|
+
codeceptjs run
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Testrail
|
|
459
|
+
|
|
460
|
+
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.
|
|
461
|
+
|
|
462
|
+
Try to use [codeceptjs-testrail](https://www.npmjs.com/package/codeceptjs-testrail) plugin
|
|
463
|
+
|
|
464
|
+
Install it via NPM:
|
|
465
|
+
|
|
466
|
+
```sh
|
|
467
|
+
npm i codeceptjs-testrail --save
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+

|
|
471
|
+
|
|
472
|
+
Now there is new feature, add the configuration to test run of test plan
|
|
473
|
+

|
|
474
|
+
|
|
475
|
+
## Tesults
|
|
476
|
+
|
|
477
|
+
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.
|
|
478
|
+
|
|
479
|
+
```sh
|
|
480
|
+
npm i codeceptjs-tesults --save
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Once installed, follow the [quick and easy integration instructions](https://www.tesults.com/docs/codeceptjs) to get setup in no time.
|