Skip to content

Commit abe6198

Browse files
authored
chore(ci): use GitHub Actions instead of SauceLabs (#5548)
* chore(ci): use GitHub Actions for cross-platform tests, not SuaceLabs Don't delete SauceLabs tho (yet) * chore: not a template string * test(integration): disable flaky tests (temporarily) * chore(integration-tests): remove leading `test-` from filenames It's implicit in the files being in the test directory and long filenames cause problems on windows * chore(integration-tests): `delegate-focus-` -> `delegates-focus-` * chore(integration-tests): rename `tab-index-` to `tabindex-` * chore(integration-tests): remove `-elements` * chore(integration-tests): rename `previous-` to `prev-` * test(integration-tests): await async method * chore(integration-tests): fully remove `test-` prefix * test(integration-tests): derive test names instead of hard-coding easier to maintain and uncovered a few broken tests! * chore(integration-tests): rename way-too-long test name * chore(ci): attempt to run bash on windows and everywhere * chore(ci): declare env vars in more cross-platform manner * chore(ci): run yarn install in bash * chore(ci): give up and use cross-env * chore(ci): try without `exec` * test(wtr): change variable name is SAUCE defined in CI? * chore(ci): remove saucelabs * test(ci): run unit tests on windows * chore(ci): why different? * chore(ci): avoid unnecessasry rebuild * chore(ci): windows compat * Revert "chore(ci): windows compat" This reverts commit e4279e3. * chore(ci): windows compat * chore(ci): update actions versions * chore(ci): install chromedriver as part of setup-chrome * chore(ci): more sloppy windows compat * chore(ci): more windowsy * chore: add package manager * chore(ci): more windowsy * chore(ci): more windowsy * chore(ci): more windowsy * chore(ci): crlf smh * chore(ci): revert setup-chrome@v2 * chore: include call stack * chore: debug * chore: actually, nvm don't need to change this file for this task * test(wtr): jsdoc for the doc gods * chore(ci): update input descriptions * chore: revert unrelated changes * chore: more windowsy * chore: revert unrelated changes * test(wtr): disable tests broken on windows * revert: just log text * chore(ci): remove unnecessary env var * chore(ci): add names for clarity * chore: move `x` to `c` maybe makes windows work * chore: update usage of `x` to `c` maybe makes windows work * chore: update usage of `X-` to `C-` maybe makes windows work * test(wtr): fix scope tokens * test(wtr): order can be different * test(wtr): try to normalize filenames * chore: update yarn.lock * test(wtr): enable browser logs * test(wtr): filter out [WDIO] logs * test(wtr): try to fix windows * test(wtr): no browser logs they're mostly noise * test(wtr): test objects in matrix * Revert "test(wtr): test objects in matrix" This reverts commit 4f1181c. * chore(ci): split jobs to make faster, maybe * chore(ci): fail-fast: false * chore(ci): merge jobs * chore(ci): merge more jobs * chore(ci): reconfigure so it hopefully works * chore(ci): consolidate hydration tests * chore(ci): exclude engine-server flag + SSR v2 runtime combo * chore(ci): add default env hydration tests * chore(ci): use correct SSR package for hydration tests * chore(ci): give up on windows * chore(ci): give up on windows * Revert "chore: move `x` to `c`" This reverts commit 6f32328. * test(wtr): revert usage of `c` to `x` * Apply suggestion from @wjhsf * test(wtr): revert `c-` to `x-` * test(wtr): revert scope tokens * test(wtr): re-enable tests that only fail on windows * chore: revert windows-only changes * chore: remove windows compat file * test(wtr): restore saucelabs manual mode * docs(wtr): add note about saucelabs * chore(ci): clean up integration test matrix * chore(ci): clean up hydration test matrix
1 parent 39b40e4 commit abe6198

File tree

4 files changed

+138
-197
lines changed

4 files changed

+138
-197
lines changed

.github/workflows/web-test-runner.yml

Lines changed: 90 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,62 @@ on:
1111
pull_request:
1212

1313
env:
14-
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
15-
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
16-
GITHUB_RUN_ID: ${{github.run_id}}
1714
COVERAGE: '1'
1815
NODE_VERSION: '20.19.4'
1916

17+
defaults:
18+
run:
19+
working-directory: packages/@lwc/integration-not-karma
20+
2021
jobs:
2122
# We run tests in parallel to speed up CI, with an arbitrary goal of ~20 minutes per job.
22-
# Test grouping is also somewhat arbitrary.
2323
# TODO: upload result artifacts
2424

2525
integration-tests:
26-
name: Integration tests (${{ matrix.shadow_mode }} shadow)
26+
name: Integration tests (${{ matrix.shadow_mode }} shadow; ${{ matrix.env || 'default env' }})
27+
runs-on: ubuntu-22.04
2728
strategy:
29+
fail-fast: false
2830
matrix:
2931
shadow_mode: [native, synthetic]
32+
env:
33+
- ''
34+
# TODO: Fix
35+
# - DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1
36+
- DISABLE_STATIC_CONTENT_OPTIMIZATION=1
37+
- ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL=1
38+
- NODE_ENV_FOR_TEST=1
39+
- API_VERSION=58
40+
- API_VERSION=59
41+
- API_VERSION=60
42+
- API_VERSION=61
43+
- API_VERSION=62
44+
# No need for 63-65
45+
- API_VERSION=66
46+
47+
include:
48+
# Test modes for only synthetic or only native
49+
- shadow_mode: synthetic
50+
env: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1
51+
- shadow_mode: synthetic
52+
env: DISABLE_DETACHED_REHYDRATION=1
53+
# TODO: Fix
54+
# - shadow_mode: synthetic
55+
# env: DISABLE_DETACHED_REHYDRATION=1 DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1
56+
- shadow_mode: native
57+
env: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1
58+
- shadow_mode: native
59+
env: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_STATIC_CONTENT_OPTIMIZATION=1
3060

31-
runs-on: ubuntu-22.04
3261
env:
33-
SAUCE_TUNNEL_ID: gha-${{github.run_id}}-wtr-integration-${{ matrix.shadow_mode }}-1
3462
SHADOW_MODE_OVERRIDE: ${{ matrix.shadow_mode }}
35-
defaults:
36-
run:
37-
working-directory: ./packages/@lwc/integration-not-karma
63+
3864
steps:
3965
- name: Checkout repository
40-
uses: actions/checkout@v4
66+
uses: actions/checkout@v5
4167

4268
- name: Setup Node
43-
uses: actions/setup-node@v4
69+
uses: actions/setup-node@v6
4470
with:
4571
node-version: ${{ env.NODE_VERSION }}
4672
cache: 'yarn'
@@ -49,118 +75,55 @@ jobs:
4975
run: yarn install --frozen-lockfile
5076
working-directory: ./
5177

52-
- uses: saucelabs/sauce-connect-action@v3.0.0
53-
with:
54-
username: ${{ secrets.SAUCE_USERNAME }}
55-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
56-
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}
57-
region: us
58-
59-
- run: yarn exec -- playwright install chrome firefox webkit --with-deps
60-
- run: yarn test
61-
- run: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn test || true
62-
- run: DISABLE_STATIC_CONTENT_OPTIMIZATION=1 yarn test
63-
- run: ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL=1 yarn test
64-
- run: NODE_ENV_FOR_TEST=production yarn test
65-
66-
integration-tests-api-versions:
67-
name: Integration tests (${{ matrix.shadow_mode }} shadow) - API versions
68-
strategy:
69-
matrix:
70-
shadow_mode: [native, synthetic]
78+
- name: Install playwright dependencies
79+
run: yarn playwright install chrome firefox webkit --with-deps
7180

