codeceptjs 3.5.3 → 3.5.4
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 +0 -2
- package/docs/build/Appium.js +8 -6
- package/docs/build/GraphQL.js +25 -0
- package/docs/build/Nightmare.js +11 -6
- package/docs/build/Playwright.js +425 -193
- package/docs/build/Protractor.js +13 -8
- package/docs/build/Puppeteer.js +20 -14
- package/docs/build/TestCafe.js +17 -10
- package/docs/build/WebDriver.js +41 -37
- package/docs/changelog.md +170 -1
- package/docs/community-helpers.md +8 -4
- package/docs/examples.md +8 -2
- package/docs/helpers/Appium.md +2 -2
- package/docs/helpers/GraphQL.md +21 -0
- package/docs/helpers/Nightmare.md +2 -2
- package/docs/helpers/Playwright.md +239 -122
- package/docs/helpers/Protractor.md +2 -2
- package/docs/helpers/Puppeteer.md +3 -3
- package/docs/helpers/TestCafe.md +2 -2
- package/docs/helpers/WebDriver.md +3 -3
- package/docs/playwright.md +24 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/wiki/Books-&-Posts.md +0 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
- package/docs/wiki/Examples.md +8 -2
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
- package/docs/wiki/Home.md +0 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
- package/docs/wiki/Release-Process.md +0 -0
- package/docs/wiki/Roadmap.md +0 -0
- package/docs/wiki/Tests.md +0 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
- package/docs/wiki/Videos.md +0 -0
- package/lib/command/definitions.js +2 -7
- package/lib/command/run-multiple/collection.js +17 -5
- package/lib/helper/Appium.js +6 -4
- package/lib/helper/GraphQL.js +25 -0
- package/lib/helper/Nightmare.js +9 -4
- package/lib/helper/Playwright.js +422 -190
- package/lib/helper/Protractor.js +11 -6
- package/lib/helper/Puppeteer.js +18 -12
- package/lib/helper/TestCafe.js +15 -8
- package/lib/helper/WebDriver.js +39 -35
- package/lib/helper/errors/ElementNotFound.js +2 -1
- package/lib/helper/extras/PlaywrightReact.js +9 -0
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/interfaces/bdd.js +1 -1
- package/lib/mochaFactory.js +2 -1
- package/lib/pause.js +5 -4
- package/lib/plugin/heal.js +2 -3
- package/lib/plugin/selenoid.js +6 -1
- package/lib/step.js +27 -10
- package/lib/utils.js +4 -0
- package/lib/workers.js +3 -1
- package/package.json +14 -14
- package/typings/promiseBasedTypes.d.ts +145 -126
- package/typings/types.d.ts +152 -133
- package/CHANGELOG.md +0 -2563
- package/docs/build/Polly.js +0 -42
- package/docs/build/SeleniumWebdriver.js +0 -76
|
@@ -441,7 +441,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
441
441
|
#### Parameters
|
|
442
442
|
|
|
443
443
|
- `field` **([string][9] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
444
|
-
- `value` **[string][9]** value to check.
|
|
444
|
+
- `value` **([string][9] | [object][10])** value to check.
|
|
445
445
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
446
446
|
|
|
447
447
|
### dontSeeInSource
|
|
@@ -1225,7 +1225,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1225
1225
|
#### Parameters
|
|
1226
1226
|
|
|
1227
1227
|
- `field` **([string][9] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
1228
|
-
- `value` **[string][9]** value to check.
|
|
1228
|
+
- `value` **([string][9] | [object][10])** value to check.
|
|
1229
1229
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1230
1230
|
|
|
1231
1231
|
### seeInPopup
|
|
@@ -56,7 +56,7 @@ Type: [object][4]
|
|
|
56
56
|
- `manualStart` **[boolean][20]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
57
57
|
- `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
58
58
|
- `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
|
|
59
|
-
- `highlightElement` **[boolean][20]?** highlight the interacting elements
|
|
59
|
+
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -589,7 +589,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
589
589
|
#### Parameters
|
|
590
590
|
|
|
591
591
|
- `field` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
592
|
-
- `value` **[string][6]** value to check.
|
|
592
|
+
- `value` **([string][6] | [object][4])** value to check.
|
|
593
593
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
594
594
|
|
|
595
595
|
### dontSeeInSource
|
|
@@ -1618,7 +1618,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1618
1618
|
#### Parameters
|
|
1619
1619
|
|
|
1620
1620
|
- `field` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
1621
|
-
- `value` **[string][6]** value to check.
|
|
1621
|
+
- `value` **([string][6] | [object][4])** value to check.
|
|
1622
1622
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1623
1623
|
|
|
1624
1624
|
### seeInPopup
|
package/docs/helpers/TestCafe.md
CHANGED
|
@@ -355,7 +355,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
355
355
|
#### Parameters
|
|
356
356
|
|
|
357
357
|
- `field` **([string][4] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
358
|
-
- `value` **[string][4]** value to check.
|
|
358
|
+
- `value` **([string][4] | [object][5])** value to check.
|
|
359
359
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
360
360
|
|
|
361
361
|
### dontSeeInSource
|
|
@@ -926,7 +926,7 @@ I.seeInField('#searchform input','Search');
|
|
|
926
926
|
#### Parameters
|
|
927
927
|
|
|
928
928
|
- `field` **([string][4] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
929
|
-
- `value` **[string][4]** value to check.
|
|
929
|
+
- `value` **([string][4] | [object][5])** value to check.
|
|
930
930
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
931
931
|
|
|
932
932
|
### seeInSource
|
|
@@ -45,7 +45,7 @@ Type: [object][16]
|
|
|
45
45
|
- `desiredCapabilities` **[object][16]?** Selenium's [desired capabilities][6].
|
|
46
46
|
- `manualStart` **[boolean][32]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
47
47
|
- `timeouts` **[object][16]?** [WebDriver timeouts][37] defined as hash.
|
|
48
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements
|
|
48
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
@@ -757,7 +757,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
757
757
|
#### Parameters
|
|
758
758
|
|
|
759
759
|
- `field` **([string][17] | [object][16])** located by label|name|CSS|XPath|strict locator.
|
|
760
|
-
- `value` **[string][17]** value to check.
|
|
760
|
+
- `value` **([string][17] | [object][16])** value to check.
|
|
761
761
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
762
762
|
|
|
763
763
|
### dontSeeInSource
|
|
@@ -1783,7 +1783,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1783
1783
|
#### Parameters
|
|
1784
1784
|
|
|
1785
1785
|
- `field` **([string][17] | [object][16])** located by label|name|CSS|XPath|strict locator.
|
|
1786
|
-
- `value` **[string][17]** value to check.
|
|
1786
|
+
- `value` **([string][17] | [object][16])** value to check.
|
|
1787
1787
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1788
1788
|
|
|
1789
1789
|
### seeInPopup
|
package/docs/playwright.md
CHANGED
|
@@ -272,6 +272,29 @@ exports.config = {
|
|
|
272
272
|
}
|
|
273
273
|
```
|
|
274
274
|
|
|
275
|
+
Sometimes, the Electron app is built with [electron-forge](https://www.electronforge.io/), then configuring may a bit different.
|
|
276
|
+
|
|
277
|
+
- First, you should run your electron-forge command to build and pack your app.
|
|
278
|
+
- Then, you would find `index.js` file inside `.webpack/main/index.js`
|
|
279
|
+
|
|
280
|
+
`codecept.conf.js` - CodeceptJS configuration file
|
|
281
|
+
```js
|
|
282
|
+
const path = require("path");
|
|
283
|
+
|
|
284
|
+
exports.config = {
|
|
285
|
+
helpers: {
|
|
286
|
+
Playwright: {
|
|
287
|
+
browser: "electron",
|
|
288
|
+
electron: {
|
|
289
|
+
executablePath: require("electron"),
|
|
290
|
+
args: [path.join(__dirname, ".webpack/main/index.js")],
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
// rest of config
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
275
298
|
### Headless Mode
|
|
276
299
|
|
|
277
300
|
With Electron, headless mode must be set when creating the window. Therefore, CodeceptJS's `show` configuration parameter will not work. However, you can set it in the `main.js` file as shown below:
|
|
@@ -606,4 +629,4 @@ Playwright can be added to GitHub Actions using [official action](https://github
|
|
|
606
629
|
- uses: microsoft/playwright-github-action@v1
|
|
607
630
|
- name: run CodeceptJS tests
|
|
608
631
|
run: npx codeceptjs run
|
|
609
|
-
```
|
|
632
|
+
```
|
|
@@ -7,5 +7,5 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
10
|
-
@param {
|
|
10
|
+
@param {CodeceptJS.StringOrSecret} value value to check.
|
|
11
11
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
@@ -8,5 +8,5 @@ I.seeInField('form input[type=hidden]','hidden_value');
|
|
|
8
8
|
I.seeInField('#searchform input','Search');
|
|
9
9
|
```
|
|
10
10
|
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
11
|
-
@param {
|
|
11
|
+
@param {CodeceptJS.StringOrSecret} value value to check.
|
|
12
12
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
File without changes
|
|
@@ -22,9 +22,6 @@ Please **add your own** by editing this page.
|
|
|
22
22
|
* [codeceptjs-bshelper](https://github.com/PeterNgTr/codeceptjs-bshelper) - a helper which updates `Test Names` & `Test Results` on Browserstack
|
|
23
23
|
* [codeceptjs-tbhelper](https://github.com/testingbot/codeceptjs-tbhelper) - a helper which updates `Test Names` & `Test Results` on TestingBot
|
|
24
24
|
|
|
25
|
-
## Integrations
|
|
26
|
-
* [codeceptjs-testrail](https://github.com/PeterNgTr/codeceptjs-testrail) - a plugin to integrate with [Testrail](https://www.gurock.com/testrail)
|
|
27
|
-
|
|
28
25
|
## Visual-Testing
|
|
29
26
|
* [codeceptjs-resemblehelper](https://github.com/puneet0191/codeceptjs-resemblehelper) - a helper which helps with visual testing using resemble.js.
|
|
30
27
|
* [codeceptjs-applitoolshelper](https://www.npmjs.com/package/codeceptjs-applitoolshelper) - a helper which helps interaction with [Applitools](https://applitools.com)
|
|
@@ -33,8 +30,10 @@ Please **add your own** by editing this page.
|
|
|
33
30
|
## Reporters
|
|
34
31
|
* [codeceptjs-rphelper](https://github.com/reportportal/agent-js-codecept) is a CodeceptJS helper which can publish tests results on ReportPortal after execution.
|
|
35
32
|
* [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).
|
|
33
|
+
* [codeceptjs-xray-cloud-helper](https://www.npmjs.com/package/codeceptjs-xray-cloud-helper) is a helper that automatically retrieves the result of CodeceptJS tests and sends them to XRAY/JIRA(cloud version) via [XRAY Cloud API](https://docs.getxray.app/display/XRAYCLOUD/Import+Execution+Results+-+REST+v2#ImportExecutionResultsRESTv2-XrayJSONresults).
|
|
36
34
|
* [codeceptjs-slack-reporter](https://www.npmjs.com/package/codeceptjs-slack-reporter) Get a Slack notification when one or more scenarios fail.
|
|
37
35
|
* [codeceptjs-browserlogs-plugin](https://github.com/pavkam/codeceptjs-browserlogs-plugin) Record the browser logs for failed tests.
|
|
36
|
+
* [codeceptjs-testrail](https://github.com/PeterNgTr/codeceptjs-testrail) - a plugin to integrate with [Testrail](https://www.gurock.com/testrail)
|
|
38
37
|
|
|
39
38
|
## Browser request control
|
|
40
39
|
* [codeceptjs-resources-check](https://github.com/luarmr/codeceptjs-resources-check) Load a URL with Puppeteer and listen to the requests while the page is loading. Enabling count the number or check the sizes of the requests.
|
|
@@ -46,4 +45,9 @@ Please **add your own** by editing this page.
|
|
|
46
45
|
## Other
|
|
47
46
|
|
|
48
47
|
* [codeceptjs-cmdhelper](https://github.com/thiagodp/codeceptjs-cmdhelper) allows you to run commands in the terminal/console
|
|
49
|
-
* [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
|
|
48
|
+
* [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
|
|
49
|
+
* [codeceptjs-datalayer-helper](https://github.com/kobenguyent/codeceptjs-datalayer-helper) CodeceptJS DataLayer helper helps you to get the datalayer JavaScript array that is used to store information and send this data to the tag manager.
|
|
50
|
+
* [codeceptjs-a11y-helper](https://github.com/kobenguyent/codeceptjs-a11y-helper) accessibility tests integrated with CodeceptJS - Playwright-axe
|
|
51
|
+
* [codeceptjs-lighthouse-helper](https://github.com/kobenguyent/codeceptjs-lighthouse-helper) lighthouse audit integrated with CodeceptJS - Playwright
|
|
52
|
+
* [Snowplow Data analytics](https://www.npmjs.com/package/@viasat/codeceptjs-snowplow-helper) - Test your Snowplow events implementations with CodeceptJS and Snowplow Micro.
|
|
53
|
+
* [codeceptjs-failure-logger](https://github.com/kobenguyent/codeceptjs-failure-logger) - Log failed CodeceptJS tests to file
|
|
@@ -5,25 +5,57 @@ To convert coverage generated from `playwright` to `istanbul` coverage, you firs
|
|
|
5
5
|
|
|
6
6
|
Once installed, convert the coverage to a format which `istanbul` can recognize, by writing a script as shown below.
|
|
7
7
|
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const fs = require('fs/promises');
|
|
8
|
+
```ts
|
|
9
|
+
import glob from 'glob'
|
|
10
|
+
import v8toIstanbul from 'v8-to-istanbul'
|
|
11
|
+
let coverage
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
import fs from 'fs'
|
|
14
|
+
|
|
15
|
+
const coverageFolder = `${process.cwd()}/coverage`
|
|
16
|
+
|
|
17
|
+
async function isExists(path) {
|
|
18
|
+
try {
|
|
19
|
+
await fs.access(path, null)
|
|
20
|
+
return true
|
|
21
|
+
} catch {
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
glob.sync(process.cwd() + '/output/coverage/**/').forEach(item => {
|
|
27
|
+
const directory = fs.opendirSync(item)
|
|
28
|
+
let file
|
|
29
|
+
while ((file = directory.readSync()) !== null) {
|
|
30
|
+
if (file && file.name.includes('.coverage.json') === true) {
|
|
31
|
+
const fileName = file.name
|
|
32
|
+
if (fileName) {
|
|
33
|
+
coverage = require(`${process.cwd()}/output/coverage/${fileName}`)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
directory.closeSync()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
void (async () => {
|
|
15
41
|
for (const entry of coverage) {
|
|
16
42
|
// Used to get file name
|
|
17
|
-
const file = entry.url.match(/(?:http(s)*:\/\/.*\/)(?<file>.*)/)
|
|
18
|
-
const converter = new v8toIstanbul(file.groups.file, 0, {
|
|
19
|
-
source: entry.source
|
|
20
|
-
});
|
|
43
|
+
const file = entry.url.match(/(?:http(s)*:\/\/.*\/)(?<file>.*)/)
|
|
21
44
|
|
|
22
|
-
|
|
23
|
-
|
|
45
|
+
const converter = v8toIstanbul(file.groups.file, 0, {
|
|
46
|
+
source: entry.source,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
await converter.load()
|
|
50
|
+
converter.applyCoverage(entry.functions)
|
|
24
51
|
|
|
25
52
|
// Store converted coverage file which can later be used to generate report
|
|
26
|
-
|
|
53
|
+
const exist = await isExists(coverageFolder)
|
|
54
|
+
if (!exist) {
|
|
55
|
+
fs.mkdirSync(coverageFolder, {recursive: true})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await fs.writeFileSync(`${coverageFolder}/final.json`, JSON.stringify(converter.toIstanbul(), null, 2))
|
|
27
59
|
}
|
|
28
|
-
})()
|
|
60
|
+
})()
|
|
29
61
|
```
|
package/docs/wiki/Examples.md
CHANGED
|
@@ -6,6 +6,7 @@ Playground repository where you can run tests in different helpers on a basic si
|
|
|
6
6
|
|
|
7
7
|
Tests repository demonstrate usage of
|
|
8
8
|
|
|
9
|
+
* Playwright helper
|
|
9
10
|
* Puppeteer helper
|
|
10
11
|
* WebDriver helper
|
|
11
12
|
* TestCafe plugin
|
|
@@ -18,7 +19,6 @@ Tests repository demonstrate usage of
|
|
|
18
19
|
CodeceptJS repo contains basic tests (both failing and passing) just to show how it works.
|
|
19
20
|
Our team uses it to test new features and run simple scenarios.
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
## [CodeceptJS Cucumber E2E Framework](https://github.com/gkushang/codeceptjs-e2e)
|
|
23
23
|
|
|
24
24
|
This repository contains complete E2E framework for CodeceptJS with Cucumber and SauceLabs Integration
|
|
@@ -136,4 +136,10 @@ This is necessary if all integrations with TMS and CI/CD are already configured,
|
|
|
136
136
|
* HTTP request client with session support and unit tests
|
|
137
137
|
* Exemplary code control
|
|
138
138
|
* Ready to launch in a CI/CD system as is
|
|
139
|
-
* OOP, Test data models and builders, endpoint decorators
|
|
139
|
+
* OOP, Test data models and builders, endpoint decorators
|
|
140
|
+
|
|
141
|
+
## [Playwright fun with CodeceptJS](https://github.com/PeterNgTr/codeceptjs-playwright-fun)
|
|
142
|
+
* Tests are written in TS
|
|
143
|
+
* CI/CD with Github Actions
|
|
144
|
+
* Page Object Model is applied
|
|
145
|
+
* ReportPortal Integration
|
|
File without changes
|
package/docs/wiki/Home.md
CHANGED
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Migrating from Appium 1.x to Appium 2.x
|
|
2
|
+
This document is a guide for those who are using Appium 1.x and wish to migrate to Appium 2.x. It contains a list of breaking changes and how to migrate your environments or test suites to ensure compatibility with Appium 2.0.
|
|
3
|
+
|
|
4
|
+
# Overview of Appium 2.0
|
|
5
|
+
Appium 2.0 is the most major new release of Appium in over 5 years. The changes in Appium 2.0 are not primarily related to changes in automation behaviors for specific platforms. Instead, Appium 2.0 reenvisions Appium as a platform where "drivers" (code projects that introduce support for automation of a given platform) and "plugins" (code projects that allow for overriding, altering, extending, or adding behaviors to Appium) can be easily created and shared.
|
|
6
|
+
|
|
7
|
+
At the same time, the Appium project is taking the opportunity to remove many old and deprecated bits of functionality.
|
|
8
|
+
|
|
9
|
+
Together these do introduce a few breaking changes to how Appium is installed, how drivers and various features are managed, and protocol support. These are detailed below.
|
|
10
|
+
|
|
11
|
+
# Breaking Changes
|
|
12
|
+
Here we call out the breaking changes and what you need to do to account for them.
|
|
13
|
+
|
|
14
|
+
## ‼ Default server base path
|
|
15
|
+
With Appium 1.x, the server would accept commands by default on http://localhost:4723/wd/hub. The /wd/hub base path was a legacy convention from the days of migrating from Selenium 1 to Selenium 2, and is no longer relevant. As such the default base path for the server is now /. If you want to retain the old behaviour, you can set the base path via a command line argument as follows:
|
|
16
|
+
|
|
17
|
+
`appium --base-path=/wd/hub`
|
|
18
|
+
|
|
19
|
+
## ‼ Installing drivers during setup
|
|
20
|
+
When you installed Appium 1.x, all available drivers would be installed at the same time as the main Appium server. This is no longer the case. Simply installing Appium 2.0 (e.g., by npm install -g appium@next), will install the Appium server only, but no drivers. To install drivers, you must instead use the new [Appium extension CLI](https://appium.github.io/appium/docs/en/2.0/cli/extensions/). For example, to install the latest versions of the XCUITest and UiAutomator2 drivers, after installing Appium you would run the following commands:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
appium driver install uiautomator2,xcuitest # installs the latest driver version
|
|
24
|
+
```
|
|
25
|
+
At this point, your drivers are installed and ready. There's a lot more you can do with this CLI so be sure to check out the docs on it. If you're running in a CI environment or want to install Appium along with some drivers all in one step, you can do so using some special flags during install, for example:
|
|
26
|
+
|
|
27
|
+
`npm install --global appium --drivers=xcuitest,uiautomator2`
|
|
28
|
+
This will install Appium and the two drivers for you in one go. Please uninstall any existing Appium 1.x npm packages (with npm uninstall -g appium) if you get an installation or startup error.
|
|
29
|
+
|
|
30
|
+
## ‼ Capabilities
|
|
31
|
+
One significant difference between old and new protocols is in the format of capabilities. Previously called "desired capabilities", and now called simply "capabilities", there is now a requirement for a so-called "vendor prefix" on any non-standard capabilities. The list of standard capabilities is given in the [WebDriver Protocol spec](https://www.w3.org/TR/webdriver/#capabilities), and includes a few commonly used capabilities such as browserName and platformName.
|
|
32
|
+
|
|
33
|
+
These standard capabilities continue to be used as-is. All other capabilities must include a "vendor prefix" in their name. A vendor prefix is a string followed by a colon, such as appium:. Most of Appium's capabilities go beyond the standard W3C capabilities and must therefore include vendor prefixes (we recommend that you use appium: unless directed otherwise by documentation). For example:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
`appium:app`
|
|
37
|
+
`appium:noReset`
|
|
38
|
+
`appium:deviceName`
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This requirement may or may not be a breaking change for your test suites when targeting Appium 2.0. If you're using an updated Appium client (at least one maintained by the Appium team), the client will add the appium: prefix for you on all necessary capabilities automatically. New versions of [Appium Inspector](https://github.com/appium/appium-inspector) will also do this. Cloud-based Appium providers may also do this. So simply be aware that if you get any messages to the effect that your capabilities lack a vendor prefix, this is how you solve that problem.
|
|
42
|
+
|
|
43
|
+
To make everyone's lives a bit easier with CodeceptJS, you don't need to update your capabilities to include "vendor prefix", CodeceptJS does it for you out of the box.
|
|
44
|
+
|
|
45
|
+
## ‼ WebdriverIO upgrade
|
|
46
|
+
CodeceptJS should be installed with webdriverio support, as the moment of testing, `webdriverio@8.6.3` works seamlessly:
|
|
47
|
+
```bash
|
|
48
|
+
npm install codeceptjs webdriverio@8.6.3 --save
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## ‼ CodeceptJS configuration
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
...
|
|
55
|
+
appiumV2: true, // set this to true to try out appium 2.x
|
|
56
|
+
'app': `${process.cwd()}/build/Monefy_Pro_v1.15.0.apk`,
|
|
57
|
+
'platform': 'android',
|
|
58
|
+
'device': 'emulator',
|
|
59
|
+
'port': DEFAULT_PORT,
|
|
60
|
+
'path': '/wd/hub',
|
|
61
|
+
browser: '',
|
|
62
|
+
desiredCapabilities: {
|
|
63
|
+
'appPackage': data.packageName,
|
|
64
|
+
'deviceName': process.env.DEVICE || 'Emulator',
|
|
65
|
+
'platformName': process.env.PLATFORM || 'android',
|
|
66
|
+
'platformVersion': process.env.OS_VERSION || '11.0',
|
|
67
|
+
'automationName': process.env.ENGINE || 'UIAutomator2',
|
|
68
|
+
'avd': process.env.UDID || 'Pixel_XL_API_30',
|
|
69
|
+
'newCommandTimeout': 300000,
|
|
70
|
+
'androidDeviceReadyTimeout': 300000,
|
|
71
|
+
'androidInstallTimeout': 90000,
|
|
72
|
+
'appWaitDuration': 300000,
|
|
73
|
+
'autoGrantPermissions': true,
|
|
74
|
+
'gpsEnabled': true,
|
|
75
|
+
'isHeadless': false,
|
|
76
|
+
'noReset': false,
|
|
77
|
+
'noSign': true,
|
|
78
|
+
}
|
|
79
|
+
...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Demo project to try with Appium v2: https://github.com/kobenguyent/thanh-nguyen/tree/main/task2
|
|
File without changes
|
package/docs/wiki/Roadmap.md
CHANGED
|
File without changes
|
package/docs/wiki/Tests.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/wiki/Videos.md
CHANGED
|
File without changes
|
|
@@ -17,7 +17,6 @@ const actingHelpers = [...require('../plugin/standardActingHelpers'), 'REST'];
|
|
|
17
17
|
* @param {Map} params.supportObject
|
|
18
18
|
* @param {Array<string>} params.helperNames
|
|
19
19
|
* @param {Array<string>} params.importPaths
|
|
20
|
-
* @param {Array<string>} params.customHelpers
|
|
21
20
|
* @param params.translations
|
|
22
21
|
*
|
|
23
22
|
* @returns {string}
|
|
@@ -29,15 +28,13 @@ const getDefinitionsFileContent = ({
|
|
|
29
28
|
supportObject,
|
|
30
29
|
importPaths,
|
|
31
30
|
translations,
|
|
32
|
-
customHelpers,
|
|
33
31
|
}) => {
|
|
34
32
|
const getHelperListFragment = ({
|
|
35
33
|
hasCustomHelper,
|
|
36
34
|
hasCustomStepsFile,
|
|
37
|
-
customHelpers,
|
|
38
35
|
}) => {
|
|
39
36
|
if (hasCustomHelper && hasCustomStepsFile) {
|
|
40
|
-
return `${['ReturnType<steps_file>',
|
|
37
|
+
return `${['ReturnType<steps_file>', 'WithTranslation<Methods>'].join(', ')}`;
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
if (hasCustomStepsFile) {
|
|
@@ -50,7 +47,6 @@ const getDefinitionsFileContent = ({
|
|
|
50
47
|
const helpersListFragment = getHelperListFragment({
|
|
51
48
|
hasCustomHelper,
|
|
52
49
|
hasCustomStepsFile,
|
|
53
|
-
customHelpers,
|
|
54
50
|
});
|
|
55
51
|
|
|
56
52
|
const importPathsFragment = importPaths.join('\n');
|
|
@@ -143,7 +139,7 @@ module.exports = function (genPath, options) {
|
|
|
143
139
|
}
|
|
144
140
|
|
|
145
141
|
if (!actingHelpers.includes(name)) {
|
|
146
|
-
customHelpers.push(
|
|
142
|
+
customHelpers.push(name);
|
|
147
143
|
}
|
|
148
144
|
}
|
|
149
145
|
|
|
@@ -186,7 +182,6 @@ module.exports = function (genPath, options) {
|
|
|
186
182
|
translations,
|
|
187
183
|
hasCustomStepsFile,
|
|
188
184
|
hasCustomHelper,
|
|
189
|
-
customHelpers,
|
|
190
185
|
});
|
|
191
186
|
|
|
192
187
|
// add aliases for translations
|
|
@@ -47,14 +47,26 @@ class Collection {
|
|
|
47
47
|
*/
|
|
48
48
|
prepareRuns(selectedRuns, config) {
|
|
49
49
|
selectedRuns.forEach((selectedRun) => {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
50
|
+
const runConfig = [];
|
|
51
|
+
const runName = [];
|
|
52
52
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
53
|
+
if (selectedRun === 'all') {
|
|
54
|
+
Object.keys(config.multiple).forEach(name => {
|
|
55
|
+
runName.push(name);
|
|
56
|
+
runConfig.push(config.multiple[name]);
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
runName.push(selectedRun.split(':')[0]);
|
|
60
|
+
runConfig.push(config.multiple[runName[0]]);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
for (let i = 0; i < runConfig.length; i++) {
|
|
64
|
+
if (!runConfig[i]) {
|
|
65
|
+
throw new Error(`run ${runName[i]} was not configured in "multiple" section of config`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.addRun(createRun(runName[i], runConfig[i]));
|
|
69
|
+
}
|
|
58
70
|
});
|
|
59
71
|
|
|
60
72
|
return this;
|
package/lib/helper/Appium.js
CHANGED
|
@@ -1433,8 +1433,9 @@ class Appium extends Webdriver {
|
|
|
1433
1433
|
*
|
|
1434
1434
|
*/
|
|
1435
1435
|
async dontSeeInField(field, value) {
|
|
1436
|
-
|
|
1437
|
-
return super.dontSeeInField(
|
|
1436
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1437
|
+
if (this.isWeb) return super.dontSeeInField(field, _value);
|
|
1438
|
+
return super.dontSeeInField(parseLocator.call(this, field), _value);
|
|
1438
1439
|
}
|
|
1439
1440
|
|
|
1440
1441
|
/**
|
|
@@ -1565,8 +1566,9 @@ class Appium extends Webdriver {
|
|
|
1565
1566
|
*
|
|
1566
1567
|
*/
|
|
1567
1568
|
async seeInField(field, value) {
|
|
1568
|
-
|
|
1569
|
-
return super.seeInField(
|
|
1569
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1570
|
+
if (this.isWeb) return super.seeInField(field, _value);
|
|
1571
|
+
return super.seeInField(parseLocator.call(this, field), _value);
|
|
1570
1572
|
}
|
|
1571
1573
|
|
|
1572
1574
|
/**
|
package/lib/helper/GraphQL.js
CHANGED
|
@@ -81,6 +81,8 @@ class GraphQL extends Helper {
|
|
|
81
81
|
'Content-Type': 'application/json',
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
request.headers = { ...this.headers, ...request.headers };
|
|
85
|
+
|
|
84
86
|
if (this.config.onRequest) {
|
|
85
87
|
await this.config.onRequest(request);
|
|
86
88
|
}
|
|
@@ -200,5 +202,28 @@ class GraphQL extends Helper {
|
|
|
200
202
|
_setRequestTimeout(newTimeout) {
|
|
201
203
|
this.options.timeout = newTimeout;
|
|
202
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Sets request headers for all requests of this test
|
|
208
|
+
*
|
|
209
|
+
* @param {object} headers headers list
|
|
210
|
+
*/
|
|
211
|
+
haveRequestHeaders(headers) {
|
|
212
|
+
this.headers = { ...this.headers, ...headers };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Adds a header for Bearer authentication
|
|
217
|
+
*
|
|
218
|
+
* ```js
|
|
219
|
+
* // we use secret function to hide token from logs
|
|
220
|
+
* I.amBearerAuthenticated(secret('heregoestoken'))
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* @param {string | CodeceptJS.Secret} accessToken Bearer access token
|
|
224
|
+
*/
|
|
225
|
+
amBearerAuthenticated(accessToken) {
|
|
226
|
+
this.haveRequestHeaders({ Authorization: `Bearer ${accessToken}` });
|
|
227
|
+
}
|
|
203
228
|
}
|
|
204
229
|
module.exports = GraphQL;
|
package/lib/helper/Nightmare.js
CHANGED
|
@@ -702,14 +702,16 @@ class Nightmare extends Helper {
|
|
|
702
702
|
* {{> seeInField }}
|
|
703
703
|
*/
|
|
704
704
|
async seeInField(field, value) {
|
|
705
|
-
|
|
705
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
706
|
+
return proceedSeeInField.call(this, 'assert', field, _value);
|
|
706
707
|
}
|
|
707
708
|
|
|
708
709
|
/**
|
|
709
710
|
* {{> dontSeeInField }}
|
|
710
711
|
*/
|
|
711
712
|
async dontSeeInField(field, value) {
|
|
712
|
-
|
|
713
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
714
|
+
return proceedSeeInField.call(this, 'negate', field, _value);
|
|
713
715
|
}
|
|
714
716
|
|
|
715
717
|
/**
|
|
@@ -1261,8 +1263,11 @@ class Nightmare extends Helper {
|
|
|
1261
1263
|
const body = document.body;
|
|
1262
1264
|
const html = document.documentElement;
|
|
1263
1265
|
window.scrollTo(0, Math.max(
|
|
1264
|
-
body.scrollHeight,
|
|
1265
|
-
|
|
1266
|
+
body.scrollHeight,
|
|
1267
|
+
body.offsetHeight,
|
|
1268
|
+
html.clientHeight,
|
|
1269
|
+
html.scrollHeight,
|
|
1270
|
+
html.offsetHeight
|
|
1266
1271
|
));
|
|
1267
1272
|
});
|
|
1268
1273
|
/* eslint-enable */
|