Skip to content

Commit

Permalink
(webdriverio): manage browser drivers (#10767)
Browse files Browse the repository at this point in the history
* (webdriverio): manage browser drivers

* finish driver setup

* add unit tests

* make it work

* allow to run STP

* document new driver option capabilities

* get rid of drivers in docs and elsewhere

* update unit tests

* add missing deps back

* add launcher tests to all pipelines

* fix smoke tests

* cleanups

* fix component tests

* fix unit test

* update test coverage treshold

* add blog post

* fix chrome download process

* fix test

* add deprecation notice

* remove log statement in test

* make fetching Chrome version Windows compatible

* disable test

* fix labeling

* store driver logs

* connect to debuggerAddress at 0.0.0.0

* fix unit test

* limit maxInstances

* skip async iterator test
  • Loading branch information
christian-bromann committed Aug 1, 2023
1 parent 17c69cd commit c6d81b5
Show file tree
Hide file tree
Showing 94 changed files with 2,563 additions and 5,265 deletions.
2 changes: 0 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ RUN if [[ $(dpkg --print-architecture) == "amd64" ]]; then \
RUN npm i -g \
http-server \
diff-so-fancy \
chromedriver@105 \
geckodriver

COPY welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
32 changes: 9 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
env:
DETECT_CHROMEDRIVER_VERSION: true
- name: Bootstrap Packages
run: npm run setup
env:
Expand All @@ -39,9 +37,9 @@ jobs:
- name: Lint / Typings / Unit / Smoke / Component Tests
run: npm run test
- name: Interop Tests
run: |
npm i chromedriver --detect_chromedriver_version
npm run test:e2e:cjs
run: npm run test:e2e:cjs
- name: E2E Launch Tests
run: npm run test:e2e:webdriver
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand All @@ -56,24 +54,22 @@ jobs:
node-version: 18.x
- name: Install Dependencies
run: npm ci
env:
DETECT_CHROMEDRIVER_VERSION: true
- name: Bootstrap Packages
run: npm run setup
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
- name: Lint / Typings / Unit / Smoke / Component Tests
run: npm run test
- name: Setup Chrome Browser
uses: browser-actions/setup-chrome@latest
- name: E2E Protocol Tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 3
command: npm run test:e2e
- name: E2E Edge Launch Tests
run: npm run test:e2e:edge
- name: E2E Launch Tests
run: |
npm run test:e2e:edge
npm run test:e2e:webdriver
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand All @@ -91,8 +87,6 @@ jobs:
node-version: 18.x
- name: Install Dependencies
run: npm ci
env:
DETECT_CHROMEDRIVER_VERSION: true
- name: Bootstrap Packages
run: npm run setup
env:
Expand All @@ -105,16 +99,8 @@ jobs:
command: npm run test:e2e
- name: Safari Component Tests
run: npm run test:component
# Disable Firefox tests due to https://github.com/puppeteer/puppeteer/issues/8923
# - name: Setup Firefox
# uses: browser-actions/setup-firefox@latest
# with:
# firefox-version: latest
# - run: |
# export FIREFOX_BINARY=$(which firefox)
# echo "FIREFOX_BINARY=$FIREFOX_BINARY" >> $GITHUB_ENV
# - name: E2E Firefox Launch Tests
# run: npm run test:e2e:firefox
- name: E2E Launch Tests
run: npm run test:e2e:webdriver
- name: E2E Connection Test
run: npm run test:e2e:cloud
if: github.ref == 'refs/heads/main'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ website/community/Resources.md
scripts/bidi/cddl
browserstack.err
e2e/tailwind.config.js
packages/webdriverio/.chrome
2 changes: 1 addition & 1 deletion .gitpod/dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ RUN \
microsoft-edge-dev

RUN \
npm i -g http-server diff-so-fancy chromedriver@103 geckodriver
npm i -g http-server diff-so-fancy
1 change: 1 addition & 0 deletions @types/custom.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare namespace NodeJS {
interface Process {
private _getActiveHandles(): any[]
_debugProcess: (pid: number) => void
_debugEnd: (pid: number) => void
}
Expand Down
3 changes: 3 additions & 0 deletions e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plugins": ["wdio"],
"env": {
"mocha": true
},
"extends": [
"eslint:recommended",
"plugin:wdio/recommended"
Expand Down
2 changes: 0 additions & 2 deletions e2e/browser-runner/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ if (process.env.CI && process.env.WDIO_PRESET === 'vue' && (isWindows || isMac))

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const browserName = isMac ? 'safari' : 'chrome'
const driver = isMac ? 'safaridriver' : 'chromedriver'
export const config = {
/**
* specify test files
Expand All @@ -40,7 +39,6 @@ export const config = {
framework: 'mocha',
outputDir: path.join(__dirname, 'logs', process.env.WDIO_PRESET),
reporters: ['spec', 'dot', 'junit'],
services: [driver],
runner: ['browser', {
preset: process.env.WDIO_PRESET,
rootDir: path.resolve(__dirname, '..'),
Expand Down
4 changes: 0 additions & 4 deletions e2e/interop/webdriver.e2e.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
const assert = require('node:assert')
const chromedriver = require('chromedriver')
const WebDriver = require('../../packages/webdriver')
const command = require('../../packages/webdriver').command

assert.equal(typeof WebDriver.command, 'function')
assert.equal(typeof command, 'function')

;(async () => {
await chromedriver.start(['--port=4444'])
const client = await WebDriver.newSession({
capabilities: {
browserName: 'chrome',
Expand All @@ -21,12 +19,10 @@ assert.equal(typeof command, 'function')
})().then(
() => {
console.log('WebDriver CJS Test Passed!')
chromedriver.stop()
process.exit(0)
},
(err) => {
console.log('WebDriver CJS Test Failed!', err)
chromedriver.stop()
process.exit(1)
}
)
4 changes: 0 additions & 4 deletions e2e/interop/webdriverio.e2e.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const assert = require('node:assert')
const chromedriver = require('chromedriver')
const { remote } = require('../../packages/webdriverio')

;(async () => {
await chromedriver.start(['--port=4444'])
const client = await remote({
capabilities: {
browserName: 'chrome',
Expand All @@ -17,12 +15,10 @@ const { remote } = require('../../packages/webdriverio')
})().then(
() => {
console.log('WebdriverIO CJS Test Passed!')
chromedriver.stop()
process.exit(0)
},
(err) => {
console.log('WebdriverIO CJS Test Failed!', err)
chromedriver.stop()
process.exit(1)
}
)

0 comments on commit c6d81b5

Please sign in to comment.