Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/e2e/components/videoComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ export class VideoComponent extends BaseComponent {
* Validates whether the video is currently playing.
* This method uses the `isPaused` function to determine the current state of the video.
* expectedPlaying - A boolean indicating the expected playback state of the video.
* timeout - Optional. The maximum time (in milliseconds) to wait for the validation. Defaults to 3000ms if not provided.
* Pass `true` if the video is expected to be playing, or `false` if it is expected to be paused.
*/
public async validateVideoIsPlaying(expectedPlaying: boolean): Promise<void> {
public async validateVideoIsPlaying(expectedPlaying: boolean, timeout: number = 3000): Promise<void> {
await expect(async () => {
expect(await this.isPaused()).not.toEqual(expectedPlaying);
}).toPass({ intervals: [500], timeout: 3000 });
}).toPass({ intervals: [500], timeout });
}
}
24 changes: 24 additions & 0 deletions test/e2e/specs/vastAndVpaidPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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.VASTAndVPAIDSupport);

vpTest(`Test if 2 videos on vast and vpaid page are playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to vast and vpaid page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Click on play button of single video with ads to play video', async () => {
return pomPages.vastAndVpaidPage.singleVideoWithAdsVideoComponent.clickPlay();
});
//Sending timeout of 12 seconds to wait until the ad finishes (10 sec) and the video will start
await test.step('Validating that single video with ads is playing', async () => {
await pomPages.vastAndVpaidPage.singleVideoWithAdsVideoComponent.validateVideoIsPlaying(true, 12000);
});
await test.step('Validating that playlist with ads video is playing', async () => {
await pomPages.vastAndVpaidPage.playlistWithAdsVideoComponent.validateVideoIsPlaying(true, 12000);
});
});
5 changes: 5 additions & 0 deletions test/e2e/src/pom/PageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { SeekThumbnailsPage } from './seekThumbnailsPage';
import { ShoppableVideosPage } from './shoppableVideosPage';
import { SubtitlesAndCaptionsPage } from './subtitlesAndCaptionsPage';
import { VideoTransformationsPage } from './videoTransformationsPage';
import { VastAndVpaidPage } from './vastAndVpaidPage';

/**
* Page manager,
Expand Down Expand Up @@ -181,5 +182,9 @@ export class PageManager {
public get videoTransformationsPage(): VideoTransformationsPage {
return this.getPage(VideoTransformationsPage);
}

public get vastAndVpaidPage(): VastAndVpaidPage {
return this.getPage(VastAndVpaidPage);
}
}
export default PageManager;
19 changes: 19 additions & 0 deletions test/e2e/src/pom/vastAndVpaidPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const SINGLE_VIDEO_WITH_ADS_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';
const PLAYLIST_WITH_ADS_VIDEO_SELECTOR = '//*[@id="player-playlist_html5_api"]';

/**
* Video player examples vast and vpaid page object
*/
export class VastAndVpaidPage extends BasePage {
public singleVideoWithAdsVideoComponent: VideoComponent;
public playlistWithAdsVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.singleVideoWithAdsVideoComponent = new VideoComponent(page, SINGLE_VIDEO_WITH_ADS_VIDEO_SELECTOR);
this.playlistWithAdsVideoComponent = new VideoComponent(page, PLAYLIST_WITH_ADS_VIDEO_SELECTOR);
}
}
Loading