Skip to content

Commit 82f3a99

Browse files
Fixes to run on LambdaTest (#1752)
Mukesh changes: * Fixing the tests to run on LambdaTest via Github actions * adding env * browser update * modify command with exit * kill the tunnel process after tests * try with chrome * updating addons * integration test dfahlander's changes: * Trying without max-parallel * Replacing date with github.run_number for unique tunnel * Debug log LT_TUNNEL_NAME * Trying with run_id * Trying with $RANDOM * Trying with $(($RANDOM)) * Trying with $GITHUB_ENV * Random worked perfectly - but now testing with a better approach if possible. * Moving down SET LT_TUNNEL_NAME to where it needed * Refactored tests * Running safari test on browserstack to see if it also fails there * Trying again with browserstack safari * Setting max-parallel: 1 * See if idbtrans.commit() is the safari problem * Testing if cache is the safari problem * Revert this! Test if order is the safari problem * Revert "Revert this! Test if order is the safari problem" This reverts commit 880eee7. * Revert "Testing if cache is the safari problem" This reverts commit e2241a7. * Revert "See if idbtrans.commit() is the safari problem" This reverts commit 2eed798. * Testing with Monterey instead * Enabling LAMBDATEST * Testing with Safari 15 * Trying with browserstack on Safari 15 * Workaround unit tests for Safari Private Mode * Enabling Lambdatests again * Remove browserstack vars (should not be needed) * Allow 2 parallell tests (see if it works) * Try run all 5 tests in parallell to speed up CI * Removing all deps of browserstack * Upgrading browsers to test on * Trying with MacOS Ventura as platformName --------- Co-authored-by: dfahlander <[email protected]>
1 parent 3e79816 commit 82f3a99

32 files changed

+183
-431
lines changed

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ name: Build and Test
33
on: [push, workflow_dispatch]
44

55
env:
6-
#LAMBDATEST: "true" # Uncomment this line to run tests on LambdaTest instead of Browserstack
6+
LAMBDATEST: "true"
77
GH_ACTIONS: "true"
88
LT_USERNAME: ${{ secrets.LT_USERNAME }}
99
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
10-
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
11-
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
1210

1311
jobs:
1412
test:
@@ -22,7 +20,7 @@ jobs:
2220
- addons/dexie-export-import/test
2321
- libs/dexie-react-hooks/test
2422
fail-fast: true # If one test fails, abort the rest of the tests
25-
max-parallel: 1 # At least for browserstack, this seems to be needed to avoid timeouts
23+
max-parallel: 5 # At least for browserstack, this seems to be needed to avoid timeouts
2624
steps:
2725
- name: Checkout code
2826
uses: actions/checkout@v3
@@ -39,6 +37,8 @@ jobs:
3937
run: pnpm install --no-frozen-lockfile
4038
- name: Build
4139
run: pnpm run build
40+
- name: Set LT_TUNNEL_NAME
41+
run: echo "LT_TUNNEL_NAME=${{ matrix.TF }}-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
4242
- name: Run headless test
4343
uses: coactions/setup-xvfb@v1
4444
with:

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,7 @@ samples/typescript/utils.js.map
185185
/.ntvs_analysis.dat
186186
/*.njsproj
187187
libs/dexie-cloud-common/tsconfig.tsbuildinfo
188+
189+
#lambdatest tunnel binary
190+
.lambdatest
191+
tunnel.pid

addons/Dexie.Observable/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
"test:integration": "karma start test/integration/karma.conf.js --single-run",
4242
"test:typings": "just-build test-typings",
4343
"test:unit:debug": "karma start test/unit/karma.conf.js --log-level debug",
44-
"test:integration:debug": "karma start test/integrations/karma.conf.js --log-level debug"
44+
"test:integration:debug": "karma start test/integrations/karma.conf.js --log-level debug",
45+
"test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test:unit; UNIT_STATUS=$?; exit $UNIT_STATUS",
46+
"test:ltTunnel": "node ../../test/lt-local",
47+
"test:ltcloud:integration": "cross-env LAMBDATEST=true pnpm run test:integration; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS"
4548
},
4649
"just-build": {
4750
"default": [

addons/Dexie.Observable/test/gh-actions.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ echo "Installing dependencies for dexie-observable"
33
pnpm install >/dev/null
44
pnpm run build
55
pnpm run test:typings
6-
pnpm run test:unit
7-
pnpm run test:integration
6+
pnpm run test:ltcloud
7+
pnpm run test:ltcloud:integration

addons/Dexie.Observable/test/integration/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../..
44
module.exports = function (config) {
55
const browserMatrixOverrides = {
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["remote_chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"remote_chrome",
1212
]
1313
};
1414

addons/Dexie.Observable/test/unit/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../..
44
module.exports = function (config) {
55
const browserMatrixOverrides = {
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["remote_chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"remote_chrome",
1212
]
1313
};
1414

addons/Dexie.Syncable/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
"test:integration": "karma start test/integration/karma.conf.js --single-run",
4141
"test:typings": "tsc -p test/test-typings/",
4242
"test:unit:debug": "karma start test/unit/karma.conf.js --log-level debug",
43-
"test:integration:debug": "karma start test/integrations/karma.conf.js --log-level debug"
43+
"test:integration:debug": "karma start test/integrations/karma.conf.js --log-level debug",
44+
"test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test:unit; UNIT_STATUS=$?; exit $UNIT_STATUS",
45+
"test:ltTunnel": "node ../../test/lt-local",
46+
"test:ltcloud:integration": "cross-env LAMBDATEST=true pnpm run test:integration; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS"
4447
},
4548
"just-build": {
4649
"default": [

addons/Dexie.Syncable/test/gh-actions.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ echo "Building dexie-syncable"
1111
pnpm run build
1212

1313
pnpm run test:typings
14-
pnpm run test:unit
15-
pnpm run test:integration
14+
pnpm run test:ltcloud
15+
pnpm run test:ltcloud:integration

addons/Dexie.Syncable/test/integration/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../..
44
module.exports = function (config) {
55
const browserMatrixOverrides = {
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["remote_chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"remote_chrome",
1212
]
1313
};
1414

addons/Dexie.Syncable/test/unit/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../..
44
module.exports = function (config) {
55
const browserMatrixOverrides = {
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["remote_chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"remote_chrome",
1212
]
1313
};
1414

addons/dexie-cloud/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
"dreambase-library": "^1.0.21",
8282
"just-build": "*",
8383
"karma": "*",
84-
"karma-browserstack-launcher": "*",
8584
"karma-chrome-launcher": "*",
8685
"karma-firefox-launcher": "*",
8786
"karma-qunit": "*",

addons/dexie-cloud/test/unit/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../..
44
module.exports = function (config) {
55
const browserMatrixOverrides = {
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["Chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"Chrome",
1212
]
1313
};
1414

addons/dexie-export-import/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"test": "just-build test && npx karma start test/karma.conf.js --single-run",
1414
"build": "just-build",
1515
"watch": "just-build --watch",
16-
"clean": "rm -rf tools/tmp dist/*.js dist/*.mjs dist/*.map dist/*.d.ts test/bundle.*"
16+
"clean": "rm -rf tools/tmp dist/*.js dist/*.mjs dist/*.map dist/*.d.ts test/bundle.*",
17+
"test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS",
18+
"test:ltTunnel": "node ../../test/lt-local"
1719
},
1820
"just-build": {
1921
"default": [

addons/dexie-export-import/test/gh-actions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ n=1
77
until [ $n -ge 4 ]
88
do
99
echo "Retry $n of 3"
10-
pnpm test && exit 0
10+
pnpm test:ltcloud && exit 0
1111
n=$[$n+1]
1212
done
1313
exit 1

addons/dexie-export-import/test/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../te
44
module.exports = function (config) {
55
const cfg = getKarmaConfig({
66
// Be fine with testing on local travis firefox + browserstack chrome, latest supported.
7-
ci: ["bs_chrome_latest_supported"],
7+
ci: ["Chrome"],
88
// Safari fails to reply on browserstack. Need to not have it here.
99
// Just complement with old chrome browser that is not part of CI test suite.
1010
pre_npm_publish: [
11-
"bs_chrome_latest_supported",
11+
"Chrome",
1212
]
1313
}, {
1414
// Base path should point at the root

libs/dexie-react-hooks/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"typings": "dist/dexie-react-hooks.d.ts",
77
"scripts": {
88
"test": "just-build build-tests && just-build run-tests",
9-
"build": "just-build"
9+
"build": "just-build",
10+
"test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS",
11+
"test:ltTunnel": "node ../../test/lt-local"
1012
},
1113
"exports": {
1214
"import": "./dist/dexie-react-hooks.mjs",

libs/dexie-react-hooks/test/gh-actions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
echo "Installing dependencies for dexie-react-hooks"
33
pnpm install >/dev/null
44
echo "Building and running the tests"
5-
pnpm test
5+
pnpm test:ltcloud
66

libs/dexie-react-hooks/test/karma.conf.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('../../../test/karma.common');
33

44
module.exports = function (config) {
5-
const cfg = getKarmaConfig({
6-
// Be fine with testing on local Firefox only (no browserstack). This lib is not sensitive to browser differences.
7-
ci: ["Firefox"],
8-
pre_npm_publish: ["Firefox"]
9-
}, {
5+
const cfg = getKarmaConfig({}, {
106
basePath: '..',
117
files: [
128
'test/dist/bundle.js'

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"test:unit": "karma start test/karma.conf.js --single-run",
6565
"test:typings": "tsc -p test/typings-test/",
6666
"test:debug": "karma start test/karma.conf.js --log-level debug",
67-
"test:ltcloud": "cross-env LAMBDATEST=true npm run test:ltTunnel & sleep 10 && npm run test:unit",
67+
"test:ltcloud": "cross-env LAMBDATEST=true pnpm run test:ltTunnel & sleep 10 && pnpm run test:unit; UNIT_STATUS=$?; kill $(cat tunnel.pid); exit $UNIT_STATUS",
6868
"test:ltTunnel": "node test/lt-local"
6969
},
7070
"just-build": {
@@ -116,10 +116,10 @@
116116
"homepage": "https://dexie.org",
117117
"devDependencies": {
118118
"@lambdatest/node-tunnel": "^4.0.1",
119+
"cross-env": "^7.0.3",
119120
"dts-bundle-generator": "^5.9.0",
120121
"just-build": "^0.9.24",
121122
"karma": "^6.1.1",
122-
"karma-browserstack-launcher": "^1.5.2",
123123
"karma-chrome-launcher": "^3.1.0",
124124
"karma-firefox-launcher": "^2.1.0",
125125
"karma-mocha-reporter": "^2.2.5",

0 commit comments

Comments
 (0)