From 6422dfaeffb8b9aa927dbec55badaf80125c1ce7 Mon Sep 17 00:00:00 2001 From: ShayLevi <61374483+ShayLevi@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:18:12 +0200 Subject: [PATCH] vp test: test if videos on raw url page are playing (#786) --- test/e2e/specs/rawUrlPage.spec.ts | 20 ++++++++++++++++++++ test/e2e/src/pom/PageManager.ts | 5 +++++ test/e2e/src/pom/rawUrlPage.ts | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 test/e2e/specs/rawUrlPage.spec.ts create mode 100644 test/e2e/src/pom/rawUrlPage.ts diff --git a/test/e2e/specs/rawUrlPage.spec.ts b/test/e2e/specs/rawUrlPage.spec.ts new file mode 100644 index 00000000..98262a3d --- /dev/null +++ b/test/e2e/specs/rawUrlPage.spec.ts @@ -0,0 +1,20 @@ +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'; + +const link = getLinkByName(ExampleLinkName.RawURL); + +vpTest(`Test if 2 videos on raw URL page are playing as expected`, async ({ page, pomPages }) => { + await test.step('Navigate to raw URL page by clicking on link', async () => { + await pomPages.mainPage.clickLinkByName(link.name); + await waitForPageToLoadWithTimeout(page, 5000); + }); + await test.step('Validating that raw url video is playing', async () => { + await pomPages.rawUrlPage.rawUrlVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Validating that raw url adaptive video is playing', async () => { + await pomPages.rawUrlPage.rawUrlAdaptiveVideoComponent.validateVideoIsPlaying(true); + }); +}); diff --git a/test/e2e/src/pom/PageManager.ts b/test/e2e/src/pom/PageManager.ts index 0dd6aee0..14e699c9 100644 --- a/test/e2e/src/pom/PageManager.ts +++ b/test/e2e/src/pom/PageManager.ts @@ -20,6 +20,7 @@ import { PlaylistPage } from './playlistPage'; import { PlaylistByTagPage } from './playlistByTagPage'; import { PosterOptionsPage } from './posterOptionsPage'; import { ProfilesPage } from './profilesPage'; +import { RawUrlPage } from './rawUrlPage'; /** * Page manager, @@ -151,5 +152,9 @@ export class PageManager { public get profilesPage(): ProfilesPage { return this.getPage(ProfilesPage); } + + public get rawUrlPage(): RawUrlPage { + return this.getPage(RawUrlPage); + } } export default PageManager; diff --git a/test/e2e/src/pom/rawUrlPage.ts b/test/e2e/src/pom/rawUrlPage.ts new file mode 100644 index 00000000..471d5812 --- /dev/null +++ b/test/e2e/src/pom/rawUrlPage.ts @@ -0,0 +1,19 @@ +import { Page } from '@playwright/test'; +import { VideoComponent } from '../../components/videoComponent'; +import { BasePage } from './BasePage'; +const RAW_URL_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]'; +const RAW_URL_PAGE_ADAPTIVE_VIDEO_SELECTOR = '//*[@id="adpPlayer_html5_api"]'; + +/** + * Video player examples raw URL page object + */ +export class RawUrlPage extends BasePage { + public rawUrlVideoComponent: VideoComponent; + public rawUrlAdaptiveVideoComponent: VideoComponent; + + constructor(page: Page) { + super(page); + this.rawUrlVideoComponent = new VideoComponent(page, RAW_URL_PAGE_VIDEO_SELECTOR); + this.rawUrlAdaptiveVideoComponent = new VideoComponent(page, RAW_URL_PAGE_ADAPTIVE_VIDEO_SELECTOR); + } +}