Skip to content

Commit 52adc6a

Browse files
committed
fix: e2e issue
1 parent 13a37e1 commit 52adc6a

File tree

5 files changed

+26
-32
lines changed

5 files changed

+26
-32
lines changed

.github/workflows/reusable-test.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,6 @@ jobs:
238238
if: ${{ inputs.use-matrix == true }}
239239
runs-on: ubuntu-latest
240240
# needs: build-modern-node
241-
# Use Playwright container for E2E tests, which has all dependencies and all browsers installed
242-
# container: mcr.microsoft.com/playwright:v1.52.0-jammy
243-
# env:
244-
# # fix Firefox permission issue (Firefox is unable to launch if the $HOME folder isn't owned by the current user)
245-
# HOME: /root
246-
# strategy:
247-
# matrix:
248-
# browser: [chrome, firefox, webkit, edge]
249241
steps:
250242
- uses: actions/checkout@v4
251243

@@ -258,32 +250,34 @@ jobs:
258250
- name: Install Playwright dependencies
259251
run: npx playwright install-deps webkit
260252

261-
# - name: Restore modern node_modules cache
262-
# uses: actions/cache@v4
263-
# with:
264-
# path: |
265-
# node_modules
266-
# key: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
253+
- name: Restore modern node_modules cache
254+
id: node_modules_cache
255+
uses: actions/cache@v4
256+
with:
257+
path: |
258+
node_modules
259+
key: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
267260

268261
- name: Install dependencies
262+
if: steps.node_modules_cache.outputs.cache-hit != 'true'
269263
run: npm ci
270264

271265
- name: Install playwright browsers
272266
run: npx playwright install
273267

274-
# - name: Download build output from artifacts
275-
# id: download_build_output
276-
# uses: actions/download-artifact@v4
277-
# continue-on-error: true
278-
# with:
279-
# name: ${{ runner.os }}-modern-build-output-${{ github.sha }}
268+
- name: Download build output from artifacts
269+
id: download_build_output
270+
uses: actions/download-artifact@v4
271+
continue-on-error: true
272+
with:
273+
name: ${{ runner.os }}-modern-build-output-${{ github.sha }}
280274

281275
- name: Build package
282276
# if: steps.download_build_output.outcome != 'success'
283277
run: npm run build
284278

285279
- name: Run e2e tests
286-
run: npm run task:run-e2e
280+
run: npm run e2e
287281

288282
# Run tests on single specified Node.js version
289283
run-jest-single:

e2e/fixtures/legacy.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<head>
55
<meta charset="UTF-8">
66
<title>Enum Plus Legacy Test</title>
7-
<script src="scripts/serialize-javascript-bundle.js"></script>
8-
<script src="scripts/es-legacy-bundle.js"></script>
9-
<script src="scripts/week-config-bundle.js"></script>
10-
<script src="scripts/week-data-bundle.js"></script>
117
</head>
128

139
<body>
1410
<div id="test-results"></div>
11+
<script src="scripts/serialize-javascript-bundle.js"></script>
12+
<script src="scripts/es-legacy-bundle.js"></script>
13+
<script src="scripts/week-config-bundle.js"></script>
14+
<script src="scripts/week-data-bundle.js"></script>
1515
</body>
1616

1717
</html>

e2e/fixtures/modern.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<head>
55
<meta charset="UTF-8">
66
<title>Enum Plus Modern Test</title>
7-
<script src="scripts/serialize-javascript-bundle.js"></script>
8-
<script src="scripts/es-modern-bundle.js"></script>
9-
<script src="scripts/week-config-bundle.js"></script>
10-
<script src="scripts/week-data-bundle.js"></script>
117
</head>
128

139
<body>
1410
<div id="test-results"></div>
11+
<script src="scripts/serialize-javascript-bundle.js"></script>
12+
<script src="scripts/es-modern-bundle.js"></script>
13+
<script src="scripts/week-config-bundle.js"></script>
14+
<script src="scripts/week-data-bundle.js"></script>
1515
</body>
1616

1717
</html>

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const config: PlaywrightTestConfig = {
1010
globalSetup: require.resolve('./e2e/global.setup.ts'),
1111
globalTeardown: require.resolve('./e2e/global.teardown.ts'),
1212
forbidOnly: !!process.env.CI,
13-
workers: 2,
13+
workers: process.env.CI ? 2 : 4,
1414
retries: 2,
1515
use: {
1616
baseURL: `http://localhost:${port}`,

test/engines/playwright.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export class PlaywrightEngine extends TestEngineBase {
2424
const serializedEvaluateParams = stringify({ ...evaluateContext, evaluateFn: evaluate });
2525

2626
test(`(es) ${name}`, async ({ page }) => {
27-
await page.goto('/modern.html', { waitUntil: 'domcontentloaded' });
27+
await page.goto('/modern.html', { waitUntil: 'load' });
2828
await this.executeEvaluation({ page, assert, serializedEvaluateParams });
2929
});
3030

3131
// test(`(es-legacy) ${name}`, async ({ page }) => {
32-
// await page.goto('/legacy.html', { waitUntil: 'domcontentloaded' });
32+
// await page.goto('/legacy.html', { waitUntil: 'load' });
3333
// await this.executeEvaluation({ page, assert, serializedEvaluateParams });
3434
// });
3535
}

0 commit comments

Comments
 (0)