Skip to content

Commit 3de2506

Browse files
authored
me-17993: test if videos are playing on ESM colors api page and adding… (#837)
* vp test: test if videos are playing on ESM colors api page and adding ids to video elements on ESM colors api page * vp test: test if videos are playing on ESM colors api page
1 parent 44375cd commit 3de2506

4 files changed

Lines changed: 40 additions & 18 deletions

File tree

docs/es-modules/colors.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ <h3 class="text-primary">Player 1</h3>
2828
data-cld-source='{ "publicId": "dog", "info": { "title": "Sea turtle", "subtitle": "Short movie about a sea turtle" } }'
2929
data-cld-colors='{ "base": "#0b602b", "accent": "#cddc39", "text": "#fff" }'
3030
class="cld-video-player cld-fluid"
31+
id="player-1"
3132
></video>
3233
</div>
3334
<h3 class="text-primary">Player 2</h3>
@@ -38,6 +39,7 @@ <h3 class="text-primary">Player 2</h3>
3839
data-cld-source='{ "publicId": "sea_turtle", "info": { "title": "Sea turtle", "subtitle": "Short movie about a sea turtle" } }'
3940
data-cld-colors='{ "base": "#111", "accent": "#03a9f4", "text": "#ffeb3b" }'
4041
class="cld-video-player cld-fluid cld-video-player-skin-dark"
42+
id="player-2"
4143
></video>
4244
</div>
4345

@@ -49,6 +51,7 @@ <h3 class="text-primary">Player 3</h3>
4951
data-cld-source='{ "publicId": "elephants", "info": { "title": "Elephants", "subtitle": "Short movie about elephants" } }'
5052
data-cld-colors='{ "base": "#ffffff", "accent": "#676a46", "text": "#007d29" }'
5153
class="cld-video-player cld-fluid cld-video-player-skin-light"
54+
id="player-3"
5255
></video>
5356
</div>
5457

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { vpTest } from '../../fixtures/vpTest';
2+
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
3+
import { getEsmLinkByName } from '../../testData/esmPageLinksData';
4+
import { ESM_URL } from '../../testData/esmUrl';
5+
import { testColorsApiPageVideoIsPlaying } from '../commonSpecs/colorsApiPageVideoPlaying';
6+
7+
const link = getEsmLinkByName(ExampleLinkName.ColorsAPI);
8+
9+
vpTest(`Test if 3 videos on ESM colors API page are playing as expected`, async ({ page, pomPages }) => {
10+
await page.goto(ESM_URL);
11+
await testColorsApiPageVideoIsPlaying(page, pomPages, link);
12+
});
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
import { vpTest } from '../../fixtures/vpTest';
2-
import { test } from '@playwright/test';
3-
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
42
import { getLinkByName } from '../../testData/pageLinksData';
53
import { ExampleLinkName } from '../../testData/ExampleLinkNames';
4+
import { testColorsApiPageVideoIsPlaying } from '../commonSpecs/colorsApiPageVideoPlaying';
65

76
const link = getLinkByName(ExampleLinkName.ColorsAPI);
87

98
vpTest(`Test if 3 videos on colors API page are playing as expected`, async ({ page, pomPages }) => {
10-
await test.step('Navigate to colors API page by clicking on link', async () => {
11-
await pomPages.mainPage.clickLinkByName(link.name);
12-
await waitForPageToLoadWithTimeout(page, 5000);
13-
});
14-
await test.step('Validating that modified color video is playing', async () => {
15-
await pomPages.colorsApiPage.colorsApiColorSkinVideoComponent.validateVideoIsPlaying(true);
16-
});
17-
await test.step('Validating that dark skin video video is playing', async () => {
18-
await pomPages.colorsApiPage.colorsApiDarkSkinVideoComponent.validateVideoIsPlaying(true);
19-
});
20-
await test.step('Scroll until light skin video element is visible', async () => {
21-
await pomPages.colorsApiPage.colorsApiLightSkinVideoComponent.locator.scrollIntoViewIfNeeded();
22-
});
23-
await test.step('Validating that light skin video is playing', async () => {
24-
await pomPages.colorsApiPage.colorsApiLightSkinVideoComponent.validateVideoIsPlaying(true);
25-
});
9+
await testColorsApiPageVideoIsPlaying(page, pomPages, link);
2610
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Page, test } from '@playwright/test';
2+
import { waitForPageToLoadWithTimeout } from '../../src/helpers/waitForPageToLoadWithTimeout';
3+
import PageManager from '../../src/pom/PageManager';
4+
import { ExampleLinkType } from '../../types/exampleLinkType';
5+
6+
export async function testColorsApiPageVideoIsPlaying(page: Page, pomPages: PageManager, link: ExampleLinkType) {
7+
await test.step('Navigate to colors API page by clicking on link', async () => {
8+
await pomPages.mainPage.clickLinkByName(link.name);
9+
await waitForPageToLoadWithTimeout(page, 5000);
10+
});
11+
await test.step('Validating that modified color video is playing', async () => {
12+
await pomPages.colorsApiPage.colorsApiColorSkinVideoComponent.validateVideoIsPlaying(true);
13+
});
14+
await test.step('Validating that dark skin video video is playing', async () => {
15+
await pomPages.colorsApiPage.colorsApiDarkSkinVideoComponent.validateVideoIsPlaying(true);
16+
});
17+
await test.step('Scroll until light skin video element is visible', async () => {
18+
await pomPages.colorsApiPage.colorsApiLightSkinVideoComponent.locator.scrollIntoViewIfNeeded();
19+
});
20+
await test.step('Validating that light skin video is playing', async () => {
21+
await pomPages.colorsApiPage.colorsApiLightSkinVideoComponent.validateVideoIsPlaying(true);
22+
});
23+
}

0 commit comments

Comments
 (0)