Skip to content

Commit

Permalink
feat: wdio v8 enablement (#498)
Browse files Browse the repository at this point in the history
fixes #384 and solves https://github.com/orgs/ui5-community/projects/2?pane=issue&itemId=18873623

---------

Co-authored-by: dominikfeininger <[email protected]>
Co-authored-by: Simon Coen <[email protected]>
  • Loading branch information
3 people committed Jul 3, 2023
1 parent a4f7ef9 commit ee5e2c4
Show file tree
Hide file tree
Showing 105 changed files with 16,873 additions and 50,182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: "CodeQL"
on:
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
branches: [main, main-v2]
schedule:
- cron: "43 16 * * 4"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
- run: npm run build
- uses: ncipollo/release-action@v1
with:
artifacts: "dist/**/*,client-side-js/**/*"
artifacts: "cjs/**/*,esm/**/*,client-side-js/**/*"
bodyFile: "CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ on:
push:
branches:
- main
- main-v2
pull_request:
branches:
- main
- main-v2

jobs:
run-linters:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wdi5-tests_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- main-v2
paths:
# relevant
- "client-side-js/**"
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/wdi5-tests_fe-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- main-v2
paths:
# relevant
- "client-side-js/**"
Expand All @@ -19,21 +20,21 @@ on:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: macos-latest

strategy:
matrix:
node-version: [16, 18, 19, 20]

steps:
- name: update chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
# check chrome version
google-chrome --version
# - name: update chrome
# run: |
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# sudo apt-get update
# sudo apt-get --only-upgrade install google-chrome-stable
# # check chrome version
# google-chrome --version

- name: check out repo
uses: actions/checkout@v3
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/wdi5-tests_js-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches:
- main
- main-v2

paths:
# relevant
- "client-side-js/**"
Expand All @@ -20,21 +22,21 @@ on:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: macos-latest

strategy:
matrix:
node-version: [16, 18, 19, 20]

steps:
- name: update chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
# check chrome version
google-chrome --version
# - name: update chrome
# run: |
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# sudo apt-get update
# sudo apt-get --only-upgrade install google-chrome-stable
# # check chrome version
# google-chrome --version

- name: check out repo
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wdi5-tests_ts-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
- main-v2
paths:
# relevant
- "client-side-js/**"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ typings/
.idea

# don't include build artifacts
cjs/**/*
esm/**/*
dist/**/*

# Gitkeep generally
Expand Down
3 changes: 2 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extension": ["ts"],
"spec": "test/**/*.test.ts",
"require": "ts-node/register"
"require": "ts-node/register",
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm"]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
9 changes: 9 additions & 0 deletions .retrofit-pkg-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// transmogrifying wdi5's package.json to a cjs version
import { promises as fs } from "fs"
import pkgJson from "./package.json" assert { type: "json" }
;["type", "exports", "types", "files", "workspaces", "scripts", "lint-staged"].forEach((section) => {
delete pkgJson[section]
})
;(async () => {
await fs.writeFile("./cjs/package.json", JSON.stringify(pkgJson, null, 2))
})()
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js"
}
19 changes: 19 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# migrating to `wdi5` 2.x

Version >= 2 of `wdi5` are WebdriverIO v8 compatible. This entails a move to ESM as primary module, with CJS compatibility ensured.

## check file sys dir references in your test code

dir references start from the dir the file is in now,
not from `cwd`

