Skip to content

Commit

Permalink
feat: outsource auth tests, drop node 14, make node 16 dev default, a…
Browse files Browse the repository at this point in the history
…lign script timeout (#465)

- outsource auth tests w/ node 16 → browserstack
- drop node 14 support
- make node 16 the default dev env
- align script timeout in browser-scope with wdi5's waitForUI5Timeout config setting (default: 15 sec.)

also lays the ground work for running other test against browserstack + saucelabs

---------

Co-authored-by: Simon Coen <[email protected]>
  • Loading branch information
vobu and Siolto authored May 9, 2023
1 parent b78d119 commit b2cb381
Show file tree
Hide file tree
Showing 33 changed files with 46,942 additions and 4,307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker-standalone-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

strategy:
matrix:
node_version: [14, 16, 18, 19]
node_version: [16, 18, 19, 20]

env:
REGISTRY: ghcr.io
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
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 @@ -14,7 +14,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v3
with:
token: ${{secrets.ADMIN_WDI5}}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-btp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
Expand Down
29 changes: 8 additions & 21 deletions .github/workflows/wdi5-tests_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,30 @@ env:
wdi5_password: ${{secrets.BTP_PASSWORD}}
wdi5_one_password: ${{secrets.BTP_PASSWORD}}
wdi5_two_password: ${{secrets.BTP_PASSWORD}}
BROWSERSTACK_USERNAME: ${{secrets.BROWSERSTACK_USERNAME}}
BROWSERSTACK_ACCESS_KEY: ${{secrets.BROWSERSTACK_ACCESS_KEY}}
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}

jobs:
tests:
runs-on: ubuntu-latest

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

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: check out repo
uses: actions/checkout@v3

- name: use node ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"

# we need this for workspace mgmt
- name: check npm version >= 7
run: npm --version
- name: update npm
run: |
npm i -g npm@8
npm --version
# install both module + sample app(s) deps
- name: install packages (wdi5 + sample app(s))
run: |
Expand All @@ -71,5 +58,5 @@ jobs:
- name: build
run: npm run build

- name: btp/sap cloud id, basic auth, office 365, custom auth
run: npm run test:auth
- name: (browserstack) btp/sap cloud id, basic auth, office 365, custom auth
run: BROWSERSTACK=true npm run test:auth
12 changes: 2 additions & 10 deletions .github/workflows/wdi5-tests_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,19 @@ jobs:

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

steps:
- name: check out repo
uses: actions/checkout@v3

- name: use node ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"

# we need this for workspace mgmt
- name: check npm version >= 7
run: npm --version
- name: update npm
run: |
npm i -g npm@8
npm --version
# install both module + sample app(s) deps
- name: install packages (wdi5 + sample app(s))
run: |
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/wdi5-tests_fe-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

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

steps:
- name: update chrome
Expand All @@ -39,20 +39,12 @@ jobs:
uses: actions/checkout@v3

- name: use node ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"

# we need this for workspace mgmt
- name: check npm version >= 7
run: npm --version
- name: update npm
run: |
npm i -g npm@8
npm --version
# install both module + sample app(s) deps
- name: install packages (wdi5 + sample app(s))
run: |
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/wdi5-tests_js-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

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

steps:
- name: update chrome
Expand All @@ -40,20 +40,12 @@ jobs:
uses: actions/checkout@v3

- name: use node ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"

# we need this for workspace mgmt
- name: check npm version >= 7
run: npm --version
- name: update npm
run: |
npm i -g npm@8
npm --version
# install both module + sample app(s) deps
- name: install packages (wdi5 + sample app(s))
run: |
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/wdi5-tests_ts-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

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

steps:
- name: update chrome
Expand All @@ -40,20 +40,12 @@ jobs:
uses: actions/checkout@v3

- name: use node ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"

# we need this for workspace mgmt
- name: check npm version >= 7
run: npm --version
- name: update npm
run: |
npm i -g npm@8
npm --version
# install both module + sample app(s) deps
- name: install packages (wdi5 + sample app(s))
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ mta_archives
*.mtar
*.zip
*.mta

# cloud testing
*.err
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/fermium
16
19 changes: 10 additions & 9 deletions client-side-js/injectUI5.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ async function clientSide_injectUI5(config, waitForUI5Timeout, browserInstance)
// This is a manual replacement for crypto.randomUUID()
// until it is only available in secure contexts.
// See https://github.com/WICG/uuid/issues/23
const uuid = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16))
const uuid = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
)
window.wdi5.objectMap[uuid] = object
return uuid
}
Expand All @@ -60,13 +61,13 @@ async function clientSide_injectUI5(config, waitForUI5Timeout, browserInstance)
_autoWaiterAsync.extendConfig(oOptions)

const startWaiting = function () {
window.wdi5.bWaitStarted = true;
window.wdi5.bWaitStarted = true
_autoWaiterAsync.waitAsync(function (sError) {
const nextWaitAsync = window.wdi5.asyncControlRetrievalQueue.shift();
const nextWaitAsync = window.wdi5.asyncControlRetrievalQueue.shift()
if (nextWaitAsync) {
setTimeout(nextWaitAsync); //use setTimeout to postpone execution to the next event cycle, so that bWaitStarted in the UI5 _autoWaiterAsync is also set to false first
setTimeout(nextWaitAsync) //use setTimeout to postpone execution to the next event cycle, so that bWaitStarted in the UI5 _autoWaiterAsync is also set to false first
} else {
window.wdi5.bWaitStarted = false;
window.wdi5.bWaitStarted = false
}
if (sError) {
errorCallback(new Error(sError))
Expand All @@ -76,9 +77,9 @@ async function clientSide_injectUI5(config, waitForUI5Timeout, browserInstance)
})
}
if (!window.wdi5.bWaitStarted) {
startWaiting();
startWaiting()
} else {
window.wdi5.asyncControlRetrievalQueue.push(startWaiting);
window.wdi5.asyncControlRetrievalQueue.push(startWaiting)
}
}
window.wdi5.Log.info("[browser wdi5] window._autoWaiterAsync used in waitForUI5 function")
Expand All @@ -100,7 +101,7 @@ async function clientSide_injectUI5(config, waitForUI5Timeout, browserInstance)
sap.ui.require(["sap/ui/core/Control"], (Control) => {
Control.prototype.exec = function (funcToEval, ...args) {
try {
return new Function('return ' + funcToEval).apply(this).apply(this, args)
return new Function("return " + funcToEval).apply(this).apply(this, args)
} catch (error) {
return { status: 1, message: error.toString() }
}
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ With `wdi5` [being a service to WebdriverIO](https://webdriver.io/docs/wdio-ui5-
- UI5 app running in the browser, accessible via `http(s)://host.ext:port`.
Recommended tooling for this is either the official [UI5 tooling](https://github.com/SAP/ui5-tooling) (`ui5 serve`) or some standalone http server like [`soerver`](https://github.com/vobu/soerver) or [`http-server`](https://www.npmjs.com/package/http-server).
- UI5 app using UI5 >= `1.60` (because the [`RecordReplay` API](https://ui5.sap.com/sdk/#/api/sap.ui.test.RecordReplay) is used extensively which is only available from UI5 `1.60`+)
- Node.js version >= `14` (`lts/fermium`)
- Node.js version >= `16` (`lts/gallium`)

The installation of `wdi5` and WebdriverIO can either be done by using (a) `npm init wdi5`, (b) the [Webdriver.IO `cli`](https://webdriver.io/docs/gettingstarted.html) or (c) manually.

Expand Down
Loading

0 comments on commit b2cb381

Please sign in to comment.