From 563445dc669bd552406b9886fa80d1ab21ff82a9 Mon Sep 17 00:00:00 2001 From: ShayLevi <61374483+ShayLevi@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:34:55 +0200 Subject: [PATCH] vp test: test if videos on poster options page are playing (#784) --- test/e2e/specs/posterOptionsPage.spec.ts | 38 ++++++++++++++++++++++++ test/e2e/src/pom/PageManager.ts | 5 ++++ test/e2e/src/pom/posterOptionsPage.ts | 25 ++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 test/e2e/specs/posterOptionsPage.spec.ts create mode 100644 test/e2e/src/pom/posterOptionsPage.ts diff --git a/test/e2e/specs/posterOptionsPage.spec.ts b/test/e2e/specs/posterOptionsPage.spec.ts new file mode 100644 index 00000000..b949f69f --- /dev/null +++ b/test/e2e/specs/posterOptionsPage.spec.ts @@ -0,0 +1,38 @@ +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.PosterOptions); + +vpTest(`Test if 4 videos on poster options page are playing as expected`, async ({ page, pomPages }) => { + await test.step('Navigate to poster options page by clicking on link', async () => { + await pomPages.mainPage.clickLinkByName(link.name); + await waitForPageToLoadWithTimeout(page, 5000); + }); + await test.step('Click on play button of custom image poster player to play video', async () => { + return pomPages.posterOptionsPage.posterOptionsCustomImageVideoComponent.clickPlay(); + }); + await test.step('Validating that the custom image poster video is playing', async () => { + await pomPages.posterOptionsPage.posterOptionsCustomImageVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Click on play button of specific frame poster player to play video', async () => { + return pomPages.posterOptionsPage.posterOptionsSpecificFrameVideoComponent.clickPlay(); + }); + await test.step('Validating that specific frame poster video is playing', async () => { + await pomPages.posterOptionsPage.posterOptionsSpecificFrameVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Click on play button of transformations array poster player to play video', async () => { + return pomPages.posterOptionsPage.posterOptionsTransformationsArrayVideoComponent.clickPlay(); + }); + await test.step('Validating that transformations array poster video is playing', async () => { + await pomPages.posterOptionsPage.posterOptionsTransformationsArrayVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Click on play button of raw url no poster player to play video', async () => { + return pomPages.posterOptionsPage.posterOptionsRawUrlNoPosterVideoComponent.clickPlay(); + }); + await test.step('Validating that raw url no poster video is playing', async () => { + await pomPages.posterOptionsPage.posterOptionsRawUrlNoPosterVideoComponent.validateVideoIsPlaying(true); + }); +}); diff --git a/test/e2e/src/pom/PageManager.ts b/test/e2e/src/pom/PageManager.ts index f52fa304..f00d5b53 100644 --- a/test/e2e/src/pom/PageManager.ts +++ b/test/e2e/src/pom/PageManager.ts @@ -18,6 +18,7 @@ import { ForceHlsSubtitlesPage } from './forceHlsSubtitlesPage'; import { MultiplePlayersPage } from './multiplePlayersPage'; import { PlaylistPage } from './playlistPage'; import { PlaylistByTagPage } from './playlistByTagPage'; +import { PosterOptionsPage } from './posterOptionsPage'; /** * Page manager, @@ -141,5 +142,9 @@ export class PageManager { public get playlistByTagPage(): PlaylistByTagPage { return this.getPage(PlaylistByTagPage); } + + public get posterOptionsPage(): PosterOptionsPage { + return this.getPage(PosterOptionsPage); + } } export default PageManager; diff --git a/test/e2e/src/pom/posterOptionsPage.ts b/test/e2e/src/pom/posterOptionsPage.ts new file mode 100644 index 00000000..bd6a26bb --- /dev/null +++ b/test/e2e/src/pom/posterOptionsPage.ts @@ -0,0 +1,25 @@ +import { Page } from '@playwright/test'; +import { VideoComponent } from '../../components/videoComponent'; +import { BasePage } from './BasePage'; +const POSTER_OPTIONS_PAGE_CUSTOM_IMAGE_VIDEO_SELECTOR = '//*[@id="player-image-poster_html5_api"]'; +const POSTER_OPTIONS_PAGE_SPECIFIC_FRAME_VIDEO_SELECTOR = '//*[@id="player-frame-0_html5_api"]'; +const POSTER_OPTIONS_PAGE_TRANSFORMATIONS_ARRAY_VIDEO_SELECTOR = '//*[@id="player-poster-options_html5_api"]'; +const POSTER_OPTIONS_PAGE_RAW_URL_NO_POSTER_VIDEO_SELECTOR = '//*[@id="player-raw_html5_api"]'; + +/** + * Video player examples poster options page object + */ +export class PosterOptionsPage extends BasePage { + public posterOptionsCustomImageVideoComponent: VideoComponent; + public posterOptionsSpecificFrameVideoComponent: VideoComponent; + public posterOptionsTransformationsArrayVideoComponent: VideoComponent; + public posterOptionsRawUrlNoPosterVideoComponent: VideoComponent; + + constructor(page: Page) { + super(page); + this.posterOptionsCustomImageVideoComponent = new VideoComponent(page, POSTER_OPTIONS_PAGE_CUSTOM_IMAGE_VIDEO_SELECTOR); + this.posterOptionsSpecificFrameVideoComponent = new VideoComponent(page, POSTER_OPTIONS_PAGE_SPECIFIC_FRAME_VIDEO_SELECTOR); + this.posterOptionsTransformationsArrayVideoComponent = new VideoComponent(page, POSTER_OPTIONS_PAGE_TRANSFORMATIONS_ARRAY_VIDEO_SELECTOR); + this.posterOptionsRawUrlNoPosterVideoComponent = new VideoComponent(page, POSTER_OPTIONS_PAGE_RAW_URL_NO_POSTER_VIDEO_SELECTOR); + } +}