Skip to content

Commit f51a1e1

Browse files
authored
me-17954: test if video on analytics page is playing (#750)
* vp test: test if video on analytics page is playing * vp test: change component name based on review * vp test: rename spec file
1 parent 5c98ded commit f51a1e1

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 Analytics page
8+
const link = getLinkByName(ExampleLinkName.Analytics);
9+
/**
10+
* Testing if video on analytics page is playing by checking that is pause return false.
11+
*/
12+
vpTest(`Test if video on analytics page is playing as expected`, async ({ page, pomPages }) => {
13+
await test.step('Navigate to analytics 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.analyticsPage.analyticsVideoComponent.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
@@ -2,6 +2,7 @@ import { Page } from '@playwright/test';
22
import { HighlightsGraphPage } from './highlightsGraphPage';
33
import { BasePage } from './BasePage';
44
import { MainPage } from './mainPage';
5+
import { AnalyticsPage } from './analyticsPage';
56

67
/**
78
* Page manager,
@@ -40,5 +41,12 @@ export class PageManager {
4041
public get highlightGraphPage(): HighlightsGraphPage {
4142
return this.getPage(HighlightsGraphPage);
4243
}
44+
45+
/**
46+
* Returns Analytics page object
47+
*/
48+
public get analyticsPage(): AnalyticsPage {
49+
return this.getPage(AnalyticsPage);
50+
}
4351
}
4452
export default PageManager;

test/e2e/src/pom/analyticsPage.ts

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 ANALYTICS_PAGE_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';
5+
6+
/**
7+
* Video player examples analytics page object
8+
*/
9+
export class AnalyticsPage extends BasePage {
10+
public analyticsVideoComponent: VideoComponent;
11+
12+
constructor(page: Page) {
13+
super(page);
14+
this.analyticsVideoComponent = new VideoComponent(page, ANALYTICS_PAGE_VIDEO_SELECTOR);
15+
}
16+
}

0 commit comments

Comments
 (0)