codeceptjs 3.7.0-beta.5 → 3.7.0-beta.7

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.
@@ -1,115 +1,17 @@
1
- const recorder = require('../recorder')
2
- const { debug } = require('../output')
1
+ module.exports = function () {
2
+ console.log(`
3
+ Deprecated Warning: 'tryTo' has been moved to the effects module.
4
+ You should update your tests to use it as follows:
3
5
 
4
- const defaultConfig = {
5
- registerGlobal: true,
6
- }
7
-
8
- /**
9
- *
10
- *
11
- * Adds global `tryTo` function in which all failed steps won't fail a test but will return true/false.
12
- *
13
- * Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
14
- *
15
- * ```js
16
- * plugins: {
17
- * tryTo: {
18
- * enabled: true
19
- * }
20
- * }
21
- * ```
22
- * Use it in your tests:
23
- *
24
- * ```js
25
- * const result = await tryTo(() => I.see('Welcome'));
26
- *
27
- * // if text "Welcome" is on page, result => true
28
- * // if text "Welcome" is not on page, result => false
29
- * ```
30
- *
31
- * Disables retryFailedStep plugin for steps inside a block;
32
- *
33
- * Use this plugin if:
34
- *
35
- * * you need to perform multiple assertions inside a test
36
- * * there is A/B testing on a website you test
37
- * * there is "Accept Cookie" banner which may surprisingly appear on a page.
38
- *
39
- * #### Usage
40
- *
41
- * #### Multiple Conditional Assertions
42
- *
43
- * ```js
44
- *
45
- * Add assert requires first:
46
- * ```js
47
- * const assert = require('assert');
48
- * ```
49
- * Then use the assertion:
50
- * const result1 = await tryTo(() => I.see('Hello, user'));
51
- * const result2 = await tryTo(() => I.seeElement('.welcome'));
52
- * assert.ok(result1 && result2, 'Assertions were not succesful');
53
- * ```
54
- *
55
- * ##### Optional click
56
- *
57
- * ```js
58
- * I.amOnPage('/');
59
- * tryTo(() => I.click('Agree', '.cookies'));
60
- * ```
61
- *
62
- * #### Configuration
63
- *
64
- * * `registerGlobal` - to register `tryTo` function globally, true by default
65
- *
66
- * If `registerGlobal` is false you can use tryTo from the plugin:
67
- *
68
- * ```js
69
- * const tryTo = codeceptjs.container.plugins('tryTo');
70
- * ```
71
- *
72
- */
73
- module.exports = function (config) {
74
- config = Object.assign(defaultConfig, config)
6
+ \`\`\`javascript
7
+ const { tryTo } = require('codeceptjs/effects');
75
8
 
76
- if (config.registerGlobal) {
77
- global.tryTo = tryTo
78
- }
79
- return tryTo
80
- }
9
+ // Example: failed step won't fail a test but will return true/false
10
+ await tryTo(() => {
11
+ I.switchTo('#editor frame');
12
+ });
13
+ \`\`\`
81
14
 
82
- function tryTo(callback) {
83
- let result = false
84
- return recorder.add(
85
- 'tryTo',
86
- () => {
87
- recorder.session.start('tryTo')
88
- process.env.TRY_TO = 'true'
89
- callback()
90
- recorder.add(() => {
91
- result = true
92
- recorder.session.restore('tryTo')
93
- return result
94
- })
95
- recorder.session.catch(err => {
96
- result = false
97
- const msg = err.inspect ? err.inspect() : err.toString()
98
- debug(`Unsuccessful try > ${msg}`)
99
- recorder.session.restore('tryTo')
100
- return result
101
- })
102
- return recorder.add(
103
- 'result',
104
- () => {
105
- process.env.TRY_TO = undefined
106
- return result
107
- },
108
- true,
109
- false,
110
- )
111
- },
112
- false,
113
- false,
114
- )
15
+ For more details, refer to the documentation.
16
+ `)
115
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.0-beta.5",
3
+ "version": "3.7.0-beta.7",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -50,10 +50,10 @@
50
50
  "test:unit": "mocha test/unit --recursive --timeout 10000",
51
51
  "test:runner": "mocha test/runner --recursive --timeout 10000",
52
52
  "test": "npm run test:unit && npm run test:runner",
53
- "test:appium-quick": "mocha test/helper/AppiumV2_test.js --grep 'quick'",
54
- "test:appium-other": "mocha test/helper/AppiumV2_test.js --grep 'second'",
55
- "test:ios:appium-quick": "mocha test/helper/AppiumV2_ios_test.js --grep 'quick'",
56
- "test:ios:appium-other": "mocha test/helper/AppiumV2_ios_test.js --grep 'second'",
53
+ "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
54
+ "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
55
+ "test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick'",
56
+ "test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second'",
57
57
  "test-app:start": "php -S 127.0.0.1:8000 -t test/data/app",
58
58
  "test-app:stop": "kill -9 $(lsof -t -i:8000)",
59
59
  "test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js",
@@ -94,7 +94,7 @@
94
94
  "figures": "3.2.0",
95
95
  "fn-args": "4.0.0",
96
96
  "fs-extra": "11.2.0",
97
- "glob": "^11.0.0",
97
+ "glob": ">=9.0.0",
98
98
  "fuse.js": "^7.0.0",
99
99
  "html-minifier-terser": "7.2.0",
100
100
  "inquirer": "6.5.2",
@@ -113,7 +113,7 @@
113
113
  "promise-retry": "1.1.1",
114
114
  "resq": "1.11.0",
115
115
  "sprintf-js": "1.1.3",
116
- "uuid": "11.0.4"
116
+ "uuid": "11.0.5"
117
117
  },
118
118
  "optionalDependencies": {
119
119
  "@codeceptjs/detox-helper": "1.1.5"
@@ -124,13 +124,13 @@
124
124
  "@codeceptjs/mock-request": "0.3.1",
125
125
  "@eslint/eslintrc": "3.2.0",
126
126
  "@eslint/js": "9.18.0",
127
- "@faker-js/faker": "9.3.0",
127
+ "@faker-js/faker": "9.4.0",
128
128
  "@pollyjs/adapter-puppeteer": "6.0.6",
129
129
  "@pollyjs/core": "5.1.0",
130
130
  "@types/chai": "4.3.19",
131
131
  "@types/inquirer": "9.0.7",
132
- "@types/node": "22.10.5",
133
- "@wdio/sauce-service": "9.5.1",
132
+ "@types/node": "22.10.7",
133
+ "@wdio/sauce-service": "9.5.7",
134
134
  "@wdio/selenium-standalone-service": "8.15.0",
135
135
  "@wdio/utils": "9.5.0",
136
136
  "@xmldom/xmldom": "0.9.6",
@@ -138,8 +138,8 @@
138
138
  "chai-as-promised": "7.1.2",
139
139
  "chai-subset": "1.6.0",
140
140
  "documentation": "14.0.3",
141
- "electron": "33.2.1",
142
- "eslint": "^9.17.0",
141
+ "electron": "34.0.0",
142
+ "eslint": "^9.18.0",
143
143
  "eslint-plugin-import": "2.31.0",
144
144
  "eslint-plugin-mocha": "10.5.0",
145
145
  "expect": "29.7.0",
@@ -154,7 +154,7 @@
154
154
  "json-server": "0.17.4",
155
155
  "playwright": "1.49.1",
156
156
  "prettier": "^3.3.2",
157
- "puppeteer": "23.11.1",
157
+ "puppeteer": "24.0.0",
158
158
  "qrcode-terminal": "0.12.0",
159
159
  "rosie": "2.1.1",
160
160
  "runok": "0.9.3",