codeceptjs 3.5.10 → 3.5.11

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.
@@ -1104,8 +1104,9 @@ class WebDriver extends Helper {
1104
1104
  }
1105
1105
 
1106
1106
  /**
1107
- * {{> attachFile }}
1108
1107
  * Appium: not tested
1108
+ *
1109
+ * {{> attachFile }}
1109
1110
  */
1110
1111
  async attachFile(locator, pathToFile) {
1111
1112
  let file = path.join(global.codecept_dir, pathToFile);
@@ -1132,8 +1133,8 @@ class WebDriver extends Helper {
1132
1133
  }
1133
1134
 
1134
1135
  /**
1135
- * {{> checkOption }}
1136
1136
  * Appium: not tested
1137
+ * {{> checkOption }}
1137
1138
  */
1138
1139
  async checkOption(field, context = null) {
1139
1140
  const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
@@ -1152,8 +1153,8 @@ class WebDriver extends Helper {
1152
1153
  }
1153
1154
 
1154
1155
  /**
1155
- * {{> uncheckOption }}
1156
1156
  * Appium: not tested
1157
+ * {{> uncheckOption }}
1157
1158
  */
1158
1159
  async uncheckOption(field, context = null) {
1159
1160
  const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
@@ -1370,16 +1371,16 @@ class WebDriver extends Helper {
1370
1371
  }
1371
1372
 
1372
1373
  /**
1373
- * {{> seeCheckboxIsChecked }}
1374
1374
  * Appium: not tested
1375
+ * {{> seeCheckboxIsChecked }}
1375
1376
  */
1376
1377
  async seeCheckboxIsChecked(field) {
1377
1378
  return proceedSeeCheckbox.call(this, 'assert', field);
1378
1379
  }
1379
1380
 
1380
1381
  /**
1381
- * {{> dontSeeCheckboxIsChecked }}
1382
1382
  * Appium: not tested
1383
+ * {{> dontSeeCheckboxIsChecked }}
1383
1384
  */
1384
1385
  async dontSeeCheckboxIsChecked(field) {
1385
1386
  return proceedSeeCheckbox.call(this, 'negate', field);
@@ -1606,10 +1607,9 @@ class WebDriver extends Helper {
1606
1607
  }
1607
1608
 
1608
1609
  /**
1609
- * {{> executeScript }}
1610
- *
1611
- *
1612
1610
  * Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
1611
+ *
1612
+ * {{> executeScript }}
1613
1613
  */
1614
1614
  executeScript(...args) {
1615
1615
  return this.browser.execute.apply(this.browser, args);
@@ -1731,11 +1731,8 @@ class WebDriver extends Helper {
1731
1731
  }
1732
1732
 
1733
1733
  /**
1734
+ * Uses Selenium's JSON [cookie format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
1734
1735
  * {{> setCookie }}
1735
- *
1736
- *
1737
- * Uses Selenium's JSON [cookie
1738
- * format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
1739
1736
  */
1740
1737
  async setCookie(cookie) {
1741
1738
  return this.browser.setCookies(cookie);
@@ -1788,7 +1785,7 @@ class WebDriver extends Helper {
1788
1785
  }
1789
1786
 
1790
1787
  /**
1791
- * Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
1788
+ * Dismisses the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`.
1792
1789
  *
1793
1790
  */
1794
1791
  async cancelPopup() {
@@ -1862,9 +1859,9 @@ class WebDriver extends Helper {
1862
1859
  }
1863
1860
 
1864
1861
  /**
1865
- * {{> pressKeyWithKeyNormalization }}
1866
- *
1867
1862
  * _Note:_ In case a text field or textarea is focused be aware that some browsers do not respect active modifier when combining modifier keys with other keys.
1863
+ *
1864
+ * {{> pressKeyWithKeyNormalization }}
1868
1865
  */
1869
1866
  async pressKey(key) {
1870
1867
  const modifiers = [];
@@ -1923,8 +1920,9 @@ class WebDriver extends Helper {
1923
1920
  }
1924
1921
 
1925
1922
  /**
1926
- * {{> resizeWindow }}
1927
1923
  * Appium: not tested in web, in apps doesn't work
1924
+ *
1925
+ * {{> resizeWindow }}
1928
1926
  */
1929
1927
  async resizeWindow(width, height) {
1930
1928
  return this._resizeBrowserWindow(this.browser, width, height);
@@ -1976,8 +1974,8 @@ class WebDriver extends Helper {
1976
1974
  }
1977
1975
 
1978
1976
  /**
1979
- * {{> dragAndDrop }}
1980
1977
  * Appium: not tested
1978
+ * {{> dragAndDrop }}
1981
1979
  */
1982
1980
  async dragAndDrop(srcElement, destElement) {
1983
1981
  let sourceEl = await this._locate(srcElement);
@@ -0,0 +1,38 @@
1
+ async function findReact(matcher, locator) {
2
+ let _locator = `_react=${locator.react}`;
3
+ let props = '';
4
+
5
+ if (locator.props) {
6
+ props += propBuilder(locator.props);
7
+ _locator += props;
8
+ }
9
+ return matcher.locator(_locator).all();
10
+ }
11
+
12
+ async function findVue(matcher, locator) {
13
+ let _locator = `_vue=${locator.vue}`;
14
+ let props = '';
15
+
16
+ if (locator.props) {
17
+ props += propBuilder(locator.props);
18
+ _locator += props;
19
+ }
20
+ return matcher.locator(_locator).all();
21
+ }
22
+
23
+ function propBuilder(props) {
24
+ let _props = '';
25
+
26
+ for (const [key, value] of Object.entries(props)) {
27
+ if (typeof value === 'object') {
28
+ for (const [k, v] of Object.entries(value)) {
29
+ _props += `[${key}.${k} = "${v}"]`;
30
+ }
31
+ } else {
32
+ _props += `[${key} = "${value}"]`;
33
+ }
34
+ }
35
+ return _props;
36
+ }
37
+
38
+ module.exports = { findReact, findVue };
@@ -43,7 +43,7 @@ const defaultConfig = {
43
43
  * * `factor` - The exponential factor to use. Default is 1.5.
44
44
  * * `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000.
45
45
  * * `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity.
46
- * * `randomize` - Randomizes the timeouts by multiplying with a factor between 1 to 2. Default is false.
46
+ * * `randomize` - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false.
47
47
  * * `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes:
48
48
  * * `amOnPage`
49
49
  * * `wait*`
@@ -99,7 +99,7 @@ module.exports = (config) => {
99
99
  config.when = when;
100
100
 
101
101
  event.dispatcher.on(event.step.started, (step) => {
102
- if (container.plugins('tryTo')) return;
102
+ if (process.env.TRY_TO) return;
103
103
 
104
104
  // if a step is ignored - return
105
105
  for (const ignored of config.ignoredSteps) {
@@ -1,5 +1,4 @@
1
1
  const recorder = require('../recorder');
2
- const store = require('../store');
3
2
  const { debug } = require('../output');
4
3
 
5
4
  const defaultConfig = {
@@ -9,7 +8,7 @@ const defaultConfig = {
9
8
  /**
10
9
  *
11
10
  *
12
- * Adds global `tryTo` function inside of which all failed steps won't fail a test but will return true/false.
11
+ * Adds global `tryTo` function in which all failed steps won't fail a test but will return true/false.
13
12
  *
14
13
  * Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
15
14
  *
@@ -47,7 +46,7 @@ const defaultConfig = {
47
46
  * ```js
48
47
  * const assert = require('assert');
49
48
  * ```
50
- * Then use the assert:
49
+ * Then use the assertion:
51
50
  * const result1 = await tryTo(() => I.see('Hello, user'));
52
51
  * const result2 = await tryTo(() => I.seeElement('.welcome'));
53
52
  * assert.ok(result1 && result2, 'Assertions were not succesful');
@@ -70,7 +69,7 @@ const defaultConfig = {
70
69
  * const tryTo = codeceptjs.container.plugins('tryTo');
71
70
  * ```
72
71
  *
73
- */
72
+ */
74
73
  module.exports = function (config) {
75
74
  config = Object.assign(defaultConfig, config);
76
75
 
@@ -84,6 +83,7 @@ function tryTo(callback) {
84
83
  let result = false;
85
84
  return recorder.add('tryTo', () => {
86
85
  recorder.session.start('tryTo');
86
+ process.env.TRY_TO = 'true';
87
87
  callback();
88
88
  recorder.add(() => {
89
89
  result = true;
@@ -98,6 +98,7 @@ function tryTo(callback) {
98
98
  return result;
99
99
  });
100
100
  return recorder.add('result', () => {
101
+ process.env.TRY_TO = undefined;
101
102
  return result;
102
103
  }, true, false);
103
104
  }, false, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.5.10",
3
+ "version": "3.5.11",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -65,13 +65,13 @@
65
65
  "dependencies": {
66
66
  "@codeceptjs/configure": "0.10.0",
67
67
  "@codeceptjs/helper": "2.0.1",
68
- "@cucumber/cucumber-expressions": "16",
68
+ "@cucumber/cucumber-expressions": "17",
69
69
  "@cucumber/gherkin": "26",
70
70
  "@cucumber/messages": "22.0.0",
71
71
  "@xmldom/xmldom": "0.8.10",
72
72
  "acorn": "8.11.2",
73
73
  "arrify": "2.0.1",
74
- "axios": "1.6.2",
74
+ "axios": "1.6.3",
75
75
  "chai": "4.3.8",
76
76
  "chai-deep-match": "1.2.1",
77
77
  "chai-exclude": "^2.1.0",
@@ -103,7 +103,7 @@
103
103
  "parse-function": "5.6.4",
104
104
  "parse5": "7.1.2",
105
105
  "promise-retry": "1.1.1",
106
- "resq": "1.10.2",
106
+ "resq": "1.11.0",
107
107
  "sprintf-js": "1.1.1",
108
108
  "uuid": "9.0"
109
109
  },
@@ -118,17 +118,17 @@
118
118
  "@types/chai": "^4.3.7",
119
119
  "@types/inquirer": "9.0.3",
120
120
  "@types/node": "20.4.4",
121
- "@wdio/sauce-service": "8.3.8",
121
+ "@wdio/sauce-service": "8.27.0",
122
122
  "@wdio/selenium-standalone-service": "8.3.2",
123
- "@wdio/utils": "8.20.3",
123
+ "@wdio/utils": "8.27.0",
124
124
  "apollo-server-express": "2.25.3",
125
125
  "chai-as-promised": "7.1.1",
126
126
  "chai-subset": "1.6.0",
127
127
  "contributor-faces": "1.1.0",
128
128
  "documentation": "12.3.0",
129
129
  "dtslint": "4.2.1",
130
- "electron": "27.0.4",
131
- "eslint": "8.55.0",
130
+ "electron": "28.0.0",
131
+ "eslint": "8.56.0",
132
132
  "eslint-config-airbnb-base": "15.0.0",
133
133
  "eslint-plugin-import": "2.29.0",
134
134
  "eslint-plugin-mocha": "6.3.0",
@@ -148,17 +148,17 @@
148
148
  "sinon": "17.0.1",
149
149
  "sinon-chai": "3.7.0",
150
150
  "testcafe": "3.3.0",
151
- "ts-morph": "19.0.0",
152
- "ts-node": "10.9.1",
151
+ "ts-morph": "21.0.1",
152
+ "ts-node": "10.9.2",
153
153
  "tsd-jsdoc": "2.5.0",
154
- "typedoc": "0.25.3",
155
- "typedoc-plugin-markdown": "3.13.4",
156
- "typescript": "5.2.2",
154
+ "typedoc": "0.25.4",
155
+ "typedoc-plugin-markdown": "3.17.1",
156
+ "typescript": "5.3.3",
157
157
  "wdio-docker-service": "1.5.0",
158
158
  "webdriverio": "8.3.8",
159
159
  "xml2js": "0.6.2",
160
- "@xmldom/xmldom": "0.7.7",
161
- "xpath": "0.0.33"
160
+ "@xmldom/xmldom": "0.8.10",
161
+ "xpath": "0.0.34"
162
162
  },
163
163
  "engines": {
164
164
  "node": ">=16.0",
@@ -431,7 +431,7 @@ declare namespace CodeceptJS {
431
431
  | string
432
432
  | ILocator
433
433
  | Locator
434
- | CustomLocators[keyof CustomLocators];
434
+ | CustomLocators;
435
435
 
436
436
  type StringOrSecret = string | CodeceptJS.Secret;
437
437