Skip to content

Commit e3cdffc

Browse files
authored
Me 18881: setup for esm preview (#813)
* vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: create setup for esm preview * vp test: modify setup based on review comments
1 parent 100dc5a commit e3cdffc

33 files changed

+165
-147
lines changed

test/e2e/playwright.config.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { defineConfig, devices } from '@playwright/test';
44
* See https://playwright.dev/docs/test-configuration.
55
*/
66
export default defineConfig({
7-
testMatch: /test\/e2e\/specs\/.*(\.spec.ts)/,
8-
97
timeout: 150000,
108
/* Run tests in files in parallel */
119
fullyParallel: true,
@@ -31,7 +29,21 @@ export default defineConfig({
3129
/* Configure projects for major browsers */
3230
projects: [
3331
{
34-
name: 'Google Chrome',
32+
name: 'Setup esm deploy url',
33+
testMatch: 'test/Setup/global.setup.ts',
34+
},
35+
{
36+
name: 'ESM',
37+
testMatch: 'test/e2e/specs/ESM/**/*.spec.ts',
38+
use: {
39+
...devices['Desktop Chrome'],
40+
channel: 'chrome',
41+
},
42+
dependencies: ['Setup esm deploy url'],
43+
},
44+
{
45+
name: 'Non ESM',
46+
testMatch: 'test/e2e/specs/NonESM/**/*.spec.ts',
3547
use: {
3648
...devices['Desktop Chrome'],
3749
channel: 'chrome',
Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
import { ConsoleMessage, expect, Page } from '@playwright/test';
2-
import { vpTest } from '../fixtures/vpTest';
3-
import { ESM_LINKS } from '../testData/esmPageLinksData';
4-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
5-
import { validatePageErrors } from '../src/helpers/validatePageErrors';
6-
import { ExampleLinkType } from '../types/exampleLinkType';
7-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
8-
9-
const EDGE_ESM_URL = 'https://cld-vp-esm-pages.netlify.app/';
10-
// On PR level it will use the preview deploy URL and locally it will use the latest EDGE.
11-
const ESM_URL = process.env.PREVIEW_URL ?? EDGE_ESM_URL;
12-
// Flag to indicate if the deploy preview URL is ready
13-
let isPreviewUrlLoaded = false;
1+
import { ConsoleMessage, expect } from '@playwright/test';
2+
import { vpTest } from '../../fixtures/vpTest';
3+
import { ESM_LINKS } from '../../testData/esmPageLinksData';
4+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
5+
import { validatePageErrors } from '../../src/helpers/validatePageErrors';
6+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
7+
import { ESM_URL } from '../../testData/esmUrl';
148

159
/**
1610
* Console error test generated by LINKS object array data.
1711
*/
1812
for (const link of ESM_LINKS) {
1913
vpTest(`Test console errors on link ${link.name}`, async ({ page, consoleErrors, pomPages }) => {
2014
vpTest.skip(link.name === 'Adaptive Streaming', 'Flaky on CI');
21-
//Wait for deploy URL to be available if PREVIEW_URL is set, and it is not available yet
22-
if (process.env.PREVIEW_URL && !isPreviewUrlLoaded) {
23-
await waitForDeployPreviewUrl(link, page);
24-
}
2515
await page.goto(ESM_URL);
2616
await pomPages.mainPage.clickLinkByName(link.name);
2717
await waitForPageToLoadWithTimeout(page, 5000);
@@ -58,15 +48,3 @@ function handleCommonEsmBrowsersErrors(linkName: ExampleLinkName, consoleErrors:
5848
validatePageErrors(consoleErrors, [], ['the server responded with a status of 404']);
5949
}
6050
}
61-
62-
/**
63-
* Waits for a deploy preview URL to become available by making repeated requests and check that link is visible.
64-
*/
65-
async function waitForDeployPreviewUrl(link: ExampleLinkType, page: Page): Promise<void> {
66-
await expect(async () => {
67-
await page.goto(process.env.PREVIEW_URL);
68-
const linkLocator = page.getByRole('link', { name: link.name, exact: true });
69-
await expect(linkLocator).toBeVisible({ timeout: 10000 });
70-
isPreviewUrlLoaded = true;
71-
}).toPass({ intervals: [1_000], timeout: 120000 });
72-
}

test/e2e/specs/analyticsPage.spec.ts renamed to test/e2e/specs/NonESM/analyticsPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
// Link to Analytics page
88
const link = getLinkByName(ExampleLinkName.Analytics);

test/e2e/specs/apiAndEventsPage.spec.ts renamed to test/e2e/specs/NonESM/apiAndEventsPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
// Link to API and Events page
88
const link = getLinkByName(ExampleLinkName.APIAndEvents);

test/e2e/specs/audioPlayerPage.spec.ts renamed to test/e2e/specs/NonESM/audioPlayerPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
// Link to audio player page
88
const link = getLinkByName(ExampleLinkName.AudioPlayer);

test/e2e/specs/autoplayOnScrollPage.spec.ts renamed to test/e2e/specs/NonESM/autoplayOnScrollPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
// Link to autoplay on scroll page
88
const link = getLinkByName(ExampleLinkName.AutoplayOnScroll);

test/e2e/specs/chaptersPage.spec.ts renamed to test/e2e/specs/NonESM/chaptersPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
const link = getLinkByName(ExampleLinkName.Chapters);
88

test/e2e/specs/cldAnalyticsPage.spec.ts renamed to test/e2e/specs/NonESM/cldAnalyticsPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
const link = getLinkByName(ExampleLinkName.CloudinaryAnalytics);
88

test/e2e/specs/codecsAndFormats.spec.ts renamed to test/e2e/specs/NonESM/codecsAndFormats.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
const link = getLinkByName(ExampleLinkName.CodecsAndFormats);
88

test/e2e/specs/colorsApiPage.spec.ts renamed to test/e2e/specs/NonESM/colorsApiPage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { vpTest } from '../fixtures/vpTest';
1+
import { vpTest } from '../../fixtures/vpTest';
22
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
4-
import { getLinkByName } from '../testData/pageLinksData';
5-
import { ExampleLinkName } from '../testData/ExampleLinkNames';
3+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
4+
import { getLinkByName } from '../../testData/pageLinksData';
5+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
66

77
const link = getLinkByName(ExampleLinkName.ColorsAPI);
88

0 commit comments

Comments
 (0)