72-
runs-on: ubuntu-22.04
73-
env:
74-
SAUCE_TUNNEL_ID: gha-${{github.run_id}}-wtr-integration-${{ matrix.shadow_mode }}-2
75-
SHADOW_MODE_OVERRIDE: ${{ matrix.shadow_mode }}
76-
defaults:
77-
run:
78-
working-directory: ./packages/@lwc/integration-not-karma
79-
steps:
80-
- name: Checkout repository
81-
uses: actions/checkout@v4
81+
- name: Set env vars
82+
run: echo '${{ matrix.env }}' | tr ' ' '\n' >> "$GITHUB_ENV"
8283

83-
- name: Setup Node
84-
uses: actions/setup-node@v4
85-
with:
86-
node-version: ${{ env.NODE_VERSION }}
87-
cache: 'yarn'
84+
- name: Sanity check env vars
85+
run: |
86+
echo "API_VERSION=$API_VERSION"
87+
echo "DISABLE_DETACHED_REHYDRATION=$DISABLE_DETACHED_REHYDRATION"
88+
echo "DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=$DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE"
89+
echo "DISABLE_STATIC_CONTENT_OPTIMIZATION=$DISABLE_STATIC_CONTENT_OPTIMIZATION"
90+
echo "DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=$DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER"
91+
echo "ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL=$ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL"
92+
echo "FORCE_NATIVE_SHADOW_MODE_FOR_TEST=$FORCE_NATIVE_SHADOW_MODE_FOR_TEST"
93+
echo "NODE_ENV_FOR_TEST=$NODE_ENV_FOR_TEST"
8894
89-
- name: Install dependencies
90-
run: yarn install --frozen-lockfile
91-
working-directory: ./
95+
- name: Run integration tests
96+
run: yarn test
9297

