Skip to content

Commit 359facd

Browse files
authored
vp test: test if videos on profiles page are playing (#785)
1 parent 563445d commit 359facd

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.Profiles);
8+
9+
vpTest(`Test if 3 videos on profiles page are playing as expected`, async ({ page, pomPages }) => {
10+
await test.step('Navigate to profiles 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 default profile video is playing', async () => {
15+
await pomPages.profilesPage.profilesDefaultProfileVideoComponent.validateVideoIsPlaying(true);
16+
});
17+
await test.step('Scroll until custom profile video element is visible', async () => {
18+
await pomPages.profilesPage.profilesCustomProfileVideoComponent.locator.scrollIntoViewIfNeeded();
19+
});
20+
await test.step('Validating that custom profile video is playing', async () => {
21+
await pomPages.profilesPage.profilesCustomProfileVideoComponent.validateVideoIsPlaying(true);
22+
});
23+
await test.step('Scroll until custom profile overrides video element is visible', async () => {
24+
await pomPages.profilesPage.profilesCustomProfileOverridesVideoComponent.locator.scrollIntoViewIfNeeded();
25+
});
26+
await test.step('Validating that custom profile overrides video is playing', async () => {
27+
await pomPages.profilesPage.profilesCustomProfileOverridesVideoComponent.validateVideoIsPlaying(true);
28+
});
29+
});

test/e2e/src/pom/PageManager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { MultiplePlayersPage } from './multiplePlayersPage';
1919
import { PlaylistPage } from './playlistPage';
2020
import { PlaylistByTagPage } from './playlistByTagPage';
2121
import { PosterOptionsPage } from './posterOptionsPage';
22+
import { ProfilesPage } from './profilesPage';
2223

2324
/**
2425
* Page manager,
@@ -146,5 +147,9 @@ export class PageManager {
146147
public get posterOptionsPage(): PosterOptionsPage {
147148
return this.getPage(PosterOptionsPage);
148149
}
150+
151+
public get profilesPage(): ProfilesPage {
152+
return this.getPage(ProfilesPage);
153+
}
149154
}
150155
export default PageManager;

test/e2e/src/pom/profilesPage.ts

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 PROFILES_PAGE_DEFAULT_PROFILE_VIDEO_SELECTOR = '//*[@id="player-default-profile_html5_api"]';
5+
const PROFILES_PAGE_CUSTOM_PROFILE_VIDEO_SELECTOR = '//*[@id="player-custom-profile_html5_api"]';
6+
const PROFILES_PAGE_CUSTOM_PROFILE_OVERRIDES_VIDEO_SELECTOR = '//*[@id="player-custom-profile-overrides_html5_api"]';
7+
8+
/**
9+
* Video player examples profiles page object
10+
*/
11+
export class ProfilesPage extends BasePage {
12+
public profilesDefaultProfileVideoComponent: VideoComponent;
13+
public profilesCustomProfileVideoComponent: VideoComponent;
14+
public profilesCustomProfileOverridesVideoComponent: VideoComponent;
15+
16+
constructor(page: Page) {
17+
super(page);
18+
this.profilesDefaultProfileVideoComponent = new VideoComponent(page, PROFILES_PAGE_DEFAULT_PROFILE_VIDEO_SELECTOR);
19+
this.profilesCustomProfileVideoComponent = new VideoComponent(page, PROFILES_PAGE_CUSTOM_PROFILE_VIDEO_SELECTOR);
20+
this.profilesCustomProfileOverridesVideoComponent = new VideoComponent(page, PROFILES_PAGE_CUSTOM_PROFILE_OVERRIDES_VIDEO_SELECTOR);
21+
}
22+
}

0 commit comments

Comments
 (0)