Skip to content

Migrate apollo-client E2E tests to Playwright #4367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions apollo-client/e2e/checkCraApps.cy.ts

This file was deleted.

13 changes: 13 additions & 0 deletions apollo-client/e2e/checkCraApps.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test, expect } from '@playwright/test';

test.describe('Apollo Client', () => {
test('should render host and remote components', async ({ page }) => {
await page.goto('http://localhost:3001');
await page.waitForLoadState('networkidle');

await expect(page.locator('h1')).toHaveText('Module Federation Example: React 18 + Apollo Client');
await expect(
page.getByRole('heading', { level: 2, name: 'This is the App 2 application.' })
).toBeVisible();
});
});
8 changes: 4 additions & 4 deletions apollo-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"start": "pnpm --filter apollo-client_* --parallel start",
"serve": "pnpm --filter apollo-client_* --parallel serve",
"build": "pnpm --filter apollo-client_* --parallel build",
"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",
"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"
"e2e:ci": "npx playwright test",
"legacy:e2e:ci": "npx playwright test"
},
"devDependencies": {
"wait-on": "7.2.0",
"kill-port": "2.0.1"
"@playwright/test": "^1.54.2",
"wait-on": "7.2.0"
}
}
36 changes: 36 additions & 0 deletions apollo-client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: './e2e',
timeout: 60000,
expect: {
timeout: 15000,
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['html', { outputFolder: 'playwright-report', open: 'never' }],
['list'],
],
use: {
baseURL: 'http://localhost:3001',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
viewport: { width: 1920, height: 1080 },
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: 'pnpm build && pnpm serve',
port: 3001,
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
});
Loading
Loading