93-
- uses: saucelabs/sauce-connect-action@v3.0.0
94-
with:
95-
username: ${{ secrets.SAUCE_USERNAME }}
96-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
97-
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}
98-
region: us
99-
100-
- run: yarn exec -- playwright install chrome firefox webkit --with-deps
101-
- run: API_VERSION=58 yarn test
102-
- run: API_VERSION=59 yarn test
103-
- run: API_VERSION=60 yarn test
104-
- run: API_VERSION=61 yarn test
105-
- run: API_VERSION=62 yarn test
106-
- run: API_VERSION=66 yarn test
107-
108-
integration-tests-not-both-modes:
109-
# Tests that should run in only synthetic or native shadow, not both
110-
name: Integration tests (singleton batch)
98+
hydration-tests:
99+
name: Hydration tests (${{ matrix.engine_server && 'engine-server' || 'SSR v2' }}; ${{ matrix.env || 'default env' }})
111100
runs-on: ubuntu-22.04
112-
env:
113-
SAUCE_TUNNEL_ID: gha-${{github.run_id}}-wtr-integration-${{ matrix.shadow_mode }}-3
114-
SHADOW_MODE_OVERRIDE: ${{ matrix.shadow_mode }}
115-
defaults:
116-
run:
117-
working-directory: ./packages/@lwc/integration-not-karma
118-
steps:
119-
- name: Checkout repository
120-
uses: actions/checkout@v4
121-
122-
- name: Setup Node
123-
uses: actions/setup-node@v4
124-
with:
125-
node-version: ${{ env.NODE_VERSION }}
126-
cache: 'yarn'
127-
128-
- name: Install dependencies
129-
run: yarn install --frozen-lockfile
130-
working-directory: ./
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
engine_server: ['', 1]
105+
env:
106+
- ''
107+
- SHADOW_MODE_OVERRIDE=synthetic
108+
- NODE_ENV_FOR_TEST=production
109+
- DISABLE_STATIC_CONTENT_OPTIMIZATION=1
110+
include:
111+
- engine_server: 1
112+
env: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1
113+
- engine_server: 1
114+
env: DISABLE_DETACHED_REHYDRATION=1
115+
- engine_server: 1
116+
env: DISABLE_DETACHED_REHYDRATION=1 DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1
131117

