codeceptjs 3.3.2 β 3.3.5-beta.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 +44 -2
- package/docs/api.md +4 -0
- package/docs/basics.md +2 -0
- package/docs/bdd.md +12 -0
- package/docs/build/JSONResponse.js +44 -3
- package/docs/build/Playwright.js +63 -40
- package/docs/build/Puppeteer.js +54 -43
- package/docs/build/REST.js +23 -9
- package/docs/build/WebDriver.js +39 -30
- package/docs/changelog.md +6 -2
- package/docs/community-helpers.md +1 -0
- package/docs/configuration.md +21 -18
- package/docs/helpers/Appium.md +0 -723
- package/docs/helpers/JSONResponse.md +24 -0
- package/docs/helpers/Playwright.md +276 -264
- package/docs/helpers/Puppeteer.md +230 -222
- package/docs/helpers/REST.md +21 -6
- package/docs/helpers/WebDriver.md +265 -259
- package/docs/plugins.md +41 -1
- package/docs/reports.md +11 -0
- package/docs/secrets.md +30 -0
- 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 +173 -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-merge-commit.sample +13 -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/push-to-checkout.sample +78 -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 +1 -0
- package/docs/wiki/.git/logs/refs/heads/master +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/objects/pack/pack-5938044f9d30daf1c195fda4dec1d54850933935.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-5938044f9d30daf1c195fda4dec1d54850933935.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/Community-Helpers-&-Plugins.md +7 -3
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +29 -0
- package/docs/wiki/Examples.md +39 -48
- package/docs/wiki/Release-Process.md +8 -8
- package/docs/wiki/Tests.md +62 -60
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +2 -2
- package/lib/cli.js +1 -1
- package/lib/command/generate.js +3 -0
- package/lib/command/init.js +83 -24
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +1 -1
- package/lib/command/workers/runTests.js +15 -0
- package/lib/helper/JSONResponse.js +44 -3
- package/lib/helper/Playwright.js +63 -40
- package/lib/helper/Puppeteer.js +54 -43
- package/lib/helper/REST.js +23 -9
- package/lib/helper/WebDriver.js +39 -30
- package/lib/interfaces/gherkin.js +1 -1
- package/lib/output.js +4 -0
- package/lib/plugin/customLocator.js +50 -3
- package/lib/plugin/retryFailedStep.js +1 -1
- package/lib/plugin/retryTo.js +1 -8
- package/lib/secret.js +31 -1
- package/lib/step.js +22 -10
- package/lib/utils.js +1 -6
- package/package.json +4 -4
- package/typings/index.d.ts +158 -0
- package/typings/types.d.ts +367 -96
package/docs/build/WebDriver.js
CHANGED
|
@@ -32,37 +32,43 @@ const SHADOW = 'shadow';
|
|
|
32
32
|
const webRoot = 'body';
|
|
33
33
|
|
|
34
34
|
let version;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* ## Configuration
|
|
38
|
+
*
|
|
39
|
+
* This helper should be configured in codecept.conf.js
|
|
40
|
+
*
|
|
41
|
+
* @typedef WebDriverConfig
|
|
42
|
+
* @type {object}
|
|
43
|
+
* @prop {string} url - base url of website to be tested.
|
|
44
|
+
* @prop {string} browser browser in which to perform testing.
|
|
45
|
+
* @prop {string} [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
46
|
+
* @prop {string} [host=localhost] - WebDriver host to connect.
|
|
47
|
+
* @prop {string} [port=4444] - WebDriver port to connect.
|
|
48
|
+
* @prop {string} [protocol=http] - protocol for WebDriver server.
|
|
49
|
+
* @prop {string} [path=/wd/hub] - path to WebDriver server,
|
|
50
|
+
* @prop {boolean} [restart=true] - restart browser between tests.
|
|
51
|
+
* @prop {boolean} [smartWait=false] - **enables [SmartWait](http://codecept.io/acceptance/#smartwait)**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
52
|
+
* @prop {boolean} [disableScreenshots=false] - don't save screenshots on failure.
|
|
53
|
+
* @prop {boolean} [fullPageScreenshots=false] (optional - make full page screenshots on failure.
|
|
54
|
+
* @prop {boolean} [uniqueScreenshotNames=false] - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
55
|
+
* @prop {boolean} [keepBrowserState=false] - keep browser state between tests when `restart` is set to false.
|
|
56
|
+
* @prop {boolean} [keepCookies=false] - keep cookies between tests when `restart` set to false.
|
|
57
|
+
* @prop {string} [windowSize=window] default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
58
|
+
* @prop {number} [waitForTimeout=1000] sets default wait time in *ms* for all `wait*` functions.
|
|
59
|
+
* @prop {object} [desiredCapabilities] Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
|
|
60
|
+
* @prop {boolean} [manualStart=false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
61
|
+
* @prop {object} [timeouts] [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
62
|
+
*/
|
|
63
|
+
const config = {};
|
|
64
|
+
|
|
35
65
|
/**
|
|
36
66
|
* WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
|
|
37
67
|
* manipulate browser using Selenium WebDriver or PhantomJS.
|
|
38
68
|
*
|
|
39
69
|
* WebDriver requires Selenium Server and ChromeDriver/GeckoDriver to be installed. Those tools can be easily installed via NPM. Please check [Testing with WebDriver](https://codecept.io/webdriver/#testing-with-webdriver) for more details.
|
|
40
70
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* This helper should be configured in codecept.json or codecept.conf.js
|
|
44
|
-
*
|
|
45
|
-
* * `url`: base url of website to be tested.
|
|
46
|
-
* * `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
47
|
-
* * `browser`: browser in which to perform testing.
|
|
48
|
-
* * `host`: (optional, default: localhost) - WebDriver host to connect.
|
|
49
|
-
* * `port`: (optional, default: 4444) - WebDriver port to connect.
|
|
50
|
-
* * `protocol`: (optional, default: http) - protocol for WebDriver server.
|
|
51
|
-
* * `path`: (optional, default: /wd/hub) - path to WebDriver server,
|
|
52
|
-
* * `restart`: (optional, default: true) - restart browser between tests.
|
|
53
|
-
* * `smartWait`: (optional) **enables [SmartWait](http://codecept.io/acceptance/#smartwait)**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
54
|
-
* * `disableScreenshots`: (optional, default: false) - don't save screenshots on failure.
|
|
55
|
-
* * `fullPageScreenshots` (optional, default: false) - make full page screenshots on failure.
|
|
56
|
-
* * `uniqueScreenshotNames`: (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
57
|
-
* * `keepBrowserState`: (optional, default: false) - keep browser state between tests when `restart` is set to false.
|
|
58
|
-
* * `keepCookies`: (optional, default: false) - keep cookies between tests when `restart` set to false.
|
|
59
|
-
* * `windowSize`: (optional) default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
60
|
-
* * `waitForTimeout`: (optional, default: 1000) sets default wait time in *ms* for all `wait*` functions.
|
|
61
|
-
* * `desiredCapabilities`: Selenium's [desired
|
|
62
|
-
* capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
|
|
63
|
-
* * `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper
|
|
64
|
-
* with `this.helpers["WebDriver"]._startBrowser()`.
|
|
65
|
-
* * `timeouts`: [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
71
|
+
* <!-- configuration -->
|
|
66
72
|
*
|
|
67
73
|
* Example:
|
|
68
74
|
*
|
|
@@ -567,6 +573,9 @@ class WebDriver extends Helper {
|
|
|
567
573
|
});
|
|
568
574
|
}
|
|
569
575
|
|
|
576
|
+
if (this.browser.capabilities && this.browser.capabilities.platformName) {
|
|
577
|
+
this.browser.capabilities.platformName = this.browser.capabilities.platformName.toLowerCase();
|
|
578
|
+
}
|
|
570
579
|
return this.browser;
|
|
571
580
|
}
|
|
572
581
|
|
|
@@ -942,7 +951,7 @@ class WebDriver extends Helper {
|
|
|
942
951
|
* {{ react }}
|
|
943
952
|
*/
|
|
944
953
|
async click(locator, context = null) {
|
|
945
|
-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
|
|
954
|
+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
|
|
946
955
|
const locateFn = prepareLocateFn.call(this, context);
|
|
947
956
|
|
|
948
957
|
const res = await findClickable.call(this, locator, locateFn);
|
|
@@ -1296,7 +1305,7 @@ class WebDriver extends Helper {
|
|
|
1296
1305
|
* Appium: not tested
|
|
1297
1306
|
*/
|
|
1298
1307
|
async checkOption(field, context = null) {
|
|
1299
|
-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
|
|
1308
|
+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
|
|
1300
1309
|
const locateFn = prepareLocateFn.call(this, context);
|
|
1301
1310
|
|
|
1302
1311
|
const res = await findCheckable.call(this, field, locateFn);
|
|
@@ -1327,7 +1336,7 @@ class WebDriver extends Helper {
|
|
|
1327
1336
|
* Appium: not tested
|
|
1328
1337
|
*/
|
|
1329
1338
|
async uncheckOption(field, context = null) {
|
|
1330
|
-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
|
|
1339
|
+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
|
|
1331
1340
|
const locateFn = prepareLocateFn.call(this, context);
|
|
1332
1341
|
|
|
1333
1342
|
const res = await findCheckable.call(this, field, locateFn);
|
|
@@ -2212,7 +2221,7 @@ class WebDriver extends Helper {
|
|
|
2212
2221
|
assertElementExists(res);
|
|
2213
2222
|
const elem = usingFirstElement(res);
|
|
2214
2223
|
const elementId = getElementId(elem);
|
|
2215
|
-
if (this.browser.isMobile) return this.browser.touchScroll(offsetX, offsetY, elementId);
|
|
2224
|
+
if (this.browser.isMobile && this.browser.capabilities.platformName !== 'android') return this.browser.touchScroll(offsetX, offsetY, elementId);
|
|
2216
2225
|
const location = await elem.getLocation();
|
|
2217
2226
|
assertElementExists(location, 'Failed to receive', 'location');
|
|
2218
2227
|
/* eslint-disable prefer-arrow-callback */
|
|
@@ -2220,7 +2229,7 @@ class WebDriver extends Helper {
|
|
|
2220
2229
|
/* eslint-enable */
|
|
2221
2230
|
}
|
|
2222
2231
|
|
|
2223
|
-
if (this.browser.isMobile) return this.browser.touchScroll(locator, offsetX, offsetY);
|
|
2232
|
+
if (this.browser.isMobile && this.browser.capabilities.platformName !== 'android') return this.browser.touchScroll(locator, offsetX, offsetY);
|
|
2224
2233
|
|
|
2225
2234
|
/* eslint-disable prefer-arrow-callback, comma-dangle */
|
|
2226
2235
|
return this.browser.execute(function (x, y) { return window.scrollTo(x, y); }, offsetX, offsetY);
|
package/docs/changelog.md
CHANGED
|
@@ -7,6 +7,12 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.3.3
|
|
11
|
+
|
|
12
|
+
* Fixed `DataCloneError: () => could not be cloned` when running data tests in run-workers
|
|
13
|
+
* πΊπ¦ Added #StandWithUkraine notice to CLI
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
## 3.3.2
|
|
11
17
|
|
|
12
18
|
* **[REST]** Fixed override of headers/token in `haveRequestHeaders()` and `amBearerAuthenticated()`. See [#3304](https://github.com/codeceptjs/CodeceptJS/issues/3304) by **[mirao](https://github.com/mirao)**
|
|
@@ -50,8 +56,6 @@ npx codeceptjs run test-dir/*"
|
|
|
50
56
|
* Improving the typings in many places
|
|
51
57
|
* Improving the return type of helpers for TS users ([#3245](https://github.com/codeceptjs/CodeceptJS/issues/3245)) - **[nlespiaucq](https://github.com/nlespiaucq)**
|
|
52
58
|
|
|
53
|
-
πΊπ¦ Added #StandWithUkraine hashtag notice to CLI
|
|
54
|
-
|
|
55
59
|
## 3.3.0
|
|
56
60
|
|
|
57
61
|
π©οΈ Features:
|
|
@@ -37,6 +37,7 @@ Please **add your own** by editing this page.
|
|
|
37
37
|
* [codeceptjs-rphelper](https://github.com/reportportal/agent-js-codecept) is a CodeceptJS helper which can publish tests results on ReportPortal after execution.
|
|
38
38
|
* [codeceptjs-xray-helper](https://www.npmjs.com/package/codeceptjs-xray-helper) is a CodeceptJS helper which can publish tests results on [XRAY](https://confluence.xpand-it.com/display/XRAYCLOUD/Import+Execution+Results+-+REST).
|
|
39
39
|
* [codeceptjs-slack-reporter](https://www.npmjs.com/package/codeceptjs-slack-reporter) Get a Slack notification when one or more scenarios fail.
|
|
40
|
+
* [codeceptjs-tesults](https://www.npmjs.com/package/codeceptjs-tesults) Report test results data from CodeceptJS to Tesults with this plugin.
|
|
40
41
|
|
|
41
42
|
## Page Object Code Generator
|
|
42
43
|
* [codeceptjs-CodeGenerator](https://github.com/senthillkumar/CodeCeptJS-PageObject) is a CodeceptJS custom wrapper which can create page class with action methods from the page object file(JSON) and project setup(Folder Structure).
|
package/docs/configuration.md
CHANGED
|
@@ -9,24 +9,27 @@ CodeceptJS configuration is set in `codecept.conf.js` file.
|
|
|
9
9
|
|
|
10
10
|
After running `codeceptjs init` it should be saved in test root.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
| Name | Type | Description |
|
|
13
|
+
| :------ | :------ | :------ |
|
|
14
|
+
| `bootstrap` | `Function` \| `boolean` \| `string` | Execute JS code before tests are run. https://codecept.io/bootstrap/ Can be either JS module file or async function: ```js bootstrap: async () => server.launch(), ``` or ```js bootstrap: 'bootstrap.js', ``` |
|
|
15
|
+
| `bootstrapAll` | `Function` \| `boolean` \| `string` | Execute JS code before launching tests in parallel mode. https://codecept.io/bootstrap/#bootstrapall-teardownall |
|
|
16
|
+
| `gherkin?` | { `features`: `string` \| `string`[] ; `steps`: `string`[] } | Enable BDD features. https://codecept.io/bdd/#configuration Sample configuration: ```js gherkin: { features: "./features/*.feature", steps: ["./step_definitions/steps.js"] } ``` |
|
|
17
|
+
| `gherkin.features` | `string` \| `string`[] | load feature files by pattern. Multiple patterns can be specified as array |
|
|
18
|
+
| `gherkin.steps` | `string`[] | load step definitions from JS files |
|
|
19
|
+
| `grep` | `string` | Pattern to filter tests by name |
|
|
20
|
+
| `helpers?` | { `[key: string]`: `any`; } | Enabled and configured helpers ```js helpers: { Playwright: { url: 'https://mysite.com', browser: 'firefox' } } ``` |
|
|
21
|
+
| `include?` | `any` | Include page objects to access them via dependency injection ```js I: "./custom_steps.js", loginPage: "./pages/Login.js", User: "./pages/User.js", ``` Configured modules can be injected by name in a Scenario: ```js Scenario('test', { I, loginPage, User }) ``` |
|
|
22
|
+
| `mocha?` | `any` | [Mocha test runner options](https://mochajs.org/#configuring-mocha-nodejs), additional [reporters](https://codecept.io/reports/#xml) can be configured here. Example: ```js mocha: { "mocha-junit-reporter": { stdout: "./output/console.log", options: { mochaFile: "./output/result.xml", attachments: true //add screenshot for a failed test } } } ``` |
|
|
23
|
+
| `noGlobals?` | `boolean` | Disable registering global functions (Before, Scenario, etc). Not recommended |
|
|
24
|
+
| `output` | `string` | Where to store failure screenshots, artifacts, etc |
|
|
25
|
+
| `plugins?` | `any` | [Enabled plugins](https://codecept.io/plugins/) |
|
|
26
|
+
| `require?` | `string`[] | Require additional JS modules. https://codecept.io/configuration/#require Example: ``` require: ["ts-node/register", "should"] ``` |
|
|
27
|
+
| `teardown` | `Function` \| `boolean` \| `string` | Execute JS code after tests are run. https://codecept.io/bootstrap/ Can be either JS module file or async function: ```js teardown: async () => server.stop(), ``` or ```js teardown: 'teardown.js', ``` |
|
|
28
|
+
| `teardownAll` | `Function` \| `boolean` \| `string` | Execute JS code after finishing tests in parallel mode. https://codecept.io/bootstrap/#bootstrapall-teardownall |
|
|
29
|
+
| `tests` | `string` | Pattern to locate CodeceptJS tests. Allows to enter glob pattern or an Array<string> of patterns to match tests / test file names. For tests in JavaScript: ```js tests: 'tests/**.test.js' ``` For tests in TypeScript: ```js tests: 'tests/**.test.ts' ``` |
|
|
30
|
+
| `timeout?` | `number` | Set default tests timeout in seconds. Tests will be killed on no response after timeout. ```js timeout: 20, ``` |
|
|
31
|
+
| `translation?` | `string` | Enable localized test commands https://codecept.io/translation/ |
|
|
32
|
+
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
## Require
|