diff --git a/test/e2e/specs/videoTransformationsPage.spec.ts b/test/e2e/specs/videoTransformationsPage.spec.ts new file mode 100644 index 00000000..88300cbd --- /dev/null +++ b/test/e2e/specs/videoTransformationsPage.spec.ts @@ -0,0 +1,26 @@ +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.VideoTransformations); + +vpTest(`Test if 3 videos on video transformations page are playing as expected`, async ({ page, pomPages }) => { + await test.step('Navigate to video transformations page by clicking on link', async () => { + await pomPages.mainPage.clickLinkByName(link.name); + await waitForPageToLoadWithTimeout(page, 5000); + }); + await test.step('Validating that via source transformation video is playing', async () => { + await pomPages.videoTransformationsPage.viaSourceVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Validating that via player transformation video is playing', async () => { + await pomPages.videoTransformationsPage.viaPlayerVideoComponent.validateVideoIsPlaying(true); + }); + await test.step('Scroll until data cld transformation video element is visible', async () => { + await pomPages.videoTransformationsPage.viaDataCldTransformationsVideoComponent.locator.scrollIntoViewIfNeeded(); + }); + await test.step('Validating that via data cld transformation video is playing', async () => { + await pomPages.videoTransformationsPage.viaDataCldTransformationsVideoComponent.validateVideoIsPlaying(true); + }); +}); diff --git a/test/e2e/src/pom/PageManager.ts b/test/e2e/src/pom/PageManager.ts index 04d55122..14c01bf6 100644 --- a/test/e2e/src/pom/PageManager.ts +++ b/test/e2e/src/pom/PageManager.ts @@ -25,6 +25,7 @@ import { RecommendationsPage } from './recommendationsPage'; import { SeekThumbnailsPage } from './seekThumbnailsPage'; import { ShoppableVideosPage } from './shoppableVideosPage'; import { SubtitlesAndCaptionsPage } from './subtitlesAndCaptionsPage'; +import { VideoTransformationsPage } from './videoTransformationsPage'; /** * Page manager, @@ -176,5 +177,9 @@ export class PageManager { public get subtitlesAndCaptionsVideosPage(): SubtitlesAndCaptionsPage { return this.getPage(SubtitlesAndCaptionsPage); } + + public get videoTransformationsPage(): VideoTransformationsPage { + return this.getPage(VideoTransformationsPage); + } } export default PageManager; diff --git a/test/e2e/src/pom/videoTransformationsPage.ts b/test/e2e/src/pom/videoTransformationsPage.ts new file mode 100644 index 00000000..42d4dcfe --- /dev/null +++ b/test/e2e/src/pom/videoTransformationsPage.ts @@ -0,0 +1,22 @@ +import { Page } from '@playwright/test'; +import { VideoComponent } from '../../components/videoComponent'; +import { BasePage } from './BasePage'; +const VIA_SOURCE_VIDEO_SELECTOR = '//*[@id="player-1_html5_api"]'; +const VIA_PLAYER_VIDEO_SELECTOR = '//*[@id="player-2_html5_api"]'; +const VIA_DATA_CLD_TRANSFORMATIONS_VIDEO_SELECTOR = '//*[@id="player-3_html5_api"]'; + +/** + * Video player examples video transformations page object + */ +export class VideoTransformationsPage extends BasePage { + public viaSourceVideoComponent: VideoComponent; + public viaPlayerVideoComponent: VideoComponent; + public viaDataCldTransformationsVideoComponent: VideoComponent; + + constructor(page: Page) { + super(page); + this.viaSourceVideoComponent = new VideoComponent(page, VIA_SOURCE_VIDEO_SELECTOR); + this.viaPlayerVideoComponent = new VideoComponent(page, VIA_PLAYER_VIDEO_SELECTOR); + this.viaDataCldTransformationsVideoComponent = new VideoComponent(page, VIA_DATA_CLD_TRANSFORMATIONS_VIDEO_SELECTOR); + } +}