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/build/FileSystem.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
const assert = require('assert');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
1
5
|
const Helper = require('../helper');
|
|
2
6
|
const fileExists = require('../utils').fileExists;
|
|
3
7
|
const fileIncludes = require('../assert/include').fileIncludes;
|
|
4
8
|
const fileEquals = require('../assert/equal').fileEquals;
|
|
5
|
-
const assert = require('assert');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const fs = require('fs');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Helper for testing filesystem.
|
|
@@ -33,6 +34,7 @@ class FileSystem extends Helper {
|
|
|
33
34
|
/**
|
|
34
35
|
* Enters a directory In local filesystem.
|
|
35
36
|
* Starts from a current directory
|
|
37
|
+
* @param {string} openPath
|
|
36
38
|
*/
|
|
37
39
|
amInPath(openPath) {
|
|
38
40
|
this.dir = path.join(global.codecept_dir, openPath);
|
|
@@ -41,6 +43,8 @@ class FileSystem extends Helper {
|
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Writes test to file
|
|
46
|
+
* @param {string} name
|
|
47
|
+
* @param {string} text
|
|
44
48
|
*/
|
|
45
49
|
writeToFile(name, text) {
|
|
46
50
|
fs.writeFileSync(path.join(this.dir, name), text);
|
|
@@ -48,6 +52,7 @@ class FileSystem extends Helper {
|
|
|
48
52
|
|
|
49
53
|
/**
|
|
50
54
|
* Checks that file exists
|
|
55
|
+
* @param {string} name
|
|
51
56
|
*/
|
|
52
57
|
seeFile(name) {
|
|
53
58
|
this.file = path.join(this.dir, name);
|
|
@@ -55,8 +60,27 @@ class FileSystem extends Helper {
|
|
|
55
60
|
assert.ok(fileExists(this.file), `File ${name} not found in ${this.dir}`);
|
|
56
61
|
}
|
|
57
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Checks that file with a name including given text exists in the current directory.
|
|
65
|
+
*
|
|
66
|
+
*```js
|
|
67
|
+
* I.handleDownloads();
|
|
68
|
+
* I.click('Download as PDF');
|
|
69
|
+
* I.amInPath('output/downloads');
|
|
70
|
+
* I.seeFileNameMatching('.pdf');
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
seeFileNameMatching(text) {
|
|
74
|
+
assert.ok(
|
|
75
|
+
this.grabFileNames().some(file => file.includes(text)),
|
|
76
|
+
`File name which contains ${text} not found in ${this.dir}`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
58
80
|
/**
|
|
59
81
|
* Checks that file found by `seeFile` includes a text.
|
|
82
|
+
* @param {string} text
|
|
83
|
+
* @param {string} encoding
|
|
60
84
|
*/
|
|
61
85
|
seeInThisFile(text, encoding) {
|
|
62
86
|
const content = getFileContents(this.file, encoding);
|
|
@@ -65,6 +89,8 @@ class FileSystem extends Helper {
|
|
|
65
89
|
|
|
66
90
|
/**
|
|
67
91
|
* Checks that file found by `seeFile` doesn't include text.
|
|
92
|
+
* @param {string} text
|
|
93
|
+
* @param {string} encoding
|
|
68
94
|
*/
|
|
69
95
|
dontSeeInThisFile(text, encoding) {
|
|
70
96
|
const content = getFileContents(this.file, encoding);
|
|
@@ -73,6 +99,8 @@ class FileSystem extends Helper {
|
|
|
73
99
|
|
|
74
100
|
/**
|
|
75
101
|
* Checks that contents of file found by `seeFile` equal to text.
|
|
102
|
+
* @param {string} text
|
|
103
|
+
* @param {string} encoding
|
|
76
104
|
*/
|
|
77
105
|
seeFileContentsEqual(text, encoding) {
|
|
78
106
|
const content = getFileContents(this.file, encoding);
|
|
@@ -81,11 +109,28 @@ class FileSystem extends Helper {
|
|
|
81
109
|
|
|
82
110
|
/**
|
|
83
111
|
* Checks that contents of file found by `seeFile` doesn't equal to text.
|
|
112
|
+
* @param {string} text
|
|
113
|
+
* @param {string} encoding
|
|
84
114
|
*/
|
|
85
115
|
dontSeeFileContentsEqual(text, encoding) {
|
|
86
116
|
const content = getFileContents(this.file, encoding);
|
|
87
117
|
fileEquals(this.file).negate(text, content);
|
|
88
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns file names in current directory.
|
|
122
|
+
*
|
|
123
|
+
* ```js
|
|
124
|
+
* I.handleDownloads();
|
|
125
|
+
* I.click('Download Files');
|
|
126
|
+
* I.amInPath('output/downloads');
|
|
127
|
+
* const downloadedFileNames = I.grabFileNames();
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
grabFileNames() {
|
|
131
|
+
return fs.readdirSync(this.dir)
|
|
132
|
+
.filter(item => !fs.lstatSync(path.join(this.dir, item)).isDirectory());
|
|
133
|
+
}
|
|
89
134
|
}
|
|
90
135
|
|
|
91
136
|
function getFileContents(file, encoding) {
|
package/docs/build/GraphQL.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const Helper = require('../helper');
|
|
2
1
|
const requireg = require('requireg');
|
|
3
2
|
|
|
3
|
+
const Helper = require('../helper');
|
|
4
|
+
|
|
4
5
|
let axios = requireg('axios');
|
|
5
6
|
let headers = {};
|
|
6
7
|
|
|
@@ -49,7 +50,7 @@ class GraphQL extends Helper {
|
|
|
49
50
|
endpoint: '',
|
|
50
51
|
};
|
|
51
52
|
this.options = Object.assign(this.options, config);
|
|
52
|
-
headers =
|
|
53
|
+
headers = { ...this.options.defaultHeaders };
|
|
53
54
|
axios.defaults.headers = this.options.defaultHeaders;
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
let addMochawesomeContext;
|
|
2
2
|
let currentTest;
|
|
3
3
|
let currentSuite;
|
|
4
|
+
|
|
5
|
+
const requireg = require('requireg');
|
|
6
|
+
|
|
4
7
|
const Helper = require('../helper');
|
|
5
8
|
const clearString = require('../utils').clearString;
|
|
6
|
-
const requireg = require('requireg');
|
|
7
|
-
const path = require('path');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Mochawesome extends Helper {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const Helper = require('../helper');
|
|
2
1
|
const requireg = require('requireg');
|
|
2
|
+
|
|
3
|
+
const Helper = require('../helper');
|
|
3
4
|
const { appendBaseUrl } = require('../utils');
|
|
4
5
|
const pollyWebDriver = require('./clientscripts/PollyWebDriverExt');
|
|
5
6
|
|
|
@@ -32,7 +33,22 @@ let PollyJS;
|
|
|
32
33
|
* MockRequest: {}
|
|
33
34
|
* }
|
|
34
35
|
* ```
|
|
35
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* > Partially works with WebDriver helper
|
|
38
|
+
*
|
|
39
|
+
* [Polly config options](https://netflix.github.io/pollyjs/#/configuration?id=configuration) can be passed as well:
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* // enable replay mode
|
|
43
|
+
* helpers: {
|
|
44
|
+
* Puppeteer: {
|
|
45
|
+
* // regular Puppeteer config here
|
|
46
|
+
* },
|
|
47
|
+
* MockRequest: {
|
|
48
|
+
* mode: 'replay',
|
|
49
|
+
* },
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
36
52
|
*
|
|
37
53
|
* ### Usage
|
|
38
54
|
*
|
|
@@ -101,13 +117,15 @@ class MockRequest extends Helper {
|
|
|
101
117
|
}
|
|
102
118
|
await page.setRequestInterception(true);
|
|
103
119
|
|
|
104
|
-
|
|
120
|
+
const defaultConfig = {
|
|
105
121
|
mode: 'passthrough',
|
|
106
122
|
adapters: ['puppeteer'],
|
|
107
123
|
adapterOptions: {
|
|
108
124
|
puppeteer: { page },
|
|
109
125
|
},
|
|
110
|
-
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
this.polly = new PollyJS(title, { ...defaultConfig, ...this.options });
|
|
111
129
|
}
|
|
112
130
|
|
|
113
131
|
/**
|
|
@@ -140,7 +158,7 @@ class MockRequest extends Helper {
|
|
|
140
158
|
* I.mockRequest('GET', ['/secrets', '/v2/secrets'], 403);
|
|
141
159
|
* ```
|
|
142
160
|
* @param {string} method request method. Can be `GET`, `POST`, `PUT`, etc or `ANY`.
|
|
143
|
-
* @param {string|
|
|
161
|
+
* @param {string|string[]} oneOrMoreUrls url(s) to mock. Can be exact URL, a pattern, or an array of URLs.
|
|
144
162
|
* @param {number|string|object} dataOrStatusCode status code when number provided. A response body otherwise
|
|
145
163
|
* @param {string|object} additionalData response body when a status code is set by previous parameter.
|
|
146
164
|
*
|