codeceptjs 3.5.5 → 3.5.7-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 +63 -0
- package/docs/bdd.md +11 -7
- package/docs/build/ApiDataFactory.js +2 -1
- package/docs/build/Appium.js +25 -23
- package/docs/build/Expect.js +422 -0
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +53 -56
- package/docs/build/Playwright.js +209 -135
- package/docs/build/Protractor.js +66 -69
- package/docs/build/Puppeteer.js +83 -83
- package/docs/build/TestCafe.js +56 -55
- package/docs/build/WebDriver.js +85 -86
- package/docs/changelog.md +63 -0
- package/docs/commands.md +12 -0
- package/docs/helpers/Appium.md +50 -32
- package/docs/helpers/Expect.md +275 -0
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +141 -94
- package/docs/helpers/Playwright.md +281 -212
- package/docs/helpers/Protractor.md +229 -169
- package/docs/helpers/Puppeteer.md +257 -186
- package/docs/helpers/TestCafe.md +201 -149
- package/docs/helpers/WebDriver.md +253 -179
- package/docs/mobile.md +17 -21
- package/docs/plugins.md +35 -1
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/blur.mustache +1 -0
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +0 -2
- package/docs/webapi/executeScript.mustache +0 -2
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/focus.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +1 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +1 -1
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/ai.js +12 -3
- package/lib/cli.js +3 -1
- package/lib/codecept.js +3 -0
- package/lib/command/dryRun.js +2 -1
- package/lib/command/info.js +24 -0
- package/lib/command/run-workers.js +3 -2
- package/lib/command/run.js +3 -2
- package/lib/data/context.js +14 -6
- package/lib/helper/ApiDataFactory.js +2 -1
- package/lib/helper/Appium.js +7 -5
- package/lib/helper/Expect.js +422 -0
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Playwright.js +134 -64
- package/lib/helper/Puppeteer.js +6 -6
- package/lib/helper/WebDriver.js +4 -4
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/html.js +3 -3
- package/lib/interfaces/gherkin.js +21 -2
- package/lib/output.js +1 -1
- package/lib/pause.js +6 -5
- package/lib/plugin/autoLogin.js +35 -8
- package/lib/plugin/heal.js +40 -7
- package/lib/plugin/retryTo.js +0 -2
- package/lib/plugin/tryTo.js +0 -3
- package/lib/recorder.js +12 -5
- package/lib/session.js +1 -1
- package/package.json +24 -17
- package/translations/de-DE.js +5 -0
- package/translations/fr-FR.js +14 -1
- package/translations/it-IT.js +1 -0
- package/translations/ja-JP.js +5 -0
- package/translations/pl-PL.js +5 -0
- package/translations/pt-BR.js +1 -0
- package/translations/ru-RU.js +1 -0
- package/translations/zh-CN.js +5 -0
- package/translations/zh-TW.js +5 -0
- package/typings/promiseBasedTypes.d.ts +905 -863
- package/typings/types.d.ts +909 -850
|
@@ -4,4 +4,4 @@ Checks that the current page contains the given string in its raw source code.
|
|
|
4
4
|
I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
5
5
|
```
|
|
6
6
|
@param {string} text value to check.
|
|
7
|
-
|
|
7
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -8,4 +8,4 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
8
8
|
|
|
9
9
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
10
10
|
@param {number} num number of elements.
|
|
11
|
-
|
|
11
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
7
7
|
|
|
8
8
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {number} num number of elements.
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -6,4 +6,4 @@ I.seeTextEquals('text', 'h1');
|
|
|
6
6
|
|
|
7
7
|
@param {string} text element value to check.
|
|
8
8
|
@param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
9
|
-
|
|
9
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -18,4 +18,4 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
18
18
|
```
|
|
19
19
|
@param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
20
20
|
@param {string|Array<*>} option visible text or value of option.
|
|
21
|
-
|
|
21
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -9,4 +9,4 @@ I.setGeoLocation(121.21, 11.56, 10);
|
|
|
9
9
|
@param {number} latitude to set.
|
|
10
10
|
@param {number} longitude to set
|
|
11
11
|
@param {number=} altitude (optional, null by default) to set
|
|
12
|
-
|
|
12
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -6,4 +6,4 @@ I.switchTo(); // switch back to main page
|
|
|
6
6
|
```
|
|
7
7
|
|
|
8
8
|
@param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
9
|
-
|
|
9
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.switchToNextTab(2);
|
|
|
7
7
|
|
|
8
8
|
@param {number} [num] (optional) number of tabs to switch forward, default: 1.
|
|
9
9
|
@param {number | null} [sec] (optional) time in seconds to wait.
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.switchToPreviousTab(2);
|
|
|
7
7
|
|
|
8
8
|
@param {number} [num] (optional) number of tabs to switch backward, default: 1.
|
|
9
9
|
@param {number?} [sec] (optional) time in seconds to wait.
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -18,4 +18,4 @@ I.type(secret('123456'));
|
|
|
18
18
|
|
|
19
19
|
@param {string|string[]} key or array of keys to type.
|
|
20
20
|
@param {?number} [delay=null] (optional) delay in ms between key presses
|
|
21
|
-
|
|
21
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -10,4 +10,4 @@ I.uncheckOption('agree', '//form');
|
|
|
10
10
|
```
|
|
11
11
|
@param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
12
12
|
@param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
13
|
-
|
|
13
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -8,4 +8,4 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
8
8
|
|
|
9
9
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
10
10
|
@param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
11
|
-
|
|
11
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitForDetached('#popup');
|
|
|
7
7
|
|
|
8
8
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -8,4 +8,4 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
8
8
|
|
|
9
9
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
10
10
|
@param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
11
|
-
|
|
11
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -3,4 +3,4 @@ Element can be located by CSS or XPath.
|
|
|
3
3
|
|
|
4
4
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
5
5
|
@param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
6
|
-
|
|
6
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -14,4 +14,4 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
14
14
|
@param {string|function} fn to be executed in browser context.
|
|
15
15
|
@param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
16
16
|
@param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
17
|
-
|
|
17
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitForInvisible('#popup');
|
|
|
7
7
|
|
|
8
8
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -10,4 +10,4 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
10
10
|
@param {string }text to wait for.
|
|
11
11
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
12
12
|
@param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
13
|
-
|
|
13
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitForValue('//input', "GoodValue");
|
|
|
7
7
|
@param {LocatorOrString} field input field.
|
|
8
8
|
@param {string }value expected value.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitForVisible('#popup');
|
|
|
7
7
|
|
|
8
8
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -6,4 +6,4 @@ I.waitInUrl('/info', 2);
|
|
|
6
6
|
|
|
7
7
|
@param {string} urlPart value to check.
|
|
8
8
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
9
|
-
|
|
9
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
7
7
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
8
8
|
@param {number} num number of elements.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitToHide('#popup');
|
|
|
7
7
|
|
|
8
8
|
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
|
@@ -7,4 +7,4 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
7
7
|
|
|
8
8
|
@param {string} urlPart value to check.
|
|
9
9
|
@param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
10
|
-
|
|
10
|
+
@returns {Promise<void>} automatically synchronized promise through #recorder
|
package/lib/ai.js
CHANGED
|
@@ -16,6 +16,8 @@ const htmlConfig = {
|
|
|
16
16
|
html: {},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const aiInstance = null;
|
|
20
|
+
|
|
19
21
|
class AiAssistant {
|
|
20
22
|
constructor() {
|
|
21
23
|
this.config = config.get('ai', defaultConfig);
|
|
@@ -26,7 +28,10 @@ class AiAssistant {
|
|
|
26
28
|
|
|
27
29
|
this.isEnabled = !!process.env.OPENAI_API_KEY;
|
|
28
30
|
|
|
29
|
-
if (!this.isEnabled)
|
|
31
|
+
if (!this.isEnabled) {
|
|
32
|
+
debug('No OpenAI API key provided. AI assistant is disabled.');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
30
35
|
|
|
31
36
|
const configuration = new Configuration({
|
|
32
37
|
apiKey: process.env.OPENAI_API_KEY,
|
|
@@ -35,13 +40,17 @@ class AiAssistant {
|
|
|
35
40
|
this.openai = new OpenAIApi(configuration);
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
static getInstance() {
|
|
44
|
+
return aiInstance || new AiAssistant();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async setHtmlContext(html) {
|
|
39
48
|
let processedHTML = html;
|
|
40
49
|
|
|
41
50
|
if (this.htmlConfig.simplify) {
|
|
42
51
|
processedHTML = removeNonInteractiveElements(processedHTML, this.htmlConfig);
|
|
43
52
|
}
|
|
44
|
-
if (this.htmlConfig.minify) processedHTML = minifyHtml(processedHTML);
|
|
53
|
+
if (this.htmlConfig.minify) processedHTML = await minifyHtml(processedHTML);
|
|
45
54
|
if (this.htmlConfig.maxLength) processedHTML = splitByChunks(processedHTML, this.htmlConfig.maxLength)[0];
|
|
46
55
|
|
|
47
56
|
debug(processedHTML);
|
package/lib/cli.js
CHANGED
|
@@ -106,7 +106,9 @@ class Cli extends Base {
|
|
|
106
106
|
}
|
|
107
107
|
currentMetaStep = metaSteps;
|
|
108
108
|
output.stepShift = 3 + 2 * shift;
|
|
109
|
-
|
|
109
|
+
if (step.helper.constructor.name !== 'ExpectHelper') {
|
|
110
|
+
output.step(step);
|
|
111
|
+
}
|
|
110
112
|
});
|
|
111
113
|
|
|
112
114
|
event.dispatcher.on(event.step.finished, () => {
|
package/lib/codecept.js
CHANGED
package/lib/command/dryRun.js
CHANGED
|
@@ -20,7 +20,8 @@ module.exports = async function (test, options) {
|
|
|
20
20
|
if (config.plugins) {
|
|
21
21
|
// disable all plugins by default, they can be enabled with -p option
|
|
22
22
|
for (const plugin in config.plugins) {
|
|
23
|
-
|
|
23
|
+
// if `-p all` is passed, then enabling all plugins, otherwise plugins could be enabled by `-p customLocator,commentStep,tryTo`
|
|
24
|
+
config.plugins[plugin].enabled = options.plugins === 'all';
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
package/lib/command/info.js
CHANGED
|
@@ -37,3 +37,27 @@ module.exports = async function (path) {
|
|
|
37
37
|
output.print('Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues');
|
|
38
38
|
output.print('***************************************');
|
|
39
39
|
};
|
|
40
|
+
|
|
41
|
+
module.exports.getMachineInfo = async () => {
|
|
42
|
+
const info = {
|
|
43
|
+
nodeInfo: await envinfo.helpers.getNodeInfo(),
|
|
44
|
+
osInfo: await envinfo.helpers.getOSInfo(),
|
|
45
|
+
cpuInfo: await envinfo.helpers.getCPUInfo(),
|
|
46
|
+
chromeInfo: await envinfo.helpers.getChromeInfo(),
|
|
47
|
+
edgeInfo: await envinfo.helpers.getEdgeInfo(),
|
|
48
|
+
firefoxInfo: await envinfo.helpers.getFirefoxInfo(),
|
|
49
|
+
safariInfo: await envinfo.helpers.getSafariInfo(),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
output.print('***************************************');
|
|
53
|
+
for (const [key, value] of Object.entries(info)) {
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
output.print(`${key}: ${value[1]}`);
|
|
56
|
+
} else {
|
|
57
|
+
output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
output.print('If you need more detailed info, just run this: npx codeceptjs info');
|
|
61
|
+
output.print('***************************************');
|
|
62
|
+
return info;
|
|
63
|
+
};
|
|
@@ -40,8 +40,9 @@ module.exports = async function (workerCount, selectedRuns, options) {
|
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
42
|
if (options.verbose) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
global.debugMode = true;
|
|
44
|
+
const { getMachineInfo } = require('./info');
|
|
45
|
+
await getMachineInfo();
|
|
45
46
|
}
|
|
46
47
|
await workers.bootstrapAll();
|
|
47
48
|
await workers.run();
|
package/lib/command/run.js
CHANGED
|
@@ -30,8 +30,9 @@ module.exports = async function (test, options) {
|
|
|
30
30
|
codecept.loadTests(test);
|
|
31
31
|
|
|
32
32
|
if (options.verbose) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
global.debugMode = true;
|
|
34
|
+
const { getMachineInfo } = require('./info');
|
|
35
|
+
await getMachineInfo();
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
await codecept.run();
|
package/lib/data/context.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = function (context) {
|
|
|
23
23
|
.inject({ current: dataRow.data }));
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
maskSecretInTitle(scenarios);
|
|
26
27
|
return new DataScenarioConfig(scenarios);
|
|
27
28
|
},
|
|
28
29
|
only: {
|
|
@@ -42,6 +43,7 @@ module.exports = function (context) {
|
|
|
42
43
|
.inject({ current: dataRow.data }));
|
|
43
44
|
}
|
|
44
45
|
});
|
|
46
|
+
maskSecretInTitle(scenarios);
|
|
45
47
|
return new DataScenarioConfig(scenarios);
|
|
46
48
|
},
|
|
47
49
|
},
|
|
@@ -71,12 +73,6 @@ function replaceTitle(title, dataRow) {
|
|
|
71
73
|
// it should be printed
|
|
72
74
|
if (Object.prototype.toString.call(dataRow.data) === (Object()).toString()
|
|
73
75
|
&& dataRow.data.toString() !== (Object()).toString()) {
|
|
74
|
-
Object.entries(dataRow.data).forEach(entry => {
|
|
75
|
-
const [key, value] = entry;
|
|
76
|
-
if (value instanceof Secret) {
|
|
77
|
-
dataRow.data[key] = value.getMasked();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
76
|
return `${title} | ${dataRow.data}`;
|
|
81
77
|
}
|
|
82
78
|
|
|
@@ -119,3 +115,15 @@ function detectDataType(dataTable) {
|
|
|
119
115
|
|
|
120
116
|
throw new Error('Invalid data type. Data accepts either: DataTable || generator || Array || function');
|
|
121
117
|
}
|
|
118
|
+
|
|
119
|
+
function maskSecretInTitle(scenarios) {
|
|
120
|
+
scenarios.forEach(scenario => {
|
|
121
|
+
const res = [];
|
|
122
|
+
|
|
123
|
+
scenario.test.title.split(',').forEach(item => {
|
|
124
|
+
res.push(item.replace(/{"_secret":"(.*)"}/, '"*****"'));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
scenario.test.title = res.join(',');
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -309,7 +309,8 @@ class ApiDataFactory extends Helper {
|
|
|
309
309
|
} catch (e) {
|
|
310
310
|
modulePath = path.join(global.codecept_dir, modulePath);
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
// check if the new syntax `export default new Factory()` is used and loads the builder, otherwise loads the module that used old syntax `module.exports = new Factory()`.
|
|
313
|
+
const builder = require(modulePath).default || require(modulePath);
|
|
313
314
|
return builder.build(data, options);
|
|
314
315
|
} catch (err) {
|
|
315
316
|
throw new Error(`Couldn't load factory file from ${modulePath}, check that
|
package/lib/helper/Appium.js
CHANGED
|
@@ -22,7 +22,7 @@ const vendorPrefix = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Appium helper extends [
|
|
25
|
+
* Appium helper extends [Webdriver](http://codecept.io/helpers/WebDriver/) helper.
|
|
26
26
|
* It supports all browser methods and also includes special methods for mobile apps testing.
|
|
27
27
|
* You can use this helper to test Web on desktop and mobile devices and mobile apps.
|
|
28
28
|
*
|
|
@@ -31,7 +31,7 @@ const vendorPrefix = {
|
|
|
31
31
|
* Appium is an open source test automation framework for use with native, hybrid and mobile web apps that implements the WebDriver protocol.
|
|
32
32
|
* It allows you to run Selenium tests on mobile devices and also test native, hybrid and mobile web apps.
|
|
33
33
|
*
|
|
34
|
-
* Download and install [Appium](
|
|
34
|
+
* Download and install [Appium](https://appium.io/docs/en/2.1/)
|
|
35
35
|
*
|
|
36
36
|
* ```sh
|
|
37
37
|
* npm install -g appium
|
|
@@ -43,7 +43,7 @@ const vendorPrefix = {
|
|
|
43
43
|
*
|
|
44
44
|
* This helper should be configured in codecept.conf.ts or codecept.conf.js
|
|
45
45
|
*
|
|
46
|
-
* * `appiumV2`: set this to true if you want to run tests with
|
|
46
|
+
* * `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
|
|
47
47
|
* * `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage
|
|
48
48
|
* * `host`: (default: 'localhost') Appium host
|
|
49
49
|
* * `port`: (default: '4723') Appium port
|
|
@@ -117,7 +117,7 @@ const vendorPrefix = {
|
|
|
117
117
|
* }
|
|
118
118
|
* ```
|
|
119
119
|
*
|
|
120
|
-
* Example Android App using
|
|
120
|
+
* Example Android App using AppiumV2 on BrowserStack:
|
|
121
121
|
*
|
|
122
122
|
* ```js
|
|
123
123
|
* {
|
|
@@ -154,7 +154,7 @@ const vendorPrefix = {
|
|
|
154
154
|
* }
|
|
155
155
|
* ```
|
|
156
156
|
*
|
|
157
|
-
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/
|
|
157
|
+
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md>
|
|
158
158
|
*
|
|
159
159
|
* ## Access From Helpers
|
|
160
160
|
*
|
|
@@ -273,6 +273,8 @@ class Appium extends Webdriver {
|
|
|
273
273
|
if (!key.startsWith(vendorPrefix.appium)) {
|
|
274
274
|
if (key !== 'platformName') {
|
|
275
275
|
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
|
|
276
|
+
} else {
|
|
277
|
+
_convertedCaps[`${key}`] = value;
|
|
276
278
|
}
|
|
277
279
|
} else {
|
|
278
280
|
_convertedCaps[`${key}`] = value;
|