132-
- uses: saucelabs/sauce-connect-action@v3.0.0
133-
with:
134-
username: ${{ secrets.SAUCE_USERNAME }}
135-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
136-
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}
137-
region: us
138-
139-
- run: yarn exec -- playwright install chrome firefox webkit --with-deps
140-
# Synthetic shadow only
141-
- run: LEGACY_BROWSERS=1 yarn test || true
142-
- run: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 yarn test
143-
- run: DISABLE_DETACHED_REHYDRATION=1 yarn test
144-
- run: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_DETACHED_REHYDRATION=1 yarn test || true
145-
146-
# Native shadow only -- don't forget SHADOW_MODE_OVERRIDE!
147-
- run: SHADOW_MODE_OVERRIDE=native DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 yarn test
148-
- run: SHADOW_MODE_OVERRIDE=native DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_STATIC_CONTENT_OPTIMIZATION=1 yarn test
149-
150-
hydration-tests-ssr-v2:
151-
name: Hydration tests (SSR v2)
152-
runs-on: ubuntu-22.04
153118
env:
154-
SAUCE_TUNNEL_ID: gha-${{github.run_id}}-wtr-hydration-1
155-
defaults:
156-
run:
157-
working-directory: ./packages/@lwc/integration-not-karma
119+
ENGINE_SERVER: ${{ matrix.engine_server }}
120+
158121
steps:
159122
- name: Checkout repository
160-
uses: actions/checkout@v4
123+
uses: actions/checkout@v5
161124

162125
- name: Setup Node
163-
uses: actions/setup-node@v4
126+
uses: actions/setup-node@v6
164127
with:
165128
node-version: ${{ env.NODE_VERSION }}
166129
cache: 'yarn'
@@ -169,56 +132,20 @@ jobs:
169132
run: yarn install --frozen-lockfile
170133
working-directory: ./
171134

172-
- uses: saucelabs/sauce-connect-action@v3.0.0
173-
with:
174-
username: ${{ secrets.SAUCE_USERNAME }}
175-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
176-
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}
177-
region: us
178-
179-
- run: yarn exec -- playwright install chrome firefox webkit --with-deps
180-
- run: yarn test:hydration
181-
- run: SHADOW_MODE_OVERRIDE=synthetic yarn test:hydration
182-
- run: NODE_ENV_FOR_TEST=production yarn test:hydration
183-
- run: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn test:hydration
184-
- run: DISABLE_STATIC_CONTENT_OPTIMIZATION=1 yarn test:hydration
185-
186-
hydration-tests-engine-server:
187-
name: Hydration tests (engine-server)
188-
runs-on: ubuntu-22.04
189-
env:
190-
SAUCE_TUNNEL_ID: gha-${{github.run_id}}-wtr-hydration-2
191-
ENGINE_SERVER: 1
192-
defaults:
193-
run:
194-
working-directory: ./packages/@lwc/integration-not-karma
195-
steps:
196-
- name: Checkout repository
197-
uses: actions/checkout@v4
135+
- name: Install playwright dependencies
136+
run: yarn playwright install chrome firefox webkit --with-deps
198137

199-
- name: Setup Node
200-
uses: actions/setup-node@v4
201-
with:
202-
node-version: ${{ env.NODE_VERSION }}
203-
cache: 'yarn'
138+
- name: Set env vars
139+
run: echo '${{ matrix.env }}' | tr ' ' '\n' >> "$GITHUB_ENV"
204140

205-
- name: Install dependencies
206-
run: yarn install --frozen-lockfile
207-
working-directory: ./
141+
- name: Sanity check env vars
142+
run: |
143+
echo "SHADOW_MODE_OVERRIDE=$SHADOW_MODE_OVERRIDE"
144+
echo "NODE_ENV_FOR_TEST=$NODE_ENV_FOR_TEST"
145+
echo "DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=$DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE"
146+
echo "DISABLE_STATIC_CONTENT_OPTIMIZATION=$DISABLE_STATIC_CONTENT_OPTIMIZATION"
147+
echo "DISABLE_DETACHED_REHYDRATION=$DISABLE_DETACHED_REHYDRATION"
148+
echo "ENGINE_SERVER=$ENGINE_SERVER"
208149
209-
- uses: saucelabs/sauce-connect-action@v3.0.0
210-
with:
211-
username: ${{ secrets.SAUCE_USERNAME }}
212-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
213-
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}
214-
region: us
215-
216-
- run: yarn exec -- playwright install chrome firefox webkit --with-deps
217-
# NOTE: All tests have ENGINE_SERVER=1 already set
218-
- run: yarn test:hydration
219-
- run: SHADOW_MODE_OVERRIDE=synthetic yarn test:hydration
220-
- run: NODE_ENV_FOR_TEST=production yarn test:hydration
221-
- run: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn test:hydration
222-
- run: DISABLE_STATIC_CONTENT_OPTIMIZATION=1 yarn test:hydration
223-
- run: DISABLE_DETACHED_REHYDRATION=1 yarn test:hydration
224-
- run: DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_DETACHED_REHYDRATION=1 yarn test:hydration
150+
- name: Run hydration tests
151+
run: yarn test:hydration

