File tree Expand file tree Collapse file tree 4 files changed +51
-2
lines changed
Expand file tree Collapse file tree 4 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,12 @@ export class VideoComponent extends BaseComponent {
3434 * Validates whether the video is currently playing.
3535 * This method uses the `isPaused` function to determine the current state of the video.
3636 * expectedPlaying - A boolean indicating the expected playback state of the video.
37+ * timeout - Optional. The maximum time (in milliseconds) to wait for the validation. Defaults to 3000ms if not provided.
3738 * Pass `true` if the video is expected to be playing, or `false` if it is expected to be paused.
3839 */
39- public async validateVideoIsPlaying ( expectedPlaying : boolean ) : Promise < void > {
40+ public async validateVideoIsPlaying ( expectedPlaying : boolean , timeout : number = 3000 ) : Promise < void > {
4041 await expect ( async ( ) => {
4142 expect ( await this . isPaused ( ) ) . not . toEqual ( expectedPlaying ) ;
42- } ) . toPass ( { intervals : [ 500 ] , timeout : 3000 } ) ;
43+ } ) . toPass ( { intervals : [ 500 ] , timeout } ) ;
4344 }
4445}
Original file line number Diff line number Diff line change 1+ import { vpTest } from '../fixtures/vpTest' ;
2+ import { test } from '@playwright/test' ;
3+ import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout' ;
4+ import { getLinkByName } from '../testData/pageLinksData' ;
5+ import { ExampleLinkName } from '../testData/ExampleLinkNames' ;
6+
7+ const link = getLinkByName ( ExampleLinkName . VASTAndVPAIDSupport ) ;
8+
9+ vpTest ( `Test if 2 videos on vast and vpaid page are playing as expected` , async ( { page, pomPages } ) => {
10+ await test . step ( 'Navigate to vast and vpaid page by clicking on link' , async ( ) => {
11+ await pomPages . mainPage . clickLinkByName ( link . name ) ;
12+ await waitForPageToLoadWithTimeout ( page , 5000 ) ;
13+ } ) ;
14+ await test . step ( 'Click on play button of single video with ads to play video' , async ( ) => {
15+ return pomPages . vastAndVpaidPage . singleVideoWithAdsVideoComponent . clickPlay ( ) ;
16+ } ) ;
17+ //Sending timeout of 12 seconds to wait until the ad finishes (10 sec) and the video will start
18+ await test . step ( 'Validating that single video with ads is playing' , async ( ) => {
19+ await pomPages . vastAndVpaidPage . singleVideoWithAdsVideoComponent . validateVideoIsPlaying ( true , 12000 ) ;
20+ } ) ;
21+ await test . step ( 'Validating that playlist with ads video is playing' , async ( ) => {
22+ await pomPages . vastAndVpaidPage . playlistWithAdsVideoComponent . validateVideoIsPlaying ( true , 12000 ) ;
23+ } ) ;
24+ } ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { SeekThumbnailsPage } from './seekThumbnailsPage';
2626import { ShoppableVideosPage } from './shoppableVideosPage' ;
2727import { SubtitlesAndCaptionsPage } from './subtitlesAndCaptionsPage' ;
2828import { VideoTransformationsPage } from './videoTransformationsPage' ;
29+ import { VastAndVpaidPage } from './vastAndVpaidPage' ;
2930
3031/**
3132 * Page manager,
@@ -181,5 +182,9 @@ export class PageManager {
181182 public get videoTransformationsPage ( ) : VideoTransformationsPage {
182183 return this . getPage ( VideoTransformationsPage ) ;
183184 }
185+
186+ public get vastAndVpaidPage ( ) : VastAndVpaidPage {
187+ return this . getPage ( VastAndVpaidPage ) ;
188+ }
184189}
185190export default PageManager ;
Original file line number Diff line number Diff line change 1+ import { Page } from '@playwright/test' ;
2+ import { VideoComponent } from '../../components/videoComponent' ;
3+ import { BasePage } from './BasePage' ;
4+ const SINGLE_VIDEO_WITH_ADS_VIDEO_SELECTOR = '//*[@id="player_html5_api"]' ;
5+ const PLAYLIST_WITH_ADS_VIDEO_SELECTOR = '//*[@id="player-playlist_html5_api"]' ;
6+
7+ /**
8+ * Video player examples vast and vpaid page object
9+ */
10+ export class VastAndVpaidPage extends BasePage {
11+ public singleVideoWithAdsVideoComponent : VideoComponent ;
12+ public playlistWithAdsVideoComponent : VideoComponent ;
13+
14+ constructor ( page : Page ) {
15+ super ( page ) ;
16+ this . singleVideoWithAdsVideoComponent = new VideoComponent ( page , SINGLE_VIDEO_WITH_ADS_VIDEO_SELECTOR ) ;
17+ this . playlistWithAdsVideoComponent = new VideoComponent ( page , PLAYLIST_WITH_ADS_VIDEO_SELECTOR ) ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments