codeceptjs 4.0.2 → 4.0.3
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/docs/detox.md +1 -1
- package/lib/element/WebElement.js +7 -4
- package/lib/helper/Appium.js +25 -4
- package/lib/helper/WebDriver.js +1 -1
- package/lib/mocha/asyncWrapper.js +2 -2
- package/lib/mocha/gherkin.js +5 -6
- package/package.json +5 -5
package/docs/detox.md
CHANGED
|
@@ -60,7 +60,7 @@ As you see, CodeceptJS test is shorter and easier to follow. By simplifying the
|
|
|
60
60
|
|
|
61
61
|
## Setup
|
|
62
62
|
|
|
63
|
-
It is important to follow [Detox guide](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) to build an application with Detox test
|
|
63
|
+
It is important to follow [Detox guide](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) to build an application with Detox test instruments included.
|
|
64
64
|
|
|
65
65
|
After you install Detox, create configuration and build an application using `detox build` command, you are ready to integrate Detox with CodeceptJS.
|
|
66
66
|
|
|
@@ -15,10 +15,13 @@ class WebElement {
|
|
|
15
15
|
_detectHelperType(helper) {
|
|
16
16
|
if (!helper) return 'unknown'
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
let ctor = helper.constructor
|
|
19
|
+
while (ctor && ctor.name) {
|
|
20
|
+
if (ctor.name === 'Playwright') return 'playwright'
|
|
21
|
+
if (ctor.name === 'WebDriver') return 'webdriver'
|
|
22
|
+
if (ctor.name === 'Puppeteer') return 'puppeteer'
|
|
23
|
+
ctor = Object.getPrototypeOf(ctor)
|
|
24
|
+
}
|
|
22
25
|
|
|
23
26
|
return 'unknown'
|
|
24
27
|
}
|
package/lib/helper/Appium.js
CHANGED
|
@@ -179,13 +179,13 @@ class Appium extends Webdriver {
|
|
|
179
179
|
super(config)
|
|
180
180
|
|
|
181
181
|
this.isRunning = false
|
|
182
|
-
this.appiumV2 = config.appiumV2
|
|
182
|
+
this.appiumV2 = config.appiumV2 !== false
|
|
183
183
|
this.axios = axios.create()
|
|
184
184
|
|
|
185
|
-
if (
|
|
186
|
-
console.log('
|
|
185
|
+
if (this.appiumV2 === false) {
|
|
186
|
+
console.log('Appium 1.x is no longer maintained by the Appium team (since 2022-01-01).')
|
|
187
187
|
console.log('More info: https://bit.ly/appium-v2-migration')
|
|
188
|
-
console.log('
|
|
188
|
+
console.log('Appium 1.x support will be removed in the next major CodeceptJS release.')
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
@@ -220,6 +220,9 @@ class Appium extends Webdriver {
|
|
|
220
220
|
deprecationWarnings: false,
|
|
221
221
|
restart: true,
|
|
222
222
|
manualStart: false,
|
|
223
|
+
// Mobile emulator/device cold starts (esp. on cloud grids like Sauce Labs)
|
|
224
|
+
// routinely exceed webdriverio's 2-minute default. Bump to 5 min.
|
|
225
|
+
connectionRetryTimeout: 300000, // ms
|
|
223
226
|
timeouts: {
|
|
224
227
|
script: 0, // ms
|
|
225
228
|
},
|
|
@@ -331,6 +334,24 @@ class Appium extends Webdriver {
|
|
|
331
334
|
}
|
|
332
335
|
this.$$ = this.browser.$$.bind(this.browser)
|
|
333
336
|
|
|
337
|
+
// wdio v9 implements `element.isDisplayed()` for non-mobile contexts by
|
|
338
|
+
// injecting a JS visibility check via POST /execute/sync. Appium's native
|
|
339
|
+
// context cannot execute JS, so each call logs an ugly
|
|
340
|
+
// "Method is not implemented" ERROR before the existing catch swallows it.
|
|
341
|
+
// Short-circuit isDisplayed to `true` while in native context so the
|
|
342
|
+
// request is never issued (matches existing _isDisplayedSafe semantics).
|
|
343
|
+
const helper = this
|
|
344
|
+
if (typeof this.browser.overwriteCommand === 'function') {
|
|
345
|
+
this.browser.overwriteCommand(
|
|
346
|
+
'isDisplayed',
|
|
347
|
+
async function (origFn, ...args) {
|
|
348
|
+
if (helper.isWeb) return origFn.call(this, ...args)
|
|
349
|
+
return true
|
|
350
|
+
},
|
|
351
|
+
true,
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
|
|
334
355
|
this.isRunning = true
|
|
335
356
|
if (this.options.timeouts && this.isWeb) {
|
|
336
357
|
await this.defineTimeout(this.options.timeouts)
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -1264,7 +1264,7 @@ class WebDriver extends Helper {
|
|
|
1264
1264
|
const elem = selectElement(res, field, this)
|
|
1265
1265
|
highlightActiveElement.call(this, elem)
|
|
1266
1266
|
|
|
1267
|
-
if (await fillRichEditor(this, elem, value)) {
|
|
1267
|
+
if (this.isWeb !== false && await fillRichEditor(this, elem, value)) {
|
|
1268
1268
|
return
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
@@ -199,7 +199,7 @@ export function setup(suite) {
|
|
|
199
199
|
recorder.startUnlessRunning()
|
|
200
200
|
import('./test.js').then(testModule => {
|
|
201
201
|
const { enhanceMochaTest } = testModule.default || testModule
|
|
202
|
-
event.emit(event.test.before, enhanceMochaTest(suite?.ctx?.currentTest))
|
|
202
|
+
event.emit(event.test.before, enhanceMochaTest(suite?.ctx?.currentTest ?? suite?.currentTest))
|
|
203
203
|
recorder.add(() => doneFn())
|
|
204
204
|
})
|
|
205
205
|
}
|
|
@@ -211,7 +211,7 @@ export function teardown(suite) {
|
|
|
211
211
|
recorder.startUnlessRunning()
|
|
212
212
|
import('./test.js').then(testModule => {
|
|
213
213
|
const { enhanceMochaTest } = testModule.default || testModule
|
|
214
|
-
event.emit(event.test.after, enhanceMochaTest(suite?.ctx?.currentTest))
|
|
214
|
+
event.emit(event.test.after, enhanceMochaTest(suite?.ctx?.currentTest ?? suite?.currentTest))
|
|
215
215
|
recorder.add(() => doneFn())
|
|
216
216
|
})
|
|
217
217
|
}
|
package/lib/mocha/gherkin.js
CHANGED
|
@@ -42,13 +42,12 @@ const gherkinParser = (text, file) => {
|
|
|
42
42
|
suite.file = file
|
|
43
43
|
suite.timeout(0)
|
|
44
44
|
|
|
45
|
-
suite.beforeEach('codeceptjs.before', function () {
|
|
46
|
-
// In Mocha, 'this'
|
|
47
|
-
setup(this)(
|
|
45
|
+
suite.beforeEach('codeceptjs.before', function (done) {
|
|
46
|
+
// In Mocha, 'this' is the hook Context; currentTest is the running scenario
|
|
47
|
+
setup(this)(done)
|
|
48
48
|
})
|
|
49
|
-
suite.afterEach('codeceptjs.after', function () {
|
|
50
|
-
|
|
51
|
-
teardown(this)(() => {})
|
|
49
|
+
suite.afterEach('codeceptjs.after', function (done) {
|
|
50
|
+
teardown(this)(done)
|
|
52
51
|
})
|
|
53
52
|
suite.beforeAll('codeceptjs.beforeSuite', suiteSetup(suite))
|
|
54
53
|
suite.afterAll('codeceptjs.afterSuite', suiteTeardown(suite))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
6
6
|
"keywords": [
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"acorn": "8.15.0",
|
|
101
101
|
"ai": "^6.0.43",
|
|
102
102
|
"arrify": "3.0.0",
|
|
103
|
-
"axios": "1.
|
|
103
|
+
"axios": "1.16.1",
|
|
104
104
|
"chalk": "4.1.2",
|
|
105
105
|
"cheerio": "^1.0.0",
|
|
106
106
|
"chokidar": "^5.0.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"zod": "^4.1.11"
|
|
138
138
|
},
|
|
139
139
|
"optionalDependencies": {
|
|
140
|
-
"@codeceptjs/detox-helper": "1.1.
|
|
140
|
+
"@codeceptjs/detox-helper": "1.1.14"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
143
|
"@apollo/server": "^5",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"@codeceptjs/mock-request": "0.3.1",
|
|
146
146
|
"@eslint/eslintrc": "3.3.3",
|
|
147
147
|
"@eslint/js": "9.39.2",
|
|
148
|
-
"@faker-js/faker": "10.
|
|
148
|
+
"@faker-js/faker": "10.3.0",
|
|
149
149
|
"@inquirer/testing": "^3.0.3",
|
|
150
150
|
"@pollyjs/adapter-puppeteer": "6.0.6",
|
|
151
151
|
"@pollyjs/core": "6.0.6",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"chai-as-promised": "^8.0.2",
|
|
163
163
|
"chai-subset": "1.6.0",
|
|
164
164
|
"documentation": "14.0.3",
|
|
165
|
-
"electron": "40.1
|
|
165
|
+
"electron": "40.2.1",
|
|
166
166
|
"eslint": "^9.36.0",
|
|
167
167
|
"eslint-plugin-import": "2.32.0",
|
|
168
168
|
"eslint-plugin-mocha": "11.2.0",
|