Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.audioPlayerFirstVideoComponent.clickPlay();
});
await test.step('Validating that the first video is playing (in case isPause is false)', async () => {
expect(await pomPages.audioPlayerPage.audioPlayerFirstVideoComponent.isPaused()).toEqual(false);
});
await test.step('Click on play button of second video player to play video', async () => {
return pomPages.audioPlayerPage.audioPlayerSecondVideoComponent.clickPlay();
});
await test.step('Validating that the second video is playing (in case isPause is false)', async () => {
expect(await pomPages.audioPlayerPage.audioPlayerSecondVideoComponent.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_FIRST_VIDEO_SELECTOR = '//*[@id="player_html5_api"]';
const AUDIO_PLAYER_SECOND_VIDEO_SELECTOR = '//*[@id="player-t_html5_api"]';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you give it more meaningful names instead of firstVideo, secondVideo?

Copy link
Contributor Author

@ShayLevi ShayLevi Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to audioPlayerVideoComponent and audioPlayerWithTransformationVideoComponent

/**
* Video player examples audio player page object
*/
export class AudioPlayerPage extends BasePage {
public audioPlayerFirstVideoComponent: VideoComponent;
public audioPlayerSecondVideoComponent: VideoComponent;

constructor(page: Page) {
super(page);
this.audioPlayerFirstVideoComponent = new VideoComponent(page, AUDIO_PLAYER_FIRST_VIDEO_SELECTOR);
this.audioPlayerSecondVideoComponent = new VideoComponent(page, AUDIO_PLAYER_SECOND_VIDEO_SELECTOR);
}
}
Loading