Skip to content

feat: migrate basic-host-remote e2e to Playwright #4368

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 3 commits into from
Aug 13, 2025
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
4 changes: 0 additions & 4 deletions basic-host-remote/cypress.env.json

This file was deleted.

67 changes: 0 additions & 67 deletions basic-host-remote/e2e/checkApplications.cy.ts

This file was deleted.

22 changes: 22 additions & 0 deletions basic-host-remote/e2e/checkApplications.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test, expect } from '@playwright/test';

const apps = [
{ port: 3001, name: 'App 1' },
{ port: 3002, name: 'App 2' },
];

apps.forEach(({ port, name }) => {
test.describe(`Check ${name}`, () => {
test(`Check ${name} built and running`, async ({ page }) => {
await page.goto(`http://localhost:${port}`);
await expect(page.getByRole('heading', { level: 1 })).toContainText('Basic Host-Remote');
await expect(page.getByRole('heading', { level: 2, name })).toBeVisible();
});

test(`Check buttons in ${name} exist`, async ({ page }) => {
await page.goto(`http://localhost:${port}`);
await expect(page.getByRole('button')).toHaveText('App 2 Button!!!!');
});
});
});

9 changes: 7 additions & 2 deletions basic-host-remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
"build": "pnpm --filter basic-host-remote_* run build",
"serve": "pnpm --filter basic-host-remote_* run serve",
"clean": "pnpm --filter basic-host-remote_* run reset",
"e2e:ci": "pnpm build && pnpm serve & sleep 60 && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
"test:e2e": "npx playwright test",
"test:e2e:ui": "npx playwright test --ui",
"test:e2e:debug": "npx playwright test --debug",
"e2e:ci": "pnpm build && npx playwright install --with-deps && npx playwright test --reporter=list"
},
"devDependencies": {
"concurrently": "8.2.2",
"wait-on": "7.2.0"
"wait-on": "7.2.0",
"@playwright/test": "^1.54.2",
"playwright": "^1.54.2"
}
}
47 changes: 47 additions & 0 deletions basic-host-remote/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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: 'cd app1 && pnpm serve',
port: 3001,
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
{
command: 'cd app2 && pnpm serve',
port: 3002,
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
],
});

18 changes: 12 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading