Skip to content

Commit

Permalink
vp test: tests if video is playing on recommendations, seek thumbnail…
Browse files Browse the repository at this point in the history
…s and shoppable videos pages (#790)
  • Loading branch information
ShayLevi authored Jan 8, 2025
1 parent 6422dfa commit 3a3c712
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/e2e/specs/recommendationsPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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.Recommendations);

vpTest(`Test if video on recommendations page is playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to recommendations page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Validating that recommendations video is playing', async () => {
await pomPages.recommendationsPage.recommendationsVideoComponent.validateVideoIsPlaying(true);
});
});
17 changes: 17 additions & 0 deletions test/e2e/specs/seekThumbnailsPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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.SeekThumbnails);

vpTest(`Test if video on seek thumbnails page is playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to seek thumbnails page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Validating that seek thumbnails video is playing', async () => {
await pomPages.seekThumbnailsPage.seekThumbnailsVideoComponent.validateVideoIsPlaying(true);
});
});
20 changes: 20 additions & 0 deletions test/e2e/specs/shoppableVideosPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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.ShoppableVideos);

vpTest(`Test if video on shoppable videos page is playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to shoppable video page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Click on play button of shoppable videos to play video', async () => {
return pomPages.shoppableVideosPage.shoppableVideosVideoComponent.clickPlay();
});
await test.step('Validating that seek thumbnails video is playing', async () => {
await pomPages.shoppableVideosPage.shoppableVideosVideoComponent.validateVideoIsPlaying(true);
});
});
15 changes: 15 additions & 0 deletions test/e2e/src/pom/PageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import { PlaylistByTagPage } from './playlistByTagPage';
import { PosterOptionsPage } from './posterOptionsPage';
import { ProfilesPage } from './profilesPage';
import { RawUrlPage } from './rawUrlPage';
import { RecommendationsPage } from './recommendationsPage';
import { SeekThumbnailsPage } from './seekThumbnailsPage';
import { ShoppableVideosPage } from './shoppableVideosPage';

/**
* Page manager,
Expand Down Expand Up @@ -156,5 +159,17 @@ export class PageManager {
public get rawUrlPage(): RawUrlPage {
return this.getPage(RawUrlPage);
}

public get recommendationsPage(): RecommendationsPage {
return this.getPage(RecommendationsPage);
}

public get seekThumbnailsPage(): SeekThumbnailsPage {
return this.getPage(SeekThumbnailsPage);
}

public get shoppableVideosPage(): ShoppableVideosPage {
return this.getPage(ShoppableVideosPage);
}
}
export default PageManager;
16 changes: 16 additions & 0 deletions test/e2e/src/pom/recommendationsPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const RECOMMENDATIONS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';

/**
* Video player examples recommendations page object
*/
export class RecommendationsPage extends BasePage {
public recommendationsVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.recommendationsVideoComponent = new VideoComponent(page, RECOMMENDATIONS_PAGE_VIDEO_SELECTOR);
}
}
16 changes: 16 additions & 0 deletions test/e2e/src/pom/seekThumbnailsPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const SEEK_THUMBNAILS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';

/**
* Video player examples seek thumbnails page object
*/
export class SeekThumbnailsPage extends BasePage {
public seekThumbnailsVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.seekThumbnailsVideoComponent = new VideoComponent(page, SEEK_THUMBNAILS_PAGE_VIDEO_SELECTOR);
}
}
16 changes: 16 additions & 0 deletions test/e2e/src/pom/shoppableVideosPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const SHOPPABLE_VIDEOS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';

/**
* Video player examples shoppable vidoes page object
*/
export class ShoppableVideosPage extends BasePage {
public shoppableVideosVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.shoppableVideosVideoComponent = new VideoComponent(page, SHOPPABLE_VIDEOS_PAGE_VIDEO_SELECTOR);
}
}

0 comments on commit 3a3c712

Please sign in to comment.