Skip to content

Commit 30dd585

Browse files
committed
test: Operationalize playwright tests
1 parent db68ec2 commit 30dd585

File tree

6 files changed

+67
-6
lines changed

6 files changed

+67
-6
lines changed

.github/workflows/test.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,35 @@ jobs:
4343
continue-on-error: true
4444
- run: yarn tsc
4545
- run: yarn test
46+
test-playwright:
47+
runs-on: ubuntu-latest
48+
permissions:
49+
actions: none
50+
checks: write
51+
contents: none
52+
deployments: none
53+
issues: none
54+
packages: none
55+
pull-requests: none
56+
repository-projects: none
57+
security-events: none
58+
statuses: none
59+
id-token: none
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
- name: Use Node.js
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: 22
68+
cache: 'yarn'
69+
- run: yarn install --immutable
70+
- run: npx playwright install --with-deps
71+
- run: npx playwright test
72+
- uses: actions/upload-artifact@v4
73+
if: ${{ !cancelled() }}
74+
with:
75+
name: playwright-report
76+
path: playwright-report/
77+
retention-days: 30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/dist/playwright.cjs.js b/dist/playwright.cjs.js
2+
index c89c0d982319b8fbc8b6c27814e14d373c5a1e2e..1e69eac0c07472dd3a396aca88a8574a415b2ecd 100644
3+
--- a/dist/playwright.cjs.js
4+
+++ b/dist/playwright.cjs.js
5+
@@ -20,7 +20,7 @@ function generateProjects() {
6+
name: pkg.packageJson.name,
7+
testDir: path.resolve(pkg.dir, "e2e-tests"),
8+
use: {
9+
- channel: "chrome"
10+
+ channel: "chromium"
11+
}
12+
}));
13+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"devDependencies": {
3232
"@backstage/cli": "^0.29.4",
33-
"@backstage/e2e-test-utils": "^0.1.1",
33+
"@backstage/e2e-test-utils": "patch:@backstage/e2e-test-utils@npm%3A0.1.1#~/.yarn/patches/@backstage-e2e-test-utils-npm-0.1.1-chromium.patch",
3434
"@playwright/test": "^1.49.1",
3535
"@types/react": "^18",
3636
"@types/react-dom": "^18",

packages/app/e2e-tests/app.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import { test, expect } from '@playwright/test';
1818
test('App should render the welcome page', async ({ page }) => {
1919
await page.goto('/');
2020

21-
const enterButton = page.getByRole('button', { name: 'Enter' });
21+
await expect(page.getByText('RaBe Backstage')).toBeVisible();
22+
23+
const enterButton = page.getByRole('button', { name: 'Sign In' });
2224
await expect(enterButton).toBeVisible();
23-
await enterButton.click();
2425

25-
await expect(page.getByText('My Company Catalog')).toBeVisible();
26+
await expect(page).toHaveScreenshot();
2627
});

yarn.lock

+17-2
Original file line numberDiff line numberDiff line change
@@ -3571,7 +3571,7 @@ __metadata:
35713571
languageName: node
35723572
linkType: hard
35733573

3574-
"@backstage/e2e-test-utils@npm:^0.1.1":
3574+
"@backstage/e2e-test-utils@npm:0.1.1":
35753575
version: 0.1.1
35763576
resolution: "@backstage/e2e-test-utils@npm:0.1.1"
35773577
dependencies:
@@ -3586,6 +3586,21 @@ __metadata:
35863586
languageName: node
35873587
linkType: hard
35883588

3589+
"@backstage/e2e-test-utils@patch:@backstage/e2e-test-utils@npm%3A0.1.1#~/.yarn/patches/@backstage-e2e-test-utils-npm-0.1.1-chromium.patch":
3590+
version: 0.1.1
3591+
resolution: "@backstage/e2e-test-utils@patch:@backstage/e2e-test-utils@npm%3A0.1.1#~/.yarn/patches/@backstage-e2e-test-utils-npm-0.1.1-chromium.patch::version=0.1.1&hash=cbf1b7"
3592+
dependencies:
3593+
"@manypkg/get-packages": "npm:^1.1.3"
3594+
fs-extra: "npm:^11.0.0"
3595+
peerDependencies:
3596+
"@playwright/test": ^1.32.3
3597+
peerDependenciesMeta:
3598+
"@playwright/test":
3599+
optional: true
3600+
checksum: 10c0/9753d78a89f9c8b69296193973a8e7a33f807adad43fbc6b6767dfa9469c512c7350314b8de5b0e9bd08c714e84e0ce1941c6f67cd2cdd03a64e5391806baa7f
3601+
languageName: node
3602+
linkType: hard
3603+
35893604
"@backstage/errors@npm:^1.2.4, @backstage/errors@npm:^1.2.6":
35903605
version: 1.2.6
35913606
resolution: "@backstage/errors@npm:1.2.6"
@@ -28484,7 +28499,7 @@ __metadata:
2848428499
resolution: "root@workspace:."
2848528500
dependencies:
2848628501
"@backstage/cli": "npm:^0.29.4"
28487-
"@backstage/e2e-test-utils": "npm:^0.1.1"
28502+
"@backstage/e2e-test-utils": "patch:@backstage/e2e-test-utils@npm%3A0.1.1#~/.yarn/patches/@backstage-e2e-test-utils-npm-0.1.1-chromium.patch"
2848828503
"@playwright/test": "npm:^1.49.1"
2848928504
"@types/react": "npm:^18"
2849028505
"@types/react-dom": "npm:^18"

0 commit comments

Comments
 (0)