Skip to content

Commit c7f41d9

Browse files
authored
vp test: tests if videos are playing on video transformations page (#793)
1 parent da85029 commit c7f41d9

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.VideoTransformations);
8+
9+
vpTest(`Test if 3 videos on video transformations page are playing as expected`, async ({ page, pomPages }) => {
10+
await test.step('Navigate to video transformations page by clicking on link', async () => {
11+
await pomPages.mainPage.clickLinkByName(link.name);
12+
await waitForPageToLoadWithTimeout(page, 5000);
13+
});
14+
await test.step('Validating that via source transformation video is playing', async () => {
15+
await pomPages.videoTransformationsPage.viaSourceVideoComponent.validateVideoIsPlaying(true);
16+
});
17+
await test.step('Validating that via player transformation video is playing', async () => {
18+
await pomPages.videoTransformationsPage.viaPlayerVideoComponent.validateVideoIsPlaying(true);
19+
});
20+
await test.step('Scroll until data cld transformation video element is visible', async () => {
21+
await pomPages.videoTransformationsPage.viaDataCldTransformationsVideoComponent.locator.scrollIntoViewIfNeeded();
22+
});
23+
await test.step('Validating that via data cld transformation video is playing', async () => {
24+
await pomPages.videoTransformationsPage.viaDataCldTransformationsVideoComponent.validateVideoIsPlaying(true);
25+
});
26+
});

test/e2e/src/pom/PageManager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { RecommendationsPage } from './recommendationsPage';
2525
import { SeekThumbnailsPage } from './seekThumbnailsPage';
2626
import { ShoppableVideosPage } from './shoppableVideosPage';
2727
import { SubtitlesAndCaptionsPage } from './subtitlesAndCaptionsPage';
28+
import { VideoTransformationsPage } from './videoTransformationsPage';
2829

2930
/**
3031
* Page manager,
@@ -176,5 +177,9 @@ export class PageManager {
176177
public get subtitlesAndCaptionsVideosPage(): SubtitlesAndCaptionsPage {
177178
return this.getPage(SubtitlesAndCaptionsPage);
178179
}
180+
181+
public get videoTransformationsPage(): VideoTransformationsPage {
182+
return this.getPage(VideoTransformationsPage);
183+
}
179184
}
180185
export default PageManager;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Page } from '@playwright/test';
2+
import { VideoComponent } from '../../components/videoComponent';
3+
import { BasePage } from './BasePage';
4+
const VIA_SOURCE_VIDEO_SELECTOR = '//*[@id="player-1_html5_api"]';
5+
const VIA_PLAYER_VIDEO_SELECTOR = '//*[@id="player-2_html5_api"]';
6+
const VIA_DATA_CLD_TRANSFORMATIONS_VIDEO_SELECTOR = '//*[@id="player-3_html5_api"]';
7+
8+
/**
9+
* Video player examples video transformations page object
10+
*/
11+
export class VideoTransformationsPage extends BasePage {
12+
public viaSourceVideoComponent: VideoComponent;
13+
public viaPlayerVideoComponent: VideoComponent;
14+
public viaDataCldTransformationsVideoComponent: VideoComponent;
15+
16+
constructor(page: Page) {
17+
super(page);
18+
this.viaSourceVideoComponent = new VideoComponent(page, VIA_SOURCE_VIDEO_SELECTOR);
19+
this.viaPlayerVideoComponent = new VideoComponent(page, VIA_PLAYER_VIDEO_SELECTOR);
20+
this.viaDataCldTransformationsVideoComponent = new VideoComponent(page, VIA_DATA_CLD_TRANSFORMATIONS_VIDEO_SELECTOR);
21+
}
22+
}

0 commit comments

Comments
 (0)