Skip to content

Commit ff1fa4a

Browse files
Migrate apollo-client E2E tests to Playwright (#4367)
* test: migrate apollo-client e2e to Playwright * chore: update pnpm lockfile after install 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent 97c67f3 commit ff1fa4a

File tree

5 files changed

+3397
-4504
lines changed

5 files changed

+3397
-4504
lines changed

apollo-client/e2e/checkCraApps.cy.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Apollo Client', () => {
4+
test('should render host and remote components', async ({ page }) => {
5+
await page.goto('http://localhost:3001');
6+
await page.waitForLoadState('networkidle');
7+
8+
await expect(page.locator('h1')).toHaveText('Module Federation Example: React 18 + Apollo Client');
9+
await expect(
10+
page.getByRole('heading', { level: 2, name: 'This is the App 2 application.' })
11+
).toBeVisible();
12+
});
13+
});

apollo-client/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"start": "pnpm --filter apollo-client_* --parallel start",
99
"serve": "pnpm --filter apollo-client_* --parallel serve",
1010
"build": "pnpm --filter apollo-client_* --parallel build",
11-
"e2e:ci": "pnpm build && pnpm serve & sleep 30 && wait-on tcp:3001 tcp:3002 && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome",
12-
"legacy:e2e:ci": "kill-port 3000 3001 && pnpm legacy:build && pnpm serve & sleep 30 && wait-on tcp:3001 tcp:3002 && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
11+
"e2e:ci": "npx playwright test",
12+
"legacy:e2e:ci": "npx playwright test"
1313
},
1414
"devDependencies": {
15-
"wait-on": "7.2.0",
16-
"kill-port": "2.0.1"
15+
"@playwright/test": "^1.54.2",
16+
"wait-on": "7.2.0"
1717
}
1818
}

apollo-client/playwright.config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './e2e',
5+
timeout: 60000,
6+
expect: {
7+
timeout: 15000,
8+
},
9+
fullyParallel: true,
10+
forbidOnly: !!process.env.CI,
11+
retries: process.env.CI ? 1 : 0,
12+
workers: process.env.CI ? 1 : undefined,
13+
reporter: [
14+
['html', { outputFolder: 'playwright-report', open: 'never' }],
15+
['list'],
16+
],
17+
use: {
18+
baseURL: 'http://localhost:3001',
19+
trace: 'on-first-retry',
20+
screenshot: 'only-on-failure',
21+
video: 'retain-on-failure',
22+
viewport: { width: 1920, height: 1080 },
23+
},
24+
projects: [
25+
{
26+
name: 'chromium',
27+
use: { ...devices['Desktop Chrome'] },
28+
},
29+
],
30+
webServer: {
31+
command: 'pnpm build && pnpm serve',
32+
port: 3001,
33+
reuseExistingServer: !process.env.CI,
34+
timeout: 120000,
35+
},
36+
});

0 commit comments

Comments
 (0)