test: Add playwright main usage test
Some checks failed
Queue Release Build / prepare (push) Successful in 38s
Deploy Web Apps / deploy (push) Successful in 13m34s
Queue Release Build / build-linux (push) Successful in 45m20s
Queue Release Build / build-windows (push) Failing after 3h8m14s
Queue Release Build / finalize (push) Has been cancelled
Some checks failed
Queue Release Build / prepare (push) Successful in 38s
Deploy Web Apps / deploy (push) Successful in 13m34s
Queue Release Build / build-linux (push) Successful in 45m20s
Queue Release Build / build-windows (push) Failing after 3h8m14s
Queue Release Build / finalize (push) Has been cancelled
This commit is contained in:
4
e2e/fixtures/base.ts
Normal file
4
e2e/fixtures/base.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { test as base } from '@playwright/test';
|
||||
|
||||
export const test = base;
|
||||
export { expect } from '@playwright/test';
|
||||
54
e2e/fixtures/multi-client.ts
Normal file
54
e2e/fixtures/multi-client.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
test as base,
|
||||
chromium,
|
||||
type Page,
|
||||
type BrowserContext,
|
||||
type Browser
|
||||
} from '@playwright/test';
|
||||
import { installTestServerEndpoint } from '../helpers/seed-test-endpoint';
|
||||
|
||||
export interface Client {
|
||||
page: Page;
|
||||
context: BrowserContext;
|
||||
}
|
||||
|
||||
interface MultiClientFixture {
|
||||
createClient: () => Promise<Client>;
|
||||
browser: Browser;
|
||||
}
|
||||
|
||||
export const test = base.extend<MultiClientFixture>({
|
||||
browser: async ({}, use) => {
|
||||
const browser = await chromium.launch({
|
||||
args: ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream']
|
||||
});
|
||||
|
||||
await use(browser);
|
||||
await browser.close();
|
||||
},
|
||||
|
||||
createClient: async ({ browser }, use) => {
|
||||
const clients: Client[] = [];
|
||||
const factory = async (): Promise<Client> => {
|
||||
const context = await browser.newContext({
|
||||
permissions: ['microphone', 'camera'],
|
||||
baseURL: 'http://localhost:4200'
|
||||
});
|
||||
|
||||
await installTestServerEndpoint(context);
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
clients.push({ page, context });
|
||||
return { page, context };
|
||||
};
|
||||
|
||||
await use(factory);
|
||||
|
||||
for (const client of clients) {
|
||||
await client.context.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export { expect } from '@playwright/test';
|
||||
Reference in New Issue
Block a user