Skip to content
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

vp test: support esm test running on preview deploy #703

Draft
wants to merge 3 commits into
base: edge
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions .github/workflows/e2e_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ jobs:
- name: NPM Install
run: npm install

- name: Extract PR Number
id: extract_pr_number
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Set Deploy Preview URL
run: echo "PREVIEW_URL=https://deploy-preview-${{ env.PR_NUMBER }}--cld-vp-esm-pages.netlify.app" >> $GITHUB_ENV

- name: E2E tests
run: npm run test:e2e
env:
PREVIEW_URL: ${{ env.PREVIEW_URL }}

- name: Upload report to artifact
uses: actions/upload-artifact@v4
Expand Down
11 changes: 9 additions & 2 deletions test/e2e/specs/linksConsoleErrorsEsmPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ import { ESM_LINKS } from '../testData/esmPageLinksData';
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
import { validatePageErrors } from '../src/helpers/validatePageErrors';

const ESM_URL = 'https://cld-vp-esm-pages.netlify.app/';
const EDGE_ESM_URL = 'https://cld-vp-esm-pages.netlify.app/';
/**
* Console error test generated by LINKS object array data.
*/
for (const link of ESM_LINKS) {
vpTest(`Test console errors on link ${link.name}`, async ({ page, consoleErrors, vpExamples }) => {
vpTest.skip(link.name === 'Adaptive Streaming', 'Flaky on CI');
/**
* Navigate to ESM Imports examples page
* Navigate to ESM Imports examples page.
* ON PR level it will use the preview deploy URL and locally it will use the latest EDGE.
*/
const ESM_URL = process.env.PREVIEW_URL || EDGE_ESM_URL;
await page.goto(ESM_URL);
await vpExamples.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
Expand All @@ -26,6 +28,11 @@ for (const link of ESM_LINKS) {
* Testing number of links in page.
*/
vpTest('ESM page Link count test', async ({ page }) => {
/**
* Navigate to ESM Imports examples page.
* ON PR level it will use the preview deploy URL and locally it will use the latest EDGE.
*/
const ESM_URL = process.env.PREVIEW_URL || EDGE_ESM_URL;
await page.goto(ESM_URL);
const expectedNumberOfLinks = 32;
const numberOfLinks = await page.getByRole('link').count();
Expand Down
Loading