```diff
const _config = {
wdi5: {
skipInjectUI5OnStart: true
},
- specs: [join("webapp", "test", "e2e", "ui5-late.test.js")],
+ specs: [join("..", "webapp", "test", "e2e", "ui5-late.test.js")],
baseUrl: "https://github.com/ui5-community/wdi5/"
}
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions docker/package-standalone.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
},
"devDependencies": {
"@ui5/cli": "latest",
"@wdio/cli": "^7",
"@wdio/mocha-framework": "^7",
"@wdio/spec-reporter": "^7",
"@wdio/cli": "^8",
"@wdio/mocha-framework": "^8",
"@wdio/spec-reporter": "^8",
"chromedriver": "latest",
"@wdio/local-runner": "^7",
"@wdio/local-runner": "^8",
"fs-extra": "^10.1.0",
"mocha": "^9.2.2",
"npm-run-all": "^4.1.5",
"ui5-middleware-simpleproxy": "latest",
"wait-on": "^6.0.1",
"wdio-chromedriver-service": "^7",
"wdio-chromedriver-service": "^8",
"wdio-ui5-service": "latest",
"webdriverio": "^7"
"webdriverio": "^8"
},
"ui5": {
"dependencies": ["ui5-middleware-simpleproxy"]
Expand Down
12 changes: 6 additions & 6 deletions docker/package-wdi5-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
"test:docker:standalone": "run-p start test:standalone"
},
"devDependencies": {
"@wdio/cli": "^7.19.1",
"@wdio/mocha-framework": "^7.19.1",
"@wdio/spec-reporter": "^7.19.1",
"@wdio/cli": "^8",
"@wdio/mocha-framework": "^8",
"@wdio/spec-reporter": "^8",
"chromedriver": "latest",
"@wdio/local-runner": "^7.19.1",
"@wdio/local-runner": "^8",
"fs-extra": "^10.0.1",
"mocha": "^9.2.2",
"npm-run-all": "^4.1.5",
"soerver": "^0.0.3",
"wait-on": "^6.0.1",
"wdio-chromedriver-service": "^7",
"wdio-chromedriver-service": "^8",
"wdio-ui5-service": "file:wdio-ui5-service",
"webdriverio": "^7.19.1"
"webdriverio": "^8"
},
"engines": {
"node": ">=14",
Expand Down
12 changes: 6 additions & 6 deletions docker/package-wdi5.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
"test:docker:standalone": "run-p start test:standalone"
},
"devDependencies": {
"@wdio/cli": "^7.19.1",
"@wdio/mocha-framework": "^7.19.1",
"@wdio/spec-reporter": "^7.19.1",
"@wdio/cli": "^8",
"@wdio/mocha-framework": "^8",
"@wdio/spec-reporter": "^8",
"chromedriver": "latest",
"@wdio/local-runner": "^7.19.1",
"@wdio/local-runner": "^8",
"fs-extra": "^10.0.1",
"mocha": "^9.2.2",
"npm-run-all": "^4.1.5",
"soerver": "^0.0.3",
"wait-on": "^6.0.1",
"wdio-chromedriver-service": "^7",
"wdio-chromedriver-service": "^8",
"wdio-ui5-service": "*",
"webdriverio": "^7.19.1"
"webdriverio": "^8"
},
"engines": {
"node": ">=14",
Expand Down
12 changes: 6 additions & 6 deletions examples/cucumber/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"devDependencies": {
"@wdio/cli": "^7.27.0",
"@wdio/cucumber-framework": "^7.27.0",
"@wdio/local-runner": "^7.27.0",
"@wdio/mocha-framework": "^7.26.0",
"@wdio/spec-reporter": "^7.26.0",
"@wdio/cli": "^8",
"@wdio/cucumber-framework": "^8",
"@wdio/local-runner": "^8",
"@wdio/mocha-framework": "^8",
"@wdio/spec-reporter": "^8",
"chromedriver": "latest",
"wdio-chromedriver-service": "^7.3.2",
"wdio-chromedriver-service": "^8",
"wdio-ui5-service": "*"
},
"scripts": {
Expand Down
26 changes: 0 additions & 26 deletions examples/fe-app/.eslintrc

This file was deleted.

26 changes: 26 additions & 0 deletions examples/fe-app/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
extends: "eslint:recommended",
env: {
node: true,
es6: true,
jest: true
},
parserOptions: {
ecmaVersion: 2017
},
globals: {
browser: true,
before: true,
SELECT: true,
INSERT: true,
UPDATE: true,
DELETE: true,
CREATE: true,
DROP: true,
cds: true
},
rules: {
"no-console": "off",
"require-atomic-updates": "off"
}
}
11 changes: 5 additions & 6 deletions examples/fe-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
"serve": "ui5 serve --port 8088"
},
"devDependencies": {
"@wdio/cli": "^7",
"@wdio/cli": "^8",
"detect-libc": "^2.0.1",
"@wdio/local-runner": "^7",
"@wdio/mocha-framework": "^7",
"@wdio/selenium-standalone-service": "^7",
"@wdio/spec-reporter": "^7",
"@wdio/local-runner": "^8",
"@wdio/mocha-framework": "^8",
"@wdio/spec-reporter": "^8",
"chromedriver": "latest",
"wdio-chromedriver-service": "^7",
"wdio-chromedriver-service": "^8",
"wdio-ui5-service": "*",
"@sap-ux/ui5-middleware-fe-mockserver": "latest"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/fe-app/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports.config = {
wdi5: {
screenshotPath: join("app", "incidents", "webapp", "wdi5-test", "__screenshots__"),
logLevel: "verbose", // error | verbose | silent
waitForUI5Timeout: 30000
waitForUI5Timeout: 90000
},
//// wdio runner config
specs: [join("webapp", "wdi5-test", "**/*.test.js")],
Expand Down Expand Up @@ -34,7 +34,7 @@ exports.config = {
bail: 0,
baseUrl: "http://localhost:8088/index.html#fe-lrop-v4",

waitforTimeout: 10000,
waitforTimeout: 20000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,

Expand Down
5 changes: 4 additions & 1 deletion examples/ui5-js-app/e2e-test-config/wdi5-multiversion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fsExtra = require("fs-extra")
const path = require("path")
const replace = require("replace-in-file")
const Launcher = require("@wdio/cli").default
const { Launcher } = require("@wdio/cli")

// lts versions (> 1.60)
// empty string will get the newest Version which can be a "SNAPSHOT" version
Expand Down Expand Up @@ -37,6 +37,9 @@ const versions = ["", "1.71", "1.84", "1.96"]

// run it
const wdio = new Launcher(targetWdioConf)
//> REVISIT: this is only necessary to wait for the async constructor to resolve
//> seehttps://github.com/webdriverio/webdriverio/pull/10607
await new Promise((resolve) => setTimeout(resolve, 1000))
await wdio.run().then((code) => {
if (code === 1) {
process.exit(1)
Expand Down
Loading

0 comments on commit ee5e2c4

Please sign in to comment.