From 0bde55c259b47627b373f6b08f82deaaf1e5d2e9 Mon Sep 17 00:00:00 2001 From: JeremyFriesenGitHub Date: Fri, 6 Sep 2024 15:00:31 -0400 Subject: [PATCH] fix(docs-e2e): address pipeline workflow with specifc layout projects and allowed flaky tests retries --- apps/docs-e2e/playwright.config.ts | 1 + apps/docs-e2e/src/docs.spec.ts | 45 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/apps/docs-e2e/playwright.config.ts b/apps/docs-e2e/playwright.config.ts index 9e196f4d..cdf8be75 100644 --- a/apps/docs-e2e/playwright.config.ts +++ b/apps/docs-e2e/playwright.config.ts @@ -23,6 +23,7 @@ const baseURL = process.env.BASE_URL || 'http://127.0.0.1:3000' export default defineConfig({ ...nxE2EPreset(__filename, { testDir: './src' }), /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + retries: 2, use: { baseURL, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ diff --git a/apps/docs-e2e/src/docs.spec.ts b/apps/docs-e2e/src/docs.spec.ts index b57549da..5a4bb7ad 100644 --- a/apps/docs-e2e/src/docs.spec.ts +++ b/apps/docs-e2e/src/docs.spec.ts @@ -60,6 +60,13 @@ test.describe(`Common MOBILE, TABLET and DESKTOP Layout Elements`, { test.describe(`Common MOBILE and TABLET Layout Elements`, { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('desktop')) { + test.skip() + } + }) + test(`should have quick links section visible in mobile/tablet header`, async ({ docsLayoutPage }) => { await expect(docsLayoutPage.quickLinks).toBeVisible() }) @@ -88,6 +95,9 @@ test.describe(`Common MOBILE and TABLET Menu Elements`, { else if (device.includes('tablet')) { await docsLayoutPage.kebabIcon.click() } + else { + test.skip() + } }) test(`should have docs pages section dropdown menu visible for mobile/tablet`, async ({ docsLayoutPage }) => { @@ -162,6 +172,13 @@ test.describe(`Common MOBILE and TABLET Menu Elements`, { test.describe('Common TABLET and DESKTOP Layout Elements', { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('mobile')) { + test.skip() + } + }) + test(`should contain search bar in tablet/desktop header`, async ({ docsLayoutPage }) => { await expect(docsLayoutPage.searchBar).toBeVisible() }) @@ -184,6 +201,13 @@ test.describe('Common TABLET and DESKTOP Layout Elements', { test.describe('Unique DESKTOP Header Elements', { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('mobile') || device.includes('tablet')) { + test.skip() + } + }) + test('should contain Website dropdown button in desktop header', async ({ docsLayoutPage }) => { await expect(docsLayoutPage.websiteDropdownButton).toBeVisible() }) @@ -250,6 +274,13 @@ test.describe('Unique DESKTOP Header Elements', { test.describe('Unique Floating Table of Contents DESKTOP Elements', { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('mobile') || device.includes('tablet')) { + test.skip() + } + }) + test('should contain \'Edit on GitHub\' button in floating table of contents', async ({ docsLayoutPage }) => { await expect(docsLayoutPage.editOnGitHubButton).toBeVisible() }) @@ -263,6 +294,13 @@ test.describe('Unique Floating Table of Contents DESKTOP Elements', { test.describe('Unique MOBILE Header Elements', { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('desktop') || device.includes('tablet')) { + test.skip() + } + }) + test('should contain hamburger icon', async ({ docsLayoutPage }) => { await expect(docsLayoutPage.hamburgerIcon).toBeVisible() }) @@ -281,6 +319,13 @@ test.describe('Unique MOBILE Header Elements', { test.describe('Unique TABLET Header Elements', { tag: '@smoke', }, () => { + test.beforeEach(async () => { + const device = test.info().project.name + if (device.includes('desktop') || device.includes('mobile')) { + test.skip() + } + }) + test('should have kebab icon visible', async ({ docsLayoutPage }) => { await expect(docsLayoutPage.kebabIcon).toBeVisible() })