Skip to content

Commit

Permalink
vp test: test if videos on poster options page are playing (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayLevi authored Jan 6, 2025
1 parent bc08526 commit 563445d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/e2e/specs/posterOptionsPage.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
5 changes: 5 additions & 0 deletions test/e2e/src/pom/PageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
25 changes: 25 additions & 0 deletions test/e2e/src/pom/posterOptionsPage.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 563445d

Please sign in to comment.