codeceptjs 3.6.2-beta.2 → 3.6.2

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 CHANGED
@@ -46,7 +46,7 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently,
46
46
 
47
47
  * [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
48
48
  * [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
49
- * [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol.
49
+ * [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver or Devtools protocol.
50
50
  * [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation.
51
51
  * [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
52
52
  * [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.
@@ -3115,8 +3115,6 @@ class Playwright extends Helper {
3115
3115
  /**
3116
3116
  * Returns full URL of request matching parameter "urlMatch".
3117
3117
  *
3118
- * @param {string|RegExp} urlMatch Expected URL of request in network traffic. Can be a string or a regular expression.
3119
- *
3120
3118
  * Examples:
3121
3119
  *
3122
3120
  * ```js
@@ -3124,6 +3122,7 @@ class Playwright extends Helper {
3124
3122
  * I.grabTrafficUrl(/session.*start/);
3125
3123
  * ```
3126
3124
  *
3125
+ * @param {string|RegExp} urlMatch Expected URL of request in network traffic. Can be a string or a regular expression.
3127
3126
  * @return {Promise<*>}
3128
3127
  */
3129
3128
  grabTrafficUrl(urlMatch) {
@@ -1795,14 +1795,21 @@ class WebDriver extends Helper {
1795
1795
  * {{> saveScreenshot }}
1796
1796
  */
1797
1797
  async saveScreenshot(fileName, fullPage = false) {
1798
- const outputFile = screenshotOutputFolder(fileName);
1798
+ let outputFile = screenshotOutputFolder(fileName);
1799
1799
 
1800
1800
  if (this.activeSessionName) {
1801
1801
  const browser = this.sessionWindows[this.activeSessionName];
1802
1802
 
1803
- if (browser) {
1804
- this.debug(`Screenshot of ${this.activeSessionName} session has been saved to ${outputFile}`);
1805
- return browser.saveScreenshot(outputFile);
1803
+ for (const sessionName in this.sessionWindows) {
1804
+ const activeSessionPage = this.sessionWindows[sessionName];
1805
+ outputFile = screenshotOutputFolder(`${sessionName}_${fileName}`);
1806
+
1807
+ this.debug(`${sessionName} - Screenshot is saving to ${outputFile}`);
1808
+
1809
+ if (browser) {
1810
+ this.debug(`Screenshot of ${sessionName} session has been saved to ${outputFile}`);
1811
+ return browser.saveScreenshot(outputFile);
1812
+ }
1806
1813
  }
1807
1814
  }
1808
1815
 
@@ -110,7 +110,8 @@ module.exports = function (config) {
110
110
  allureReporter.addAttachment('Main session - Last Seen Screenshot', fs.readFileSync(path.join(global.output_dir, fileName)), dataType);
111
111
 
112
112
  if (helper.activeSessionName) {
113
- for (const sessionName in helper.sessionPages) {
113
+ const sessions = helper.sessionPages || helper.sessionWindows;
114
+ for (const sessionName in sessions) {
114
115
  const screenshotFileName = `${sessionName}_${fileName}`;
115
116
  test.artifacts[`${sessionName.replace(/ /g, '_')}_screenshot`] = path.join(global.output_dir, screenshotFileName);
116
117
  allureReporter.addAttachment(`${sessionName} - Last Seen Screenshot`, fs.readFileSync(path.join(global.output_dir, screenshotFileName)), dataType);
@@ -112,11 +112,13 @@ module.exports = function (config) {
112
112
  });
113
113
 
114
114
  event.dispatcher.on(event.test.failed, (test, err) => {
115
+ // BeforeSuite/AfterSuite don't have any access to the browser, hence it could not take screenshot.
116
+ if (test.ctx._runnable.title.includes('hook: BeforeSuite')) return;
115
117
  persist(test, err);
116
118
  });
117
119
 
118
120
  event.dispatcher.on(event.all.result, () => {
119
- if (!Object.keys(slides).length) return;
121
+ if (Object.keys(recordedTests).length === 0 || !Object.keys(slides).length) return;
120
122
 
121
123
  let links = '';
122
124
 
@@ -148,7 +150,7 @@ module.exports = function (config) {
148
150
  stepNum++;
149
151
  slides[fileName] = step;
150
152
  try {
151
- await helper.saveScreenshot(path.relative(reportDir, path.join(dir, fileName)), config.fullPageScreenshots);
153
+ await helper.saveScreenshot(path.join(dir, fileName), config.fullPageScreenshots);
152
154
  } catch (err) {
153
155
  output.plugin(`Can't save step screenshot: ${err}`);
154
156
  error = err;
package/lib/utils.js CHANGED
@@ -291,7 +291,7 @@ module.exports.screenshotOutputFolder = function (fileName) {
291
291
  const fileSep = path.sep;
292
292
 
293
293
  if (!fileName.includes(fileSep) || fileName.includes('record_')) {
294
- return path.join(global.output_dir, fileName);
294
+ return path.resolve(global.output_dir, fileName);
295
295
  }
296
296
  return path.resolve(global.codecept_dir, fileName);
297
297
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.2-beta.2",
3
+ "version": "3.6.2",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -98,7 +98,7 @@
98
98
  "glob": "6.0.1",
99
99
  "html-minifier-terser": "7.2.0",
100
100
  "inquirer": "6.5.2",
101
- "joi": "17.12.3",
101
+ "joi": "17.13.0",
102
102
  "js-beautify": "1.15.1",
103
103
  "lodash.clonedeep": "4.5.0",
104
104
  "lodash.merge": "4.6.2",
@@ -128,7 +128,7 @@
128
128
  "@types/node": "20.11.30",
129
129
  "@wdio/sauce-service": "8.35.1",
130
130
  "@wdio/selenium-standalone-service": "8.3.2",
131
- "@wdio/utils": "8.33.1",
131
+ "@wdio/utils": "8.36.1",
132
132
  "@xmldom/xmldom": "0.8.10",
133
133
  "apollo-server-express": "2.25.3",
134
134
  "chai-as-promised": "7.1.1",
@@ -164,7 +164,7 @@
164
164
  "typedoc-plugin-markdown": "3.17.1",
165
165
  "typescript": "5.3.3",
166
166
  "wdio-docker-service": "1.5.0",
167
- "webdriverio": "8.35.1",
167
+ "webdriverio": "8.36.1",
168
168
  "xml2js": "0.6.2",
169
169
  "xpath": "0.0.34"
170
170
  },
@@ -179,4 +179,4 @@
179
179
  "strict": false
180
180
  }
181
181
  }
182
- }
182
+ }
@@ -4825,7 +4825,6 @@ declare namespace CodeceptJS {
4825
4825
  stopRecordingTraffic(): Promise<any>;
4826
4826
  /**
4827
4827
  * Returns full URL of request matching parameter "urlMatch".
4828
- * @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
4829
4828
  *
4830
4829
  * Examples:
4831
4830
  *
@@ -4833,6 +4832,7 @@ declare namespace CodeceptJS {
4833
4832
  * I.grabTrafficUrl('https://api.example.com/session');
4834
4833
  * I.grabTrafficUrl(/session.*start/);
4835
4834
  * ```
4835
+ * @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
4836
4836
  */
4837
4837
  grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
4838
4838
  /**
@@ -5076,7 +5076,6 @@ declare namespace CodeceptJS {
5076
5076
  stopRecordingTraffic(): void;
5077
5077
  /**
5078
5078
  * Returns full URL of request matching parameter "urlMatch".
5079
- * @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
5080
5079
  *
5081
5080
  * Examples:
5082
5081
  *
@@ -5084,6 +5083,7 @@ declare namespace CodeceptJS {
5084
5083
  * I.grabTrafficUrl('https://api.example.com/session');
5085
5084
  * I.grabTrafficUrl(/session.*start/);
5086
5085
  * ```
5086
+ * @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
5087
5087
  */
5088
5088
  grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
5089
5089
  /**