diff --git a/test/e2e/specs/profilesPage.spec.ts b/test/e2e/specs/profilesPage.spec.ts new file mode 100644 index 00000000..9984d317 --- /dev/null +++ b/test/e2e/specs/profilesPage.spec.ts @@ -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); + }); +}); diff --git a/test/e2e/src/pom/PageManager.ts b/test/e2e/src/pom/PageManager.ts index f00d5b53..0dd6aee0 100644 --- a/test/e2e/src/pom/PageManager.ts +++ b/test/e2e/src/pom/PageManager.ts @@ -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, @@ -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; diff --git a/test/e2e/src/pom/profilesPage.ts b/test/e2e/src/pom/profilesPage.ts new file mode 100644 index 00000000..1d9e62e8 --- /dev/null +++ b/test/e2e/src/pom/profilesPage.ts @@ -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); + } +}