packages/@lwc/integration-not-karma/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Environment variables are used as controls to run tests in different modes (e.g
2020
- `test`: The test directory for integration tests.
2121
- `test-hydration`: The test directory for hydration tests.
2222

23+
### Test Runners
24+
25+
By default, the tests are run using Playwright. If the `USE_SAUCE` env var is set, then SauceLabs is used instead. To use SauceLabs, the `SAUCE_USERNAME`, `SAUCE_ACCESS_KEY`, and `SAUCE_TUNNEL_ID` env vars must be set.
26+
2327
### Integration Tests
2428

2529
Integration tests are simply `.spec.js` files that run in the browser. LWC components are transformed by a plugin defined in `serve-integration.js`.

packages/@lwc/integration-not-karma/configs/shared/browsers.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createSauceLabsLauncher } from '@web/test-runner-saucelabs';
33

44
/** @type {(options: typeof import('../../helpers/options.js')) => import("@web/test-runner").BrowserLauncher[]} */
55
export function getBrowsers(options) {
6-
if (options.CI) {
6+
if (options.USE_SAUCE) {
77
if (!options.SAUCE_USERNAME || !options.SAUCE_ACCESS_KEY || !options.SAUCE_TUNNEL_ID) {
88
throw new Error(
99
`SAUCE_USERNAME, SAUCE_ACCESS_KEY, and SAUCE_TUNNEL_ID must be configured in CI`
@@ -18,33 +18,32 @@ export function getBrowsers(options) {
1818
tunnelName: options.SAUCE_TUNNEL_ID,
1919
}
2020
);
21-
return [
22-
sauceLabsLauncher({
23-
browserName: 'chrome',
24-
browserVersion: 'latest',
25-
}),
26-
// sauceLabsLauncher({
27-
// browserName: 'firefox',
28-
// browserVersion: 'latest',
29-
// }),
30-
// sauceLabsLauncher({
31-
// browserName: 'safari',
32-
// browserVersion: 'latest',
33-
// }),
34-
// ...(options.LEGACY_BROWSERS
35-
// ? [
36-
// sauceLabsLauncher({
37-
// browserName: 'chrome',
38-
// browserVersion: 'latest-2',
39-
// }),
40-
// sauceLabsLauncher({
41-
// browserName: 'safari',
42-
// browserVersion: 'latest-2',
43-
// platformName: 'Mac 13', // update with new releases
44-
// }),
45-
// ]
46-
// : []),
47-
];
21+
return options.LEGACY_BROWSERS
22+
? [
23+
sauceLabsLauncher({
24+
browserName: 'chrome',
25+
browserVersion: 'latest-2',
26+
}),
27+
sauceLabsLauncher({
28+
browserName: 'safari',
29+
browserVersion: 'latest-2',
30+
platformName: 'Mac 13', // update with new releases
31+
}),
32+
]
33+
: [
34+
sauceLabsLauncher({
35+
browserName: 'chrome',
36+
browserVersion: 'latest',
37+
}),
38+
sauceLabsLauncher({
39+
browserName: 'firefox',
40+
browserVersion: 'latest',
41+
}),
42+
sauceLabsLauncher({
43+
browserName: 'safari',
44+
browserVersion: 'latest',
45+
}),
46+
];
4847
} else {
4948
return [
5049
playwrightLauncher({ product: 'chromium' }),

0 commit comments

Comments
 (0)