Skip to content
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
14 changes: 9 additions & 5 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,24 @@ export default defineConfig({
/* Configure projects for major browsers */
projects: [
{
name: 'Setup esm deploy url',
testMatch: 'test/Setup/global.setup.ts',
name: 'setup',
testMatch: 'specs/Setup/global.setup.ts',
use: {
...devices['Desktop Chrome'],
channel: 'chrome',
},
},
{
name: 'ESM',
name: 'esm',
testMatch: 'test/e2e/specs/ESM/**/*.spec.ts',
use: {
...devices['Desktop Chrome'],
channel: 'chrome',
},
dependencies: ['Setup esm deploy url'],
dependencies: ['setup'],
},
{
name: 'Non ESM',
name: 'non esm',
testMatch: 'test/e2e/specs/NonESM/**/*.spec.ts',
use: {
...devices['Desktop Chrome'],
Expand Down
12 changes: 8 additions & 4 deletions test/e2e/specs/Setup/global.setup.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { ExampleLinkType } from '../../types/exampleLinkType';
import { expect, Page } from '@playwright/test';
import { expect, Page, test } from '@playwright/test';
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
import { ESM_URL } from '../../testData/esmUrl';

async function globalSetup(page: Page) {

/**
* Ensures the esm deploy is ready by checking the 'Adaptive Streaming' link is visible at ESM_URL.
*/
test('global setup', async ({ page }) => {
if (ESM_URL) {
const link: ExampleLinkType = {
name: ExampleLinkName.AdaptiveStreaming,
endpoint: 'adaptive-streaming',
};
await waitForDeployPreviewUrl(link, page);
}
}
});

/**
* Waits for a deploy preview URL to become available by making repeated requests and check that link is visible.
Expand All @@ -23,4 +27,4 @@ async function waitForDeployPreviewUrl(link: ExampleLinkType, page: Page): Promi
await expect(linkLocator).toBeVisible({ timeout: 10000 });
}).toPass({ intervals: [1_000], timeout: 120000 });
}
export default globalSetup;