Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

me-17956: test if videos on audio player page are playing #762

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/e2e/specs/audioPlayerPage.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 audio player page
const link = getLinkByName(ExampleLinkName.AudioPlayer);
/**
* Testing if videos on audio player page are playing by checking that is pause return false.
*/
vpTest(`Test if 2 videos on audio player page are playing as expected`, async ({ page, pomPages }) => {
await test.step('Navigate to audio player page by clicking on link', async () => {
await pomPages.mainPage.clickLinkByName(link.name);
await waitForPageToLoadWithTimeout(page, 5000);
});
await test.step('Click on play button of first video player to play video', async () => {
return pomPages.audioPlayerPage.audioPlayerVideoComponent.clickPlay();
});
await test.step('Validating that the first video is playing (in case isPause is false)', async () => {
expect(await pomPages.audioPlayerPage.audioPlayerVideoComponent.isPaused()).toEqual(false);
});
await test.step('Click on play button of second video player to play video', async () => {
return pomPages.audioPlayerPage.audioPlayerWithTransformationVideoComponent.clickPlay();
});
await test.step('Validating that the second video is playing (in case isPause is false)', async () => {
expect(await pomPages.audioPlayerPage.audioPlayerWithTransformationVideoComponent.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 @@ -4,6 +4,7 @@ import { BasePage } from './BasePage';
import { MainPage } from './mainPage';
import { AnalyticsPage } from './analyticsPage';
import { ApiAndEventsPage } from './apiAndEventsPage';
import { AudioPlayerPage } from './audioPlayerPage';

/**
* Page manager,
Expand Down Expand Up @@ -56,5 +57,12 @@ export class PageManager {
public get apiAndEventsPage(): ApiAndEventsPage {
return this.getPage(ApiAndEventsPage);
}

/**
* Returns audio player page object
*/
public get audioPlayerPage(): AudioPlayerPage {
return this.getPage(AudioPlayerPage);
}
}
export default PageManager;
18 changes: 18 additions & 0 deletions test/e2e/src/pom/audioPlayerPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Page } from '@playwright/test';
import { VideoComponent } from '../../components/videoComponent';
import { BasePage } from './BasePage';
const AUDIO_PLAYER_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';
const AUDIO_PLAYER_WITH_TRANSFORMATION_VIDEO_SELECTOR = '//*[@id="player-t_html5_api"]';
/**
* Video player examples audio player page object
*/
export class AudioPlayerPage extends BasePage {
public audioPlayerVideoComponent: VideoComponent;
public audioPlayerWithTransformationVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.audioPlayerVideoComponent = new VideoComponent(page, AUDIO_PLAYER_VIDEO_SELECTOR);
this.audioPlayerWithTransformationVideoComponent = new VideoComponent(page, AUDIO_PLAYER_WITH_TRANSFORMATION_VIDEO_SELECTOR);
}
}
Loading