codeceptjs 2.3.4 → 2.4.1
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/CHANGELOG.md +52 -0
- package/README.md +28 -6
- package/bin/codecept.js +42 -0
- package/docs/advanced.md +45 -1
- package/docs/angular.md +3 -3
- package/docs/basics.md +162 -118
- package/docs/bdd.md +30 -5
- package/docs/best.md +8 -6
- package/docs/books.md +6 -1
- package/docs/build/Appium.js +95 -85
- package/docs/build/FileSystem.js +48 -3
- package/docs/build/GraphQL.js +3 -2
- package/docs/build/GraphQLDataFactory.js +1 -0
- package/docs/build/Mochawesome.js +3 -2
- package/docs/build/MockRequest.js +23 -5
- package/docs/build/Nightmare.js +87 -128
- package/docs/build/Protractor.js +107 -155
- package/docs/build/Puppeteer.js +190 -174
- package/docs/build/REST.js +13 -9
- package/docs/build/SeleniumWebdriver.js +0 -17
- package/docs/build/TestCafe.js +164 -158
- package/docs/build/WebDriver.js +236 -211
- package/docs/build/WebDriverIO.js +218 -187
- package/docs/changelog.md +57 -1
- package/docs/commands.md +41 -2
- package/docs/community-helpers.md +12 -1
- package/docs/configuration.md +5 -2
- package/docs/continuous-integration.md +22 -0
- package/docs/{helpers.md → custom-helpers.md} +16 -10
- package/docs/data.md +7 -6
- package/docs/detox.md +6 -6
- package/docs/email.md +4 -2
- package/docs/examples.md +22 -3
- package/docs/helpers/ApiDataFactory.md +15 -13
- package/docs/helpers/Appium.md +1011 -468
- package/docs/helpers/Detox.md +33 -26
- package/docs/helpers/FileSystem.md +43 -13
- package/docs/helpers/GraphQL.md +17 -15
- package/docs/helpers/GraphQLDataFactory.md +15 -13
- package/docs/helpers/Mochawesome.md +3 -1
- package/docs/helpers/MockRequest.md +37 -19
- package/docs/helpers/Nightmare.md +129 -240
- package/docs/helpers/Polly.md +1 -1
- package/docs/helpers/Protractor.md +157 -298
- package/docs/helpers/Puppeteer.md +216 -335
- package/docs/helpers/REST.md +29 -24
- package/docs/helpers/TestCafe.md +137 -235
- package/docs/helpers/WebDriver.md +250 -347
- package/docs/hooks.md +14 -10
- package/docs/index.md +112 -0
- package/docs/installation.md +3 -1
- package/docs/locators.md +19 -8
- package/docs/mobile-react-native-locators.md +2 -2
- package/docs/mobile.md +5 -3
- package/docs/nightmare.md +2 -1
- package/docs/pageobjects.md +4 -2
- package/docs/parallel.md +4 -2
- package/docs/plugins.md +41 -15
- package/docs/puppeteer.md +8 -6
- package/docs/quickstart.md +130 -0
- package/docs/react.md +4 -2
- package/docs/reports.md +6 -4
- package/docs/testcafe.md +10 -8
- package/docs/translation.md +4 -2
- package/docs/ui.md +56 -0
- package/docs/videos.md +11 -2
- package/docs/visual.md +7 -5
- package/docs/vue.md +121 -0
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +2 -2
- package/docs/webapi/dontSee.mustache +1 -2
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -1
- package/docs/webapi/executeScript.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/grabAttributeFrom.mustache +1 -1
- package/docs/webapi/grabBrowserLogs.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +2 -2
- package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
- package/docs/webapi/grabHTMLFrom.mustache +1 -1
- package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/grabPageScrollPosition.mustache +1 -1
- package/docs/webapi/grabTextFrom.mustache +2 -2
- package/docs/webapi/grabValueFrom.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +10 -0
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +8 -0
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/waitForClickable.mustache +10 -0
- package/docs/webapi/waitForDetached.mustache +2 -2
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +2 -2
- package/docs/webapi/waitForFunction.mustache +2 -2
- package/docs/webapi/waitForInvisible.mustache +2 -2
- package/docs/webapi/waitForText.mustache +2 -2
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +2 -2
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/waitToHide.mustache +2 -2
- package/docs/webapi/waitUntil.mustache +3 -2
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/docs/webdriver.md +20 -18
- package/docs/wiki/.git/FETCH_HEAD +1 -0
- package/docs/wiki/.git/HEAD +1 -0
- package/docs/wiki/.git/ORIG_HEAD +1 -0
- package/docs/wiki/.git/config +11 -0
- package/docs/wiki/.git/description +1 -0
- package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
- package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
- package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
- package/docs/wiki/.git/hooks/post-update.sample +8 -0
- package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
- package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
- package/docs/wiki/.git/hooks/pre-push.sample +53 -0
- package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
- package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
- package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
- package/docs/wiki/.git/hooks/update.sample +128 -0
- package/docs/wiki/.git/index +0 -0
- package/docs/wiki/.git/info/exclude +6 -0
- package/docs/wiki/.git/logs/HEAD +4 -0
- package/docs/wiki/.git/logs/refs/heads/master +4 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
- package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
- package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
- package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
- package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
- package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
- package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
- package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
- package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
- package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
- package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
- package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
- package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
- package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
- package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
- package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
- package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
- package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
- package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
- package/docs/wiki/.git/packed-refs +2 -0
- package/docs/wiki/.git/refs/heads/master +1 -0
- package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/refs/remotes/origin/master +1 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers.md +41 -0
- package/docs/wiki/Examples.md +138 -0
- package/docs/wiki/Home.md +11 -0
- package/docs/wiki/Release-process.md +25 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/actor.js +18 -1
- package/lib/assert/error.js +3 -3
- package/lib/codecept.js +9 -6
- package/lib/command/configMigrate.js +7 -6
- package/lib/command/definitions.js +98 -350
- package/lib/command/generate.js +22 -17
- package/lib/command/gherkin/init.js +2 -1
- package/lib/command/gherkin/snippets.js +6 -6
- package/lib/command/gherkin/steps.js +0 -1
- package/lib/command/info.js +40 -0
- package/lib/command/init.js +54 -41
- package/lib/command/run-multiple.js +5 -4
- package/lib/command/run-rerun.js +39 -0
- package/lib/command/run-workers.js +4 -6
- package/lib/command/run.js +8 -18
- package/lib/command/utils.js +23 -2
- package/lib/command/workers/runTests.js +1 -2
- package/lib/config.js +10 -4
- package/lib/container.js +31 -6
- package/lib/data/dataTableArgument.js +31 -0
- package/lib/data/table.js +4 -0
- package/lib/event.js +65 -1
- package/lib/helper/Appium.js +52 -38
- package/lib/helper/FileSystem.js +48 -3
- package/lib/helper/GraphQL.js +3 -2
- package/lib/helper/GraphQLDataFactory.js +1 -0
- package/lib/helper/Mochawesome.js +3 -2
- package/lib/helper/MockRequest.js +23 -5
- package/lib/helper/Nightmare.js +5 -6
- package/lib/helper/Protractor.js +7 -8
- package/lib/helper/Puppeteer.js +76 -20
- package/lib/helper/REST.js +13 -9
- package/lib/helper/SeleniumWebdriver.js +0 -17
- package/lib/helper/TestCafe.js +84 -36
- package/lib/helper/WebDriver.js +113 -59
- package/lib/helper/WebDriverIO.js +43 -59
- package/lib/helper/clientscripts/nightmare.js +66 -4
- package/lib/helper/scripts/isElementClickable.js +24 -0
- package/lib/helper.js +34 -10
- package/lib/history.js +1 -1
- package/lib/hooks.js +2 -1
- package/lib/index.js +19 -0
- package/lib/interfaces/bdd.js +4 -0
- package/lib/interfaces/featureConfig.js +10 -3
- package/lib/interfaces/gherkin.js +6 -2
- package/lib/interfaces/scenarioConfig.js +17 -6
- package/lib/listener/config.js +1 -1
- package/lib/listener/exit.js +6 -0
- package/lib/listener/steps.js +0 -1
- package/lib/listener/trace.js +0 -1
- package/lib/locator.js +67 -2
- package/lib/output.js +53 -0
- package/lib/parser.js +2 -71
- package/lib/pause.js +3 -2
- package/lib/plugin/allure.js +41 -22
- package/lib/plugin/autoLogin.js +4 -1
- package/lib/plugin/pauseOnFail.js +38 -0
- package/lib/plugin/puppeteerCoverage.js +8 -7
- package/lib/plugin/screenshotOnFail.js +13 -8
- package/lib/plugin/stepByStepReport.js +7 -6
- package/lib/plugin/wdio.js +2 -1
- package/lib/recorder.js +85 -7
- package/lib/rerun.js +81 -0
- package/lib/secret.js +6 -0
- package/lib/session.js +9 -2
- package/lib/step.js +37 -2
- package/lib/store.js +5 -1
- package/lib/ui.js +34 -8
- package/lib/utils.js +6 -13
- package/lib/within.js +5 -0
- package/package.json +49 -29
- package/typings/Mocha.d.ts +21 -0
- package/typings/Protractor.d.ts +16 -0
- package/typings/index.d.ts +169 -0
- package/typings/jsdoc.conf.js +34 -0
- package/typings/jsdoc.namespace.js +29 -0
- package/typings/types.d.ts +9827 -0
- package/typings/utils.d.ts +7 -0
- package/docs/acceptance.md +0 -409
- package/docs/api/codecept.md +0 -75
- package/docs/api/config.md +0 -49
- package/docs/api/container.md +0 -66
- package/docs/api/helper.md +0 -116
- package/docs/api/output.md +0 -67
- package/docs/api/recorder.md +0 -63
- package/docs/helpers/SeleniumWebdriver.md +0 -92
- package/docs/helpers/WebDriverIO.md +0 -1671
package/docs/react.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /react
|
|
3
3
|
title: Testing React Applications
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
# Testing React Applications
|
|
7
|
+
|
|
6
8
|
React applications require some additional love for end to end testing.
|
|
7
9
|
At first, it is very hard to test an application which was never designed to be tested!
|
|
8
10
|
This happens to many React application. While building components developers often forget to keep the element's semantic.
|
|
@@ -34,7 +36,7 @@ However, if you can't update the code you can go to the second option. In this c
|
|
|
34
36
|
//*[@id="document"]/div[2]/div/div[2]/div
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
use [Locator Builder](
|
|
39
|
+
use [Locator Builder](/locators#locator-builder) to make clean semantic locator:
|
|
38
40
|
|
|
39
41
|
```js
|
|
40
42
|
locate('[role=tab]').withText('Click Me!');
|
package/docs/reports.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /reports
|
|
3
3
|
title: Reporters
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
# Reporters
|
|
7
|
+
|
|
6
8
|
## Cli
|
|
7
9
|
|
|
8
10
|
By default CodeceptJS provides cli reporter with console output.
|
|
@@ -157,7 +159,7 @@ Allure requires **Java 8** to work. Then Allure can be installed via NPM:
|
|
|
157
159
|
npm install -g allure-commandline --save-dev
|
|
158
160
|
```
|
|
159
161
|
|
|
160
|
-
Add [Allure plugin](
|
|
162
|
+
Add [Allure plugin](/plugins/#allure) in config under `plugins` section.
|
|
161
163
|
|
|
162
164
|
```js
|
|
163
165
|
plugins: {
|
|
@@ -189,7 +191,7 @@ Launch Allure server and see the report like on a screenshot above:
|
|
|
189
191
|
allure serve output
|
|
190
192
|
```
|
|
191
193
|
|
|
192
|
-
Allure reporter aggregates data from other plugins like [*stepByStepReport*](
|
|
194
|
+
Allure reporter aggregates data from other plugins like [*stepByStepReport*](/plugins/#stepByStepReport) and [*screenshotOnFail*](/plugins/#screenshotOnFail)
|
|
193
195
|
|
|
194
196
|
Allure reports can also be generated for `dry-run` command. So you can get the first report with no tests actually being executed. Enable allure plugin in dry-run options, and pass `--debug` option to print all tests on screen.
|
|
195
197
|
|
|
@@ -231,7 +233,7 @@ Result will be located at `output/result.xml` file.
|
|
|
231
233
|
|
|
232
234
|
Best HTML reports could be produced with [mochawesome](https://www.npmjs.com/package/mochawesome) reporter.
|
|
233
235
|
|
|
234
|
-

|
|
235
237
|
|
|
236
238
|
Install it via NPM:
|
|
237
239
|
|
package/docs/testcafe.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /testcafe
|
|
3
3
|
title: Testing with TestCafe
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Testing with TestCafe
|
|
7
|
+
|
|
8
|
+
[TestCafe](https://devexpress.github.io/testcafe/) is another alternative engine for driving browsers. It is driven by unique technology which provides fast and simple cross browser testing for desktop and mobile browsers. Unlike WebDriver or Puppeteer, TestCafe doesn't control a browser at all. It is not a browser itself, like [Nightmare](/nightmare) or Cypress. **TestCafe core is a proxy server** that runs behind the scene, and transforms all HTML and JS to include code that is needed for test automation.
|
|
7
9
|
|
|
8
10
|

|
|
9
11
|
|
|
@@ -25,9 +27,9 @@ Anyway, TestCafe is a good option to start if you need cross browser testing. An
|
|
|
25
27
|
|
|
26
28
|
CodeceptJS is a rich testing frameworks which also provides features missing in original TestCafe:
|
|
27
29
|
|
|
28
|
-
* [Cucumber integration](
|
|
29
|
-
* [Real Page Objects](
|
|
30
|
-
* [Data Management via API](
|
|
30
|
+
* [Cucumber integration](/bdd)
|
|
31
|
+
* [Real Page Objects](/pageobjects)
|
|
32
|
+
* [Data Management via API](/data)
|
|
31
33
|
* and others
|
|
32
34
|
|
|
33
35
|
## Writing Tests
|
|
@@ -66,9 +68,9 @@ Scenario('create todo item', (I) => {
|
|
|
66
68
|
});
|
|
67
69
|
```
|
|
68
70
|
|
|
69
|
-
Same syntax is the same for all helpers in CodeceptJS so to learn more about available commands learn [CodeceptJS Basics](
|
|
71
|
+
Same syntax is the same for all helpers in CodeceptJS so to learn more about available commands learn [CodeceptJS Basics](/basics).
|
|
70
72
|
|
|
71
|
-
> [▶ Complete list of TestCafe actions](
|
|
73
|
+
> [▶ Complete list of TestCafe actions](/helpers/TestCafe)
|
|
72
74
|
|
|
73
75
|
## Page Objects
|
|
74
76
|
|
|
@@ -126,7 +128,7 @@ module.exports = {
|
|
|
126
128
|
}
|
|
127
129
|
```
|
|
128
130
|
|
|
129
|
-
> [▶ Read more about PageObjects in CodeceptJS](
|
|
131
|
+
> [▶ Read more about PageObjects in CodeceptJS](/pageobjects)
|
|
130
132
|
|
|
131
133
|
## Extending
|
|
132
134
|
|
package/docs/translation.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /translation
|
|
3
3
|
title: Translation
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
# Translation
|
|
7
|
+
|
|
6
8
|
Test output and the way tests are written can be localized.
|
|
7
9
|
This way scenarios can be written in almost native language using UTF support of JavaScript.
|
|
8
10
|
If you have non-English team and you work on non-English project consider enabling translation
|
|
@@ -26,7 +28,7 @@ Add to config:
|
|
|
26
28
|
|
|
27
29
|
when running with `--steps` option steps output will be translated:
|
|
28
30
|
|
|
29
|
-

|
|
30
32
|
|
|
31
33
|
This also enables localized method names for actor object.
|
|
32
34
|
|
package/docs/ui.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CodeceptUI
|
|
3
|
+
layout: Section
|
|
4
|
+
permalink: /ui
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<img src="/img/codeceptui.png" style="width: 100%; border-radius: 5px; box-shadow: 0px 5px 10px rgba(0,0,0,0.1)" />
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## CodeceptUI <Badge text="beta" type="warn"/>
|
|
12
|
+
|
|
13
|
+
CodeceptJS has an interactive, graphical test runner. We call it CodeceptUI. It works in your browser and helps you to manage your tests.
|
|
14
|
+
|
|
15
|
+
CodeceptUI can be used for
|
|
16
|
+
|
|
17
|
+
* running tests by groups or single
|
|
18
|
+
* get test reports
|
|
19
|
+
* review tests
|
|
20
|
+
* edit tests and page objects
|
|
21
|
+
* write new tests
|
|
22
|
+
* easily switch to headless/headful mode
|
|
23
|
+
|
|
24
|
+
CodeceptUI is a useful addon to CodeceptJS, we recommend to try.
|
|
25
|
+
It is an [open-source Vue-based application](https://github.com/codecept-js/ui) which runs in your browser.
|
|
26
|
+
|
|
27
|
+
> 📺 [Watch CodeceptUI in Action](https://www.youtube.com/watch?v=7pKNVjAckPA)
|
|
28
|
+
|
|
29
|
+
> 📺 [Watch how to write a new test in CodeceptUI](https://www.youtube.com/watch?v=7P99P5aNnz8)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Using CodeceptUI
|
|
33
|
+
|
|
34
|
+
To start using CodeceptUI you need to have CodeceptJS project already created with a few tests already written.
|
|
35
|
+
|
|
36
|
+
Install CodeceptUI via npm
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
npm i @codeceptjs/ui --save
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Execute it:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npx codecept-ui
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Notice
|
|
49
|
+
|
|
50
|
+
CodeceptUI is in beta. It means that we didn't have a chance to test it for all possible setups.
|
|
51
|
+
You are highly welcome to try it, test it, send issues and **pull requests**.
|
|
52
|
+
|
|
53
|
+
[Join development team on GitHub!](https://github.com/codecept-js/ui)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
package/docs/videos.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /videos
|
|
3
|
+
layout: Section
|
|
4
|
+
sidebar: false
|
|
3
5
|
title: Videos
|
|
6
|
+
editLink: false
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
> Add your own videos to our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Videos)
|
|
7
|
-
|
|
10
|
+
[](https://www.youtube.com/watch?v=BRMWstiOTks)
|
|
11
|
+
|
|
12
|
+
* ## [An Introduction, Getting started and working with CodeceptJS & Puppeteer (EAWeekend)](https://www.youtube.com/watch?v=BRMWstiOTks)
|
|
13
|
+
|
|
14
|
+
* ## [CodeceptJS Official YouTube Channel](https://www.youtube.com/channel/UCEs4030bmtonyDhTHEXa_2g)
|
|
15
|
+
|
|
16
|
+
* ## [Introductory Videos](https://www.youtube.com/watch?v=FPFG1rBNJ64&list=PLcFXthgti9Lt4SjSvL1ALDg6dOeTC0TvT)
|
|
8
17
|
|
|
9
18
|
Free educational videos provided by our community member **[@ontytoom](http://github.com/ontytoom)**.
|
|
10
19
|
|
package/docs/visual.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /visual
|
|
3
3
|
title: Visual Testing
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
# Visual Testing
|
|
7
|
+
|
|
6
8
|
How does one test if the UI being rendered appears correctly to the users or how to test if each UI element appears in the right position and size? The traditional way to test the UI of the application has always been manually, which is time consuming.
|
|
7
9
|
|
|
8
10
|
Visual testing with help of CodeceptJS will help in improving such use cases for the QA folks.
|
|
@@ -71,18 +73,18 @@ Scenario('Compare CodeceptIO Home Page @visual-test', async (I) => {
|
|
|
71
73
|
In this example, we are setting the expected mismatch tolerance level as `2`
|
|
72
74
|
|
|
73
75
|
`Base Image` (Generated by User)
|
|
74
|
-

|
|
75
77
|
|
|
76
78
|
`Screenshot Image` (Generated by Test)
|
|
77
|
-

|
|
78
80
|
|
|
79
81
|
Clearly the difference in both the images visible to human eye is the section about `Scenario Driven`
|
|
80
82
|
|
|
81
|
-

|
|
82
84
|
|
|
83
85
|
`Diff Image` generated by the helper clearly highlights the section which don't match
|
|
84
86
|
|
|
85
|
-

|
|
86
88
|
|
|
87
89
|
`Failed Test output`
|
|
88
90
|
```
|
package/docs/vue.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /vue
|
|
3
|
+
layout: Section
|
|
4
|
+
sidebar: false
|
|
5
|
+
title: Testing Vue Apps
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# vue-cli-plugin-e2e-codeceptjs
|
|
10
|
+
|
|
11
|
+
*Hey, how about some end 2 end testing for your Vue apps?* 🤔
|
|
12
|
+
|
|
13
|
+
*Let's do it together! Vue, me, [CodeceptJS](https://codecept.io) & [Puppeteer](https://pptr.dev).* 🤗
|
|
14
|
+
|
|
15
|
+
*Browser testing was never that simple. Just see it!* 😍
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
I.amOnPage('/');
|
|
19
|
+
I.click('My Component Button');
|
|
20
|
+
I.see('My Component');
|
|
21
|
+
I.say('I am happy!');
|
|
22
|
+
// that's right, this is a valid test!
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## How to try it?
|
|
26
|
+
|
|
27
|
+
**Requirements:**
|
|
28
|
+
|
|
29
|
+
* NodeJS >= 8.9
|
|
30
|
+
* NPM / Yarn
|
|
31
|
+
* Vue CLI installed globally
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
npm i vue-cli-plugin-codeceptjs-puppeteer --save-dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This will install CodeceptJS, CodeceptUI & Puppeteer with Chrome browser.
|
|
38
|
+
|
|
39
|
+
To add CodeceptJS to your project invoke installer:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
vue invoke vue-cli-plugin-codeceptjs-puppeteer
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> You will be asked about installing a demo component. If you start a fresh project **it is recommended to agree and install a demo component**, so you could see tests passing.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Running Tests
|
|
49
|
+
|
|
50
|
+
We added npm scripts:
|
|
51
|
+
|
|
52
|
+
* `test:e2e` - will execute tests with browser opened. If you installed test component, and started a test server, running this command will show you a brower window passed test.
|
|
53
|
+
* Use `--headless` option to run browser headlessly
|
|
54
|
+
* Use `--serve` option to start a dev server before tests
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
npm run test:e2e
|
|
61
|
+
npm run test:e2e -- --headless
|
|
62
|
+
npm run test:e2e -- --serve
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> This command is a wrapper for `codecept run --steps`. You can use the [Run arguments and options](/commands#run) here.
|
|
66
|
+
|
|
67
|
+
* `test:e2e:parallel` - will execute tests headlessly in parallel processes (workers). By default runs tests in 2 workers.
|
|
68
|
+
* Use an argument to set number of workers
|
|
69
|
+
* Use `--serve` option to start dev server before running
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
npm run test:e2e:parallel
|
|
75
|
+
npm run test:e2e:parallel -- 3
|
|
76
|
+
npm run test:e2e:parallel -- 3 --serve
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> This command is a wrapper for `codecept run-workers 2`. You can use the [Run arguments and options](/commands#run-workers) here.
|
|
80
|
+
|
|
81
|
+
* `test:e2e:open` - this opens interactive web test runner. So you could see, review & run your tests from a browser.
|
|
82
|
+
|
|
83
|
+

|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
npm run test:e2e:open
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Directory Structure
|
|
90
|
+
|
|
91
|
+
Generator has created these files:
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
codecept.conf.js 👈 codeceptjs config
|
|
95
|
+
jsconfig.json 👈 enabling type definitons
|
|
96
|
+
tests
|
|
97
|
+
├── e2e
|
|
98
|
+
│ ├── app_test.js 👈 demo test, edit it!
|
|
99
|
+
│ ├── output 👈 temp directory for screenshots, reports, etc
|
|
100
|
+
│ └── support
|
|
101
|
+
│ └── steps_file.js 👈 common steps
|
|
102
|
+
└── steps.d.ts 👈 type definitions
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If you agreed to create a demo component, you will also see `TestMe` component in `src/components` folder.
|
|
106
|
+
|
|
107
|
+
## How to write tests?
|
|
108
|
+
|
|
109
|
+
* Open `tests/e2e/app_js` and see the demo test
|
|
110
|
+
* Execute a test & use interactive pause to see how CodeceptJS works
|
|
111
|
+
* [Learn CodeceptJS basics](/basics)
|
|
112
|
+
* [Learn how to write CodeceptJS tests with Puppeteer](/puppeteer)
|
|
113
|
+
* [See full reference for CodeceptJS Puppeteer Helper](/helpers/Puppeteer)
|
|
114
|
+
* Ask your questions in [Slack](http://bit.ly/chat-codeceptjs) & [Forum](https://codecept.discourse.group/)
|
|
115
|
+
|
|
116
|
+
## Enjoy testing!
|
|
117
|
+
|
|
118
|
+
Testing is simple & fun, enjoy it!
|
|
119
|
+
|
|
120
|
+
With ❤ [CodeceptJS Team](https://codecept.io)
|
|
121
|
+
|
|
@@ -4,5 +4,5 @@ Field is located by name, label, CSS or XPath
|
|
|
4
4
|
```js
|
|
5
5
|
I.appendField('#myTextField', 'appended');
|
|
6
6
|
```
|
|
7
|
-
@param {
|
|
7
|
+
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
8
8
|
@param {string} value text value to append.
|
|
@@ -7,5 +7,5 @@ I.attachFile('Avatar', 'data/avatar.jpg');
|
|
|
7
7
|
I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param {
|
|
10
|
+
@param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
11
11
|
@param {string} pathToFile local file path relative to codecept.json config file.
|
|
@@ -8,5 +8,5 @@ I.checkOption('#agree');
|
|
|
8
8
|
I.checkOption('I Agree to Terms and Conditions');
|
|
9
9
|
I.checkOption('agree', '//form');
|
|
10
10
|
```
|
|
11
|
-
@param {
|
|
12
|
-
@param {
|
|
11
|
+
@param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
12
|
+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
@@ -20,5 +20,5 @@ I.click('Logout', '#nav');
|
|
|
20
20
|
I.click({css: 'nav a.login'});
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
@param {
|
|
24
|
-
@param {
|
|
23
|
+
@param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
24
|
+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
@@ -3,5 +3,5 @@ Performs a click on a link and waits for navigation before moving on.
|
|
|
3
3
|
```js
|
|
4
4
|
I.clickLink('Logout', '#nav');
|
|
5
5
|
```
|
|
6
|
-
@param {
|
|
7
|
-
@param {
|
|
6
|
+
@param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
7
|
+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
@@ -7,5 +7,4 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
@param {string} text which is not present.
|
|
10
|
-
@param {
|
|
11
|
-
|
|
10
|
+
@param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
@@ -6,4 +6,4 @@ I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
|
|
|
6
6
|
I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param {
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
@@ -4,4 +4,4 @@ Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
|
4
4
|
I.dontSeeElement('.modal'); // modal is not shown
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
@param {
|
|
7
|
+
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
@@ -4,4 +4,4 @@ Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
|
4
4
|
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
@param {
|
|
7
|
+
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
@@ -6,5 +6,5 @@ I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
|
6
6
|
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param {
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
10
10
|
@param {string} value value to check.
|
|
@@ -8,5 +8,5 @@ I.doubleClick({css: 'button.accept'});
|
|
|
8
8
|
I.doubleClick('.btn.edit');
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
@param {
|
|
12
|
-
@param {
|
|
11
|
+
@param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
12
|
+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
@@ -7,5 +7,5 @@ If no custom file name is provided, the default name will be used
|
|
|
7
7
|
I.downloadFile('td[class="text-right file-link"] a', 'thisIsCustomName');
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param {
|
|
10
|
+
@param {CodeceptJS.LocatorOrString} locator clickable link or button located by CSS|XPath locator.
|
|
11
11
|
@param {string} file custom file name.
|
|
@@ -6,5 +6,5 @@ I.dragSlider('#slider', 30);
|
|
|
6
6
|
I.dragSlider('#slider', -70);
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param {
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
|
|
10
10
|
@param {number} offsetX position to drag.
|
|
@@ -20,4 +20,5 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
@param {string|function} fn function to be executed in browser context.
|
|
23
|
-
@param ...
|
|
23
|
+
@param {...any} args to be passed to function.
|
|
24
|
+
@return {Promise<any>}
|
|
@@ -11,5 +11,5 @@ I.fillField('form#login input[name=username]', 'John');
|
|
|
11
11
|
// or by strict locator
|
|
12
12
|
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
13
13
|
```
|
|
14
|
-
@param {
|
|
14
|
+
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
15
15
|
@param {string} value text value to fill.
|
|
@@ -5,6 +5,6 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
5
5
|
```js
|
|
6
6
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
7
7
|
```
|
|
8
|
-
@param {
|
|
8
|
+
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {string} attr attribute name.
|
|
10
10
|
@returns {Promise<string>} attribute value
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Gets a cookie object by name.
|
|
2
2
|
If none provided gets all cookies.
|
|
3
|
-
|
|
3
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
6
|
let cookie = await I.grabCookie('auth');
|
|
7
7
|
assert(cookie.value, '123456');
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
@param [name=null] cookie name.
|
|
10
|
+
@param {?string} [name=null] cookie name.
|
|
11
11
|
@returns {Promise<string>} attribute value
|
|
@@ -5,6 +5,6 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
5
5
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
6
6
|
```
|
|
7
7
|
|
|
8
|
-
@param {
|
|
8
|
+
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {string} cssProperty CSS property name.
|
|
10
10
|
@returns {Promise<string>} CSS value
|
|
@@ -6,5 +6,5 @@ If more than one element is found - an array of HTMLs returned.
|
|
|
6
6
|
let postHTML = await I.grabHTMLFrom('#post');
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
10
10
|
@returns {Promise<string>} HTML code for an element
|
|
@@ -4,5 +4,5 @@ Grab number of visible elements by locator.
|
|
|
4
4
|
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
@param {
|
|
7
|
+
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
8
8
|
@returns {Promise<number>} number of visible elements
|
|
@@ -6,5 +6,5 @@ let pin = await I.grabTextFrom('#pin');
|
|
|
6
6
|
```
|
|
7
7
|
If multiple elements found returns an array of texts.
|
|
8
8
|
|
|
9
|
-
@param locator element located by CSS|XPath|strict locator.
|
|
10
|
-
@returns {Promise<string>} attribute value
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
10
|
+
@returns {Promise<string|string[]>} attribute value
|
|
@@ -4,5 +4,5 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
4
4
|
```js
|
|
5
5
|
let email = await I.grabValueFrom('input[name=email]');
|
|
6
6
|
```
|
|
7
|
-
@param {
|
|
7
|
+
@param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
8
8
|
@returns {Promise<string>} attribute value
|
|
@@ -6,6 +6,6 @@ I.moveCursorTo('.tooltip');
|
|
|
6
6
|
I.moveCursorTo('#submit', 5,5);
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
@param {
|
|
10
|
-
@param {number} offsetX (optional, `0` by default) X-axis offset.
|
|
11
|
-
@param {number} offsetY (optional, `0` by default) Y-axis offset.
|
|
9
|
+
@param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
10
|
+
@param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
11
|
+
@param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
@@ -9,5 +9,5 @@ I.rightClick('Click me');
|
|
|
9
9
|
I.rightClick('Click me', '.context');
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
@param {
|
|
13
|
-
@param {
|
|
12
|
+
@param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
13
|
+
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
@@ -8,4 +8,4 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
@param {string} fileName file name to save.
|
|
11
|
-
@param {boolean} fullPage (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
11
|
+
@param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Scroll element into viewport.
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
I.scrollIntoView('#submit');
|
|
5
|
+
I.scrollIntoView('#submit', true);
|
|
6
|
+
I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
@param {string|object} locator located by CSS|XPath|strict locator.
|
|
10
|
+
@param {boolean|object} alignToTop (optional) or scrollIntoViewOptions (optional), see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
|