Skip to content

Commit d5ccac5

Browse files
authored
Merge pull request #752 from cloudinary/update-master-from-edge
chore: update master
2 parents b163910 + b408157 commit d5ccac5

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

docs/profiles.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
<script type="text/javascript" src="./scripts.js"></script>
2424

2525
<script type="text/javascript">
26+
window.addEventListener('load', async () => {
27+
const playerWithDefaultProfile = await cloudinary.player('player-default-profile', {
28+
cloudName: 'demo',
29+
profile: 'cld-default',
2630
window.addEventListener('load', async () => {
2731
const playerWithDefaultProfile = await cloudinary.player('player-default-profile', {
2832
cloudName: 'demo',
@@ -32,6 +36,12 @@
3236
playerWithDefaultProfile.source('sea_turtle');
3337
}, false);
3438

39+
window.addEventListener('load', async function() {
40+
const playerWithCustomProfile = await cloudinary.player('player-custom-profile', {
41+
cloudName: 'prod',
42+
profile: 'myCustomProfile',
43+
}, false);
44+
3545
window.addEventListener('load', async function() {
3646
const playerWithCustomProfile = await cloudinary.player('player-custom-profile', {
3747
cloudName: 'prod',
@@ -54,6 +64,20 @@
5464

5565
playerWithCustomProfileAndOverrides.source('samples/cld-sample-video');
5666
}, false);
67+
68+
window.addEventListener('load', async function() {
69+
const playerWithCustomProfileAndOverrides = await cloudinary.player('player-custom-profile-overrides', {
70+
cloudName: 'prod',
71+
profile: 'myCustomProfile',
72+
colors: {
73+
base: "#1532a8"
74+
},
75+
seekThumbnails: false,
76+
aiHighlightsGraph: true,
77+
});
78+
79+
playerWithCustomProfileAndOverrides.source('samples/cld-sample-video');
80+
}, false);
5781
</script>
5882
</head>
5983
<body>
@@ -77,6 +101,34 @@ <h5>Player with default profile</h5>
77101

78102
<h3 class="mt-4">Example Code:</h3>
79103

104+
<pre>
105+
<code class="language-html">
106+
107+
&lt;video
108+
id="player-default-profile"
109+
controls
110+
autoplay
111+
muted
112+
class="cld-video-player"
113+
width="500"&gt;
114+
&lt;/video&gt;
115+
116+
</code>
117+
<code class="language-javascript">
118+
window.addEventListener('load', async function() {
119+
const playerWithDefaultProfile = await cloudinary.player('player-default-profile', {
120+
cloudName: 'demo',
121+
profile: 'cld-default',
122+
});
123+
124+
playerWithDefaultProfile.source('sea_turtle');
125+
}, false);
126+
</code>
127+
</pre>
128+
129+
<h5>Player with custom profile</h5>
130+
<h3 class="mt-4">Example Code:</h3>
131+
80132
<pre>
81133
<code class="language-html">
82134

@@ -155,6 +207,7 @@ <h3 class="mt-4">Example Code:</h3>
155207

156208
<pre>
157209
<code class="language-html">
210+
158211
&lt;video
159212
id="player-custom-profile-overrides"
160213
controls
@@ -163,6 +216,7 @@ <h3 class="mt-4">Example Code:</h3>
163216
class="cld-video-player"
164217
width="500"&gt;
165218
&lt;/video&gt;
219+
166220
</code>
167221
<code class="language-javascript">
168222
window.addEventListener('load', async function() {
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)