From 541110b573981d077b85fc105b0feb8fb1629f8e Mon Sep 17 00:00:00 2001 From: shaylevi Date: Thu, 3 Apr 2025 11:16:12 +0300 Subject: [PATCH] vp test: test if video is playing on ESM fluid layouts page --- test/e2e/specs/ESM/esmFluidLayoutsPage.spec.ts | 12 ++++++++++++ test/e2e/specs/NonESM/fluidLayoutsPage.spec.ts | 11 ++--------- .../commonSpecs/fluidLayoutsPageVideoPlaying.ts | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 test/e2e/specs/ESM/esmFluidLayoutsPage.spec.ts create mode 100644 test/e2e/specs/commonSpecs/fluidLayoutsPageVideoPlaying.ts diff --git a/test/e2e/specs/ESM/esmFluidLayoutsPage.spec.ts b/test/e2e/specs/ESM/esmFluidLayoutsPage.spec.ts new file mode 100644 index 000000000..95f18586b --- /dev/null +++ b/test/e2e/specs/ESM/esmFluidLayoutsPage.spec.ts @@ -0,0 +1,12 @@ +import { vpTest } from '../../fixtures/vpTest'; +import { getLinkByName } from '../../testData/pageLinksData'; +import { ExampleLinkName } from '../../testData/ExampleLinkNames'; +import { testFluidLayoutsPageVideoIsPlaying } from '../commonSpecs/fluidLayoutsPageVideoPlaying'; +import { ESM_URL } from '../../testData/esmUrl'; + +const link = getLinkByName(ExampleLinkName.FluidLayouts); + +vpTest(`Test if video on ESM fluid layouts page is playing as expected`, async ({ page, pomPages }) => { + await page.goto(ESM_URL); + await testFluidLayoutsPageVideoIsPlaying(page, pomPages, link); +}); diff --git a/test/e2e/specs/NonESM/fluidLayoutsPage.spec.ts b/test/e2e/specs/NonESM/fluidLayoutsPage.spec.ts index ee22f605d..d9af6b767 100644 --- a/test/e2e/specs/NonESM/fluidLayoutsPage.spec.ts +++ b/test/e2e/specs/NonESM/fluidLayoutsPage.spec.ts @@ -1,17 +1,10 @@ import { vpTest } from '../../fixtures/vpTest'; -import { test } from '@playwright/test'; -import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout'; import { getLinkByName } from '../../testData/pageLinksData'; import { ExampleLinkName } from '../../testData/ExampleLinkNames'; +import { testFluidLayoutsPageVideoIsPlaying } from '../commonSpecs/fluidLayoutsPageVideoPlaying'; const link = getLinkByName(ExampleLinkName.FluidLayouts); vpTest(`Test if video on fluid layouts page is playing as expected`, async ({ page, pomPages }) => { - await test.step('Navigate to fluid layouts page by clicking on link', async () => { - await pomPages.mainPage.clickLinkByName(link.name); - await waitForPageToLoadWithTimeout(page, 5000); - }); - await test.step('Validating that fluid layouts video is playing', async () => { - await pomPages.fluidLayoutsPage.fluidLayoutsVideoComponent.validateVideoIsPlaying(true); - }); + await testFluidLayoutsPageVideoIsPlaying(page, pomPages, link); }); diff --git a/test/e2e/specs/commonSpecs/fluidLayoutsPageVideoPlaying.ts b/test/e2e/specs/commonSpecs/fluidLayoutsPageVideoPlaying.ts new file mode 100644 index 000000000..6b80ce1f2 --- /dev/null +++ b/test/e2e/specs/commonSpecs/fluidLayoutsPageVideoPlaying.ts @@ -0,0 +1,14 @@ +import { Page, test } from '@playwright/test'; +import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout'; +import PageManager from '../../src/pom/PageManager'; +import { ExampleLinkType } from '../../types/exampleLinkType'; + +export async function testFluidLayoutsPageVideoIsPlaying(page: Page, pomPages: PageManager, link: ExampleLinkType) { + await test.step('Navigate to fluid layouts page by clicking on link', async () => { + await pomPages.mainPage.clickLinkByName(link.name); + await waitForPageToLoadWithTimeout(page, 5000); + }); + await test.step('Validating that fluid layouts video is playing', async () => { + await pomPages.fluidLayoutsPage.fluidLayoutsVideoComponent.validateVideoIsPlaying(true); + }); +}