Skip to content

Commit

Permalink
vp test: test if video on api and events page is playing
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayLevi committed Dec 9, 2024
1 parent f51a1e1 commit ada6ed8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/e2e/specs/apiAndEventsPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { vpTest } from '../fixtures/vpTest';
import { expect, test } from '@playwright/test';
import { waitForPageToLoadWithTimeout } from '../src/helpers/waitForPageToLoadWithTimeout';
import { getLinkByName } from '../testData/pageLinksData';
import { ExampleLinkName } from '../testData/ExampleLinkNames';

// Link to API and Events page
const link = getLinkByName(ExampleLinkName.APIAndEvents);
/**
* Testing if video on API and Events page is playing by checking that is pause return false.
*/
vpTest(`Test if video on API and Events page is playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to api and events page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Validating that the video is playing (in case isPause is false)', async () => {
expect(await pomPages.apiAndEventsPage.apiAndEventsVideoComponent.isPaused()).toEqual(false);
});
});
8 changes: 8 additions & 0 deletions test/e2e/src/pom/PageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { HighlightsGraphPage } from './highlightsGraphPage';
import { BasePage } from './BasePage';
import { MainPage } from './mainPage';
import { AnalyticsPage } from './analyticsPage';
import { ApiAndEventsPage } from './apiAndEventsPage';

/**
* Page manager,
Expand Down Expand Up @@ -48,5 +49,12 @@ export class PageManager {
public get analyticsPage(): AnalyticsPage {
return this.getPage(AnalyticsPage);
}

/**
* Returns API and Events page object
*/
public get apiAndEventsPage(): ApiAndEventsPage {
return this.getPage(ApiAndEventsPage);
}
}
export default PageManager;
16 changes: 16 additions & 0 deletions test/e2e/src/pom/apiAndEventsPage.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 API_AND_EVENTS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';

/**
* Video player examples api and events page object
*/
export class ApiAndEventsPage extends BasePage {
public apiAndEventsVideoComponent: VideoComponent;

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

0 comments on commit ada6ed8

Please sign in to comment.