Skip to content

Commit 118dbde

Browse files
authored
vp test: test if video on api and events page is playing (#755)
1 parent 7de699f commit 118dbde

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { vpTest } from '../fixtures/vpTest';
2+
import { expect, 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+
// Link to API and Events page
8+
const link = getLinkByName(ExampleLinkName.APIAndEvents);
9+
/**
10+
* Testing if video on API and Events page is playing by checking that is pause return false.
11+
*/
12+
vpTest(`Test if video on API and Events page is playing as expected`, async ({ page, pomPages }) => {
13+
await test.step('Navigate to api and events page by clicking on link', async () => {
14+
await pomPages.mainPage.clickLinkByName(link.name);
15+
await waitForPageToLoadWithTimeout(page, 5000);
16+
});
17+
await test.step('Validating that the video is playing (in case isPause is false)', async () => {
18+
expect(await pomPages.apiAndEventsPage.apiAndEventsVideoComponent.isPaused()).toEqual(false);
19+
});
20+
});

test/e2e/src/pom/PageManager.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { HighlightsGraphPage } from './highlightsGraphPage';
33
import { BasePage } from './BasePage';
44
import { MainPage } from './mainPage';
55
import { AnalyticsPage } from './analyticsPage';
6+
import { ApiAndEventsPage } from './apiAndEventsPage';
67

78
/**
89
* Page manager,
@@ -48,5 +49,12 @@ export class PageManager {
4849
public get analyticsPage(): AnalyticsPage {
4950
return this.getPage(AnalyticsPage);
5051
}
52+
53+
/**
54+
* Returns API and Events page object
55+
*/
56+
public get apiAndEventsPage(): ApiAndEventsPage {
57+
return this.getPage(ApiAndEventsPage);
58+
}
5159
}
5260
export default PageManager;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Page } from '@playwright/test';
2+
import { VideoComponent } from '../../components/videoComponent';
3+
import { BasePage } from './BasePage';
4+
const API_AND_EVENTS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';
5+
6+
/**
7+
* Video player examples api and events page object
8+
*/
9+
export class ApiAndEventsPage extends BasePage {
10+
public apiAndEventsVideoComponent: VideoComponent;
11+
12+
constructor(page: Page) {
13+
super(page);
14+
this.apiAndEventsVideoComponent = new VideoComponent(page, API_AND_EVENTS_PAGE_VIDEO_SELECTOR);
15+
}
16+
}

0 commit comments

Comments
 (0)