Skip to content

Commit

Permalink
vp test: test if videos on profiles page are playing (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayLevi authored Jan 7, 2025
1 parent 563445d commit 359facd
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/e2e/specs/profilesPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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.Profiles);

vpTest(`Test if 3 videos on profiles page are playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to profiles page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Validating that default profile video is playing', async () => {
await pomPages.profilesPage.profilesDefaultProfileVideoComponent.validateVideoIsPlaying(true);
});
await test.step('Scroll until custom profile video element is visible', async () => {
await pomPages.profilesPage.profilesCustomProfileVideoComponent.locator.scrollIntoViewIfNeeded();
});
await test.step('Validating that custom profile video is playing', async () => {
await pomPages.profilesPage.profilesCustomProfileVideoComponent.validateVideoIsPlaying(true);
});
await test.step('Scroll until custom profile overrides video element is visible', async () => {
await pomPages.profilesPage.profilesCustomProfileOverridesVideoComponent.locator.scrollIntoViewIfNeeded();
});
await test.step('Validating that custom profile overrides video is playing', async () => {
await pomPages.profilesPage.profilesCustomProfileOverridesVideoComponent.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 @@ -19,6 +19,7 @@ import { MultiplePlayersPage } from './multiplePlayersPage';
import { PlaylistPage } from './playlistPage';
import { PlaylistByTagPage } from './playlistByTagPage';
import { PosterOptionsPage } from './posterOptionsPage';
import { ProfilesPage } from './profilesPage';

/**
* Page manager,
Expand Down Expand Up @@ -146,5 +147,9 @@ export class PageManager {
public get posterOptionsPage(): PosterOptionsPage {
return this.getPage(PosterOptionsPage);
}

public get profilesPage(): ProfilesPage {
return this.getPage(ProfilesPage);
}
}
export default PageManager;
22 changes: 22 additions & 0 deletions test/e2e/src/pom/profilesPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const PROFILES_PAGE_DEFAULT_PROFILE_VIDEO_SELECTOR = '//*[@id="player-default-profile_html5_api"]';
const PROFILES_PAGE_CUSTOM_PROFILE_VIDEO_SELECTOR = '//*[@id="player-custom-profile_html5_api"]';
const PROFILES_PAGE_CUSTOM_PROFILE_OVERRIDES_VIDEO_SELECTOR = '//*[@id="player-custom-profile-overrides_html5_api"]';

/**
* Video player examples profiles page object
*/
export class ProfilesPage extends BasePage {
public profilesDefaultProfileVideoComponent: VideoComponent;
public profilesCustomProfileVideoComponent: VideoComponent;
public profilesCustomProfileOverridesVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.profilesDefaultProfileVideoComponent = new VideoComponent(page, PROFILES_PAGE_DEFAULT_PROFILE_VIDEO_SELECTOR);
this.profilesCustomProfileVideoComponent = new VideoComponent(page, PROFILES_PAGE_CUSTOM_PROFILE_VIDEO_SELECTOR);
this.profilesCustomProfileOverridesVideoComponent = new VideoComponent(page, PROFILES_PAGE_CUSTOM_PROFILE_OVERRIDES_VIDEO_SELECTOR);
}
}

0 comments on commit 359facd

Please sign in to comment.