Skip to content

Commit 9c3a004

Browse files
updating e2e configs
Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
1 parent 7d0841a commit 9c3a004

5 files changed

Lines changed: 91 additions & 18 deletions

File tree

workspaces/translations/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ site
5050
*.session.sql
5151

5252
# E2E test reports
53-
e2e-test-report/
53+
e2e-test-report*/
5454

5555
# Cache
5656
.cache/

workspaces/translations/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"scripts": {
99
"start": "backstage-cli repo start",
10-
"start:legacy": "yarn workspace app-legacy start",
10+
"start:legacy": "backstage-cli repo start packages/app-legacy packages/backend",
1111
"start-backend": "yarn workspace backend start",
1212
"build:backend": "yarn workspace backend build",
1313
"tsc": "tsc",
@@ -21,6 +21,10 @@
2121
"test": "backstage-cli repo test --detectOpenHandles",
2222
"test:all": "backstage-cli repo test --coverage --detectOpenHandles",
2323
"test:e2e": "playwright test",
24+
"test:e2e:legacy": "APP_MODE=legacy playwright test",
25+
"test:e2e:nfs": "APP_MODE=nfs playwright test",
26+
"test:e2e:all": "yarn test:e2e:legacy && yarn test:e2e:nfs",
27+
"playwright": "bash -c 'if [[ \"$*\" == \"test\" ]]; then yarn test:e2e:all; else npx playwright \"$@\"; fi' _",
2428
"fix": "backstage-cli repo fix",
2529
"lint": "backstage-cli repo lint --since origin/main",
2630
"lint:all": "backstage-cli repo lint",
@@ -47,7 +51,9 @@
4751
"@changesets/cli": "^2.27.1",
4852
"@jest/environment-jsdom-abstract": "^30.3.0",
4953
"@playwright/test": "1.60.0",
54+
"@react-aria/interactions": "^3.27.1",
5055
"@react-stately/layout": "^4.7.1",
56+
"@react-stately/overlays": "^3.6.23",
5157
"@types/jest": "^30.0.0",
5258
"@types/jsdom": "^27.0.0",
5359
"jest": "^30.3.0",

workspaces/translations/packages/app-legacy/e2e-tests/app.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ test('App should render the welcome page', async ({ page }) => {
2020
await page.goto('/');
2121

2222
const enterButton = page.getByRole('button', { name: 'Enter' });
23-
await expect(enterButton).toBeVisible();
23+
await expect(enterButton).toBeVisible({ timeout: 30_000 });
2424
await enterButton.click();
2525

26-
await expect(page.getByText('My Company Catalog')).toBeVisible();
26+
await expect(page.getByRole('link', { name: 'Home' }).first()).toBeVisible({
27+
timeout: 30_000,
28+
});
2729
});
Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright The Backstage Authors
2+
* Copyright Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,44 +15,60 @@
1515
*/
1616

1717
import { defineConfig } from '@playwright/test';
18-
import { generateProjects } from '@backstage/e2e-test-utils/playwright';
1918

20-
/**
21-
* See https://playwright.dev/docs/test-configuration.
22-
*/
19+
const appMode = process.env.APP_MODE || 'legacy';
20+
const startCommand = appMode === 'legacy' ? 'yarn start:legacy' : 'yarn start';
21+
2322
export default defineConfig({
24-
timeout: 60_000,
23+
timeout: 2 * 60_000,
2524

2625
expect: {
2726
timeout: 5_000,
2827
},
2928

30-
// Run your local dev server before starting the tests
3129
webServer: process.env.PLAYWRIGHT_URL
3230
? []
3331
: [
3432
{
35-
command: 'yarn start',
33+
command: startCommand,
34+
port: 7007,
35+
reuseExistingServer: true,
36+
timeout: 120_000,
37+
},
38+
{
39+
command:
40+
'echo "frontend already started by the previous webServer entry"',
3641
port: 3000,
3742
reuseExistingServer: true,
38-
timeout: 60_000,
43+
timeout: 120_000,
3944
},
4045
],
4146

4247
forbidOnly: !!process.env.CI,
4348

4449
retries: process.env.CI ? 2 : 0,
4550

46-
reporter: [['html', { open: 'never', outputFolder: 'e2e-test-report' }]],
51+
reporter: [
52+
['html', { open: 'never', outputFolder: `e2e-test-report-${appMode}` }],
53+
],
4754

4855
use: {
49-
actionTimeout: 0,
5056
baseURL: process.env.PLAYWRIGHT_URL ?? 'http://localhost:3000',
5157
screenshot: 'only-on-failure',
5258
trace: 'on-first-retry',
59+
navigationTimeout: 60_000,
60+
actionTimeout: 30_000,
5361
},
5462

55-
outputDir: 'node_modules/.cache/e2e-test-results',
63+
outputDir: `node_modules/.cache/e2e-test-results-${appMode}`,
5664

57-
projects: generateProjects(), // Find all packages with e2e-test folders
65+
projects: [
66+
{
67+
name: appMode,
68+
testDir: 'packages/app-legacy/e2e-tests',
69+
use: {
70+
channel: 'chrome' as const,
71+
},
72+
},
73+
],
5874
});

workspaces/translations/yarn.lock

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5902,7 +5902,9 @@ __metadata:
59025902
"@changesets/cli": "npm:^2.27.1"
59035903
"@jest/environment-jsdom-abstract": "npm:^30.3.0"
59045904
"@playwright/test": "npm:1.60.0"
5905+
"@react-aria/interactions": "npm:^3.27.1"
59055906
"@react-stately/layout": "npm:^4.7.1"
5907+
"@react-stately/overlays": "npm:^3.6.23"
59065908
"@types/jest": "npm:^30.0.0"
59075909
"@types/jsdom": "npm:^27.0.0"
59085910
jest: "npm:^30.3.0"
@@ -9007,6 +9009,20 @@ __metadata:
90079009
languageName: node
90089010
linkType: hard
90099011

9012+
"@react-aria/interactions@npm:^3.27.1":
9013+
version: 3.28.1
9014+
resolution: "@react-aria/interactions@npm:3.28.1"
9015+
dependencies:
9016+
"@react-types/shared": "npm:^3.34.0"
9017+
"@swc/helpers": "npm:^0.5.0"
9018+
react-aria: "npm:^3.48.0"
9019+
peerDependencies:
9020+
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
9021+
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
9022+
checksum: 10c0/55325471f4ac0829e77d344c3549b8806cda2d461ebf1a1fa6bdf469091cc50d3702e44896591adb7988d2909781962ce9bbbf510a1c66c948b901573311c2a6
9023+
languageName: node
9024+
linkType: hard
9025+
90109026
"@react-hookz/deep-equal@npm:^1.0.4":
90119027
version: 1.0.4
90129028
resolution: "@react-hookz/deep-equal@npm:1.0.4"
@@ -9043,6 +9059,19 @@ __metadata:
90439059
languageName: node
90449060
linkType: hard
90459061

9062+
"@react-stately/overlays@npm:^3.6.23":
9063+
version: 3.7.1
9064+
resolution: "@react-stately/overlays@npm:3.7.1"
9065+
dependencies:
9066+
"@swc/helpers": "npm:^0.5.0"
9067+
react-stately: "npm:^3.46.0"
9068+
peerDependencies:
9069+
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
9070+
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
9071+
checksum: 10c0/1c1a5a09965be5bc82c3c962c1e3d72fe5259eab99e73fee01b8e91cc57f4b96a7f3dae5a55fe5fd4169cc59cf0bee65bde02ed87f6664c1bb0d3ea7138ad2ec
9072+
languageName: node
9073+
linkType: hard
9074+
90469075
"@react-types/shared@npm:^3.34.0, @react-types/shared@npm:^3.36.0":
90479076
version: 3.36.0
90489077
resolution: "@react-types/shared@npm:3.36.0"
@@ -28009,6 +28038,26 @@ __metadata:
2800928038
languageName: node
2801028039
linkType: hard
2801128040

28041+
"react-aria@npm:^3.48.0":
28042+
version: 3.50.0
28043+
resolution: "react-aria@npm:3.50.0"
28044+
dependencies:
28045+
"@internationalized/date": "npm:^3.12.2"
28046+
"@internationalized/number": "npm:^3.6.7"
28047+
"@internationalized/string": "npm:^3.2.9"
28048+
"@react-types/shared": "npm:^3.36.0"
28049+
"@swc/helpers": "npm:^0.5.0"
28050+
aria-hidden: "npm:^1.2.3"
28051+
clsx: "npm:^2.0.0"
28052+
react-stately: "npm:3.48.0"
28053+
use-sync-external-store: "npm:^1.6.0"
28054+
peerDependencies:
28055+
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
28056+
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
28057+
checksum: 10c0/a7de127abcfcc91a8b69b30737d44842fd6fbe013ce14fff0975141937735f87f6274489f2bee498f3518b833c16799d64b13ea425ea731c89cf005d9a4ea655
28058+
languageName: node
28059+
linkType: hard
28060+
2801228061
"react-beautiful-dnd@npm:^13.0.0":
2801328062
version: 13.1.1
2801428063
resolution: "react-beautiful-dnd@npm:13.1.1"
@@ -28465,7 +28514,7 @@ __metadata:
2846528514
languageName: node
2846628515
linkType: hard
2846728516

28468-
"react-stately@npm:^3.46.0":
28517+
"react-stately@npm:3.48.0, react-stately@npm:^3.46.0":
2846928518
version: 3.48.0
2847028519
resolution: "react-stately@npm:3.48.0"
2847128520
dependencies:

0 commit comments

Comments
 (0)