Skip to content

Commit b7e4acb

Browse files
author
DavertMik
committed
Merge branch '3.x' into feat/analyze-result
2 parents 843fd50 + 786638c commit b7e4acb

File tree

14 files changed

+85
-867
lines changed

14 files changed

+85
-867
lines changed

.github/workflows/appiumV2_Android.yml renamed to .github/workflows/appium_Android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Appium V2 Tests - Android
1+
name: Appium Tests - Android
22

33
on:
44
push:

.github/workflows/appiumV2_iOS.yml renamed to .github/workflows/appium_iOS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Appium V2 Tests - iOS
1+
name: Appium Tests - iOS
22

33
on:
44
push:

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
## Build Status
77

8-
| Type | Engine | Status |
9-
| --------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10-
| 🌐 Web | Playwright | [![Playwright Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml) |
11-
| 🌐 Web | Puppeteer | [![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) |
12-
| 🌐 Web | WebDriver | [![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) |
13-
| 🌐 Web | TestCafe | [![TestCafe Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml) |
14-
| 📱 Mobile | Appium | [![Appium V2 Tests - Android](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_Android.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_Android.yml) |
8+
| Type | Engine | Status |
9+
| --------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10+
| 🌐 Web | Playwright | [![Playwright Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml) |
11+
| 🌐 Web | Puppeteer | [![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) |
12+
| 🌐 Web | WebDriver | [![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) |
13+
| 🌐 Web | TestCafe | [![TestCafe Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml) |
14+
| 📱 Mobile | Appium | [![Appium Tests - Android](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium_Android.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium_Android.yml) |
1515

1616
# CodeceptJS [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
1717

docs/helpers/Appium.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Launch the daemon: `appium`
3232

3333
This helper should be configured in codecept.conf.ts or codecept.conf.js
3434

35-
* `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here][3]
35+
* `appiumV2`: by default is true, set this to false if you want to run tests with AppiumV1. See more how to setup [here][3]
3636
* `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage
3737
* `host`: (default: 'localhost') Appium host
3838
* `port`: (default: '4723') Appium port
@@ -112,7 +112,7 @@ Example Android App using AppiumV2 on BrowserStack:
112112
{
113113
helpers: {
114114
Appium: {
115-
appiumV2: true,
115+
appiumV2: true, // By default is true, set to false if you want to run against Appium v1
116116
host: "hub-cloud.browserstack.com",
117117
port: 4444,
118118
user: process.env.BROWSERSTACK_USER,

lib/helper/Appium.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const vendorPrefix = {
4444
*
4545
* This helper should be configured in codecept.conf.ts or codecept.conf.js
4646
*
47-
* * `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
47+
* * `appiumV2`: by default is true, set this to false if you want to run tests with AppiumV1. See more how to setup [here](https://codecept.io/mobile/#setting-up)
4848
* * `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage
4949
* * `host`: (default: 'localhost') Appium host
5050
* * `port`: (default: '4723') Appium port
@@ -124,7 +124,7 @@ const vendorPrefix = {
124124
* {
125125
* helpers: {
126126
* Appium: {
127-
* appiumV2: true,
127+
* appiumV2: true, // By default is true, set to false if you want to run against Appium v1
128128
* host: "hub-cloud.browserstack.com",
129129
* port: 4444,
130130
* user: process.env.BROWSERSTACK_USER,
@@ -178,14 +178,12 @@ class Appium extends Webdriver {
178178
super(config)
179179

180180
this.isRunning = false
181-
if (config.appiumV2 === true) {
182-
this.appiumV2 = true
183-
}
181+
this.appiumV2 = config.appiumV2 || true
184182
this.axios = axios.create()
185183

186184
webdriverio = require('webdriverio')
187185
if (!config.appiumV2) {
188-
console.log('The Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. Please migrating to Appium 2.x by adding appiumV2: true to your config.')
186+
console.log('The Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. Appium 2.x is used by default.')
189187
console.log('More info: https://bit.ly/appium-v2-migration')
190188
console.log('This Appium 1.x support will be removed in next major release.')
191189
}

lib/helper/WebDriver.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const { dontSeeTraffic, seeTraffic, grabRecordedNetworkTraffics, stopRecordingTr
2424

2525
const SHADOW = 'shadow'
2626
const webRoot = 'body'
27+
let browserLogs = []
2728

2829
/**
2930
* ## Configuration
@@ -621,6 +622,10 @@ class WebDriver extends Helper {
621622
}
622623

623624
this.browser.on('dialog', () => {})
625+
626+
await this.browser.sessionSubscribe({ events: ['log.entryAdded'] })
627+
this.browser.on('log.entryAdded', logEvents)
628+
624629
return this.browser
625630
}
626631

@@ -658,6 +663,7 @@ class WebDriver extends Helper {
658663
if (!(err.message.indexOf("Storage is disabled inside 'data:' URLs.") > -1)) throw err
659664
})
660665
await this.closeOtherTabs()
666+
browserLogs = []
661667
return this.browser
662668
}
663669

@@ -1522,11 +1528,7 @@ class WebDriver extends Helper {
15221528
* {{> grabBrowserLogs }}
15231529
*/
15241530
async grabBrowserLogs() {
1525-
if (this.browser.isW3C) {
1526-
this.debug('Logs not available in W3C specification')
1527-
return
1528-
}
1529-
return this.browser.getLogs('browser')
1531+
return browserLogs
15301532
}
15311533

15321534
/**
@@ -3141,4 +3143,8 @@ function prepareLocateFn(context) {
31413143
}
31423144
}
31433145

3146+
function logEvents(event) {
3147+
browserLogs.push(event.text) // add log message to the array
3148+
}
3149+
31443150
module.exports = WebDriver

lib/pause.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ function pauseSession(passedObject = {}) {
8484
})
8585
return new Promise(resolve => {
8686
finish = resolve
87-
// eslint-disable-next-line
8887
return askForStep()
8988
})
9089
}
9190

92-
/* eslint-disable */
9391
async function parseInput(cmd) {
9492
rl.pause()
9593
next = false
@@ -198,7 +196,6 @@ async function parseInput(cmd) {
198196
recorder.add('ask for next step', askForStep)
199197
nextStep()
200198
}
201-
/* eslint-enable */
202199

203200
function askForStep() {
204201
return new Promise(resolve => {

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
"test:unit": "mocha test/unit --recursive --timeout 10000",
5151
"test:runner": "mocha test/runner --recursive --timeout 10000",
5252
"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'",
5757
"test-app:start": "php -S 127.0.0.1:8000 -t test/data/app",
5858
"test-app:stop": "kill -9 $(lsof -t -i:8000)",
5959
"test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js",
@@ -94,7 +94,7 @@
9494
"figures": "3.2.0",
9595
"fn-args": "4.0.0",
9696
"fs-extra": "11.2.0",
97-
"glob": "^11.0.0",
97+
"glob": "^11.0.1",
9898
"fuse.js": "^7.0.0",
9999
"html-minifier-terser": "7.2.0",
100100
"inquirer": "6.5.2",
@@ -113,7 +113,7 @@
113113
"promise-retry": "1.1.1",
114114
"resq": "1.11.0",
115115
"sprintf-js": "1.1.3",
116-
"uuid": "11.0.4"
116+
"uuid": "11.0.5"
117117
},
118118
"optionalDependencies": {
119119
"@codeceptjs/detox-helper": "1.1.5"
@@ -124,22 +124,22 @@
124124
"@codeceptjs/mock-request": "0.3.1",
125125
"@eslint/eslintrc": "3.2.0",
126126
"@eslint/js": "9.18.0",
127-
"@faker-js/faker": "9.3.0",
127+
"@faker-js/faker": "9.4.0",
128128
"@pollyjs/adapter-puppeteer": "6.0.6",
129129
"@pollyjs/core": "5.1.0",
130130
"@types/chai": "4.3.19",
131131
"@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",
134134
"@wdio/selenium-standalone-service": "8.15.0",
135135
"@wdio/utils": "9.5.0",
136136
"@xmldom/xmldom": "0.9.6",
137137
"chai": "^4.0.0",
138138
"chai-as-promised": "7.1.2",
139139
"chai-subset": "1.6.0",
140140
"documentation": "14.0.3",
141-
"electron": "33.3.1",
142-
"eslint": "^9.17.0",
141+
"electron": "34.0.0",
142+
"eslint": "^9.18.0",
143143
"eslint-plugin-import": "2.31.0",
144144
"eslint-plugin-mocha": "10.5.0",
145145
"expect": "29.7.0",

test/helper/AppiumV2Web_test.js

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)