diff --git a/test/e2e/specs/apiAndEventsPage.spec.ts b/test/e2e/specs/apiAndEventsPage.spec.ts new file mode 100644 index 00000000..232b8a67 --- /dev/null +++ b/test/e2e/specs/apiAndEventsPage.spec.ts @@ -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); + }); +}); diff --git a/test/e2e/src/pom/PageManager.ts b/test/e2e/src/pom/PageManager.ts index 19359c2d..b496aabb 100644 --- a/test/e2e/src/pom/PageManager.ts +++ b/test/e2e/src/pom/PageManager.ts @@ -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, @@ -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; diff --git a/test/e2e/src/pom/apiAndEventsPage.ts b/test/e2e/src/pom/apiAndEventsPage.ts new file mode 100644 index 00000000..79453f5d --- /dev/null +++ b/test/e2e/src/pom/apiAndEventsPage.ts @@ -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); + } +}