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

update video tests #431

Closed
wants to merge 6 commits into from
Closed
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
151 changes: 76 additions & 75 deletions selectors/milo/video.block.page.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,76 @@
export default class Video {
constructor(page, nth=0) {
this.page = page;

// video locators
this.section = this.page.locator('.section').nth(nth);
this.content = this.page.locator('.content').nth(nth);
this.fragment = this.page.locator('.fragment')
this.video = this.page.locator('.content video');
this.videoSource = this.video.locator('source');
this.miloVideo = this.page.locator('.milo-video');
this.iframe = this.page.locator('iframe').first();
this.mpcPlayerTitle = this.page.frameLocator('iframe').first().locator('.mpc-player__title');
this.mpcPlayButton = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Play"]');
this.mpcMutedButton = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Mute"]');
this.mpcMutedLabel = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Mute"] span');
this.youtubePlayButton = this.page.frameLocator('iframe').first().locator('button[aria-label="Play"]');
this.modalVideo = this.fragment.locator('video')
this.modalVideoSource = this.modalVideo.locator('source');
this.consonantCardsGrid = this.page.locator('.consonant-CardsGrid');
this.consonantCards = this.consonantCardsGrid.locator('.card.consonant-Card');
this.video = this.page.locator('.content video');
this.videoSource = this.video.locator('source');

// video block attributes
this.attributes = {
'video.default': {
'playsinline': '',
'controls': '',
},
'video.source': {
'type': 'video/mp4',
'src': /.*.mp4/,
},
'video.autoplay': {
'playsinline': '',
'autoplay': '',
'loop': '',
'muted': ''
},
'video.autoplay.once': {
'playsinline': '',
'autoplay': '',
'muted': ''
},
'video.hover.play': {
'playsinline': '',
'autoplay': '',
'muted': '',
'data-hoverplay': '',
'data-mouseevent': 'true'
},
'iframe-mpc': {
'class': 'adobetv',
'scrolling': 'no',
'allowfullscreen': '',
'loading': 'lazy',
},
'iframe-youtube': {
'class': 'youtube',
'scrolling': 'no',
'allowfullscreen': '',
'allow': 'encrypted-media; accelerometer; gyroscope; picture-in-picture',
},
'analytics': {
'section.daa-lh': {
'daa-lh': /s[1-9]/,
},
'content.daa-lh': {
'daa-lh': /b[1-9]|content|default|default/,
},
},
};
}
}
export default class Video {
constructor(page, nth = 0) {
this.page = page;

// Video locators
this.section = this.page.locator('.section').nth(nth);
this.content = this.page.locator('.content').nth(nth);
this.fragment = this.page.locator('.fragment');
// Remove duplicate 'video' and 'videoSource' declarations
this.video = this.page.locator('.content video');
this.videoSource = this.video.locator('source');
this.miloVideo = this.page.locator('.milo-video');
this.iframe = this.page.locator('iframe').first();
this.mpcPlayerTitle = this.page.frameLocator('iframe').first().locator('.mpc-player__title');
this.mpcPlayButton = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Play"]');
this.mpcMutedButton = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Mute"]');
this.mpcMutedLabel = this.page.frameLocator('iframe').first().locator('.mpc-player button[aria-label="Mute"] span');
this.youtubePlayButton = this.page.frameLocator('iframe').first().locator('button[aria-label="Play"]');
this.liteYoutube = this.page.locator('lite-youtube');
this.ltyPlaybtn = this.liteYoutube.locator('.lty-playbtn');
this.modalVideo = this.fragment.locator('video');
this.modalVideoSource = this.modalVideo.locator('source');
this.consonantCardsGrid = this.page.locator('.consonant-CardsGrid');
this.consonantCards = this.consonantCardsGrid.locator('.card.consonant-Card');

// Video block attributes
this.attributes = {
'video.default': {
playsinline: '',
controls: '',
},
'video.source': {
type: 'video/mp4',
src: /.*.mp4/,
},
'video.autoplay': {
playsinline: '',
autoplay: '',
loop: '',
muted: '',
},
'video.autoplay.once': {
playsinline: '',
autoplay: '',
muted: '',
},
'video.hover.play': {
playsinline: '',
autoplay: '',
muted: '',
'data-hoverplay': '',
'data-mouseevent': 'true',
},
'iframe-mpc': {
class: 'adobetv',
scrolling: 'no',
allowfullscreen: '',
loading: 'lazy',
},
'iframe-youtube': {
class: 'youtube',
scrolling: 'no',
allowfullscreen: '',
allow: 'encrypted-media; accelerometer; gyroscope; picture-in-picture',
},
analytics: {
'section.daa-lh': {

Check failure on line 67 in selectors/milo/video.block.page.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unexpected line break after this opening brace. Raw Output: {"ruleId":"object-curly-newline","severity":2,"message":"Unexpected line break after this opening brace.","line":67,"column":27,"nodeType":"ObjectExpression","messageId":"unexpectedLinebreakAfterOpeningBrace","endLine":67,"endColumn":28,"fix":{"range":[2499,2510],"text":""}}
'daa-lh': /s[1-9]/,
},

Check failure on line 69 in selectors/milo/video.block.page.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unexpected line break before this closing brace. Raw Output: {"ruleId":"object-curly-newline","severity":2,"message":"Unexpected line break before this closing brace.","line":69,"column":9,"nodeType":"ObjectExpression","messageId":"unexpectedLinebreakBeforeClosingBrace","endLine":69,"endColumn":10,"fix":{"range":[2529,2538],"text":""}}
'content.daa-lh': {

Check failure on line 70 in selectors/milo/video.block.page.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unexpected line break after this opening brace. Raw Output: {"ruleId":"object-curly-newline","severity":2,"message":"Unexpected line break after this opening brace.","line":70,"column":27,"nodeType":"ObjectExpression","messageId":"unexpectedLinebreakAfterOpeningBrace","endLine":70,"endColumn":28,"fix":{"range":[2568,2579],"text":""}}
'daa-lh': /b[1-9]|content|default|default/,
},

Check failure on line 72 in selectors/milo/video.block.page.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unexpected line break before this closing brace. Raw Output: {"ruleId":"object-curly-newline","severity":2,"message":"Unexpected line break before this closing brace.","line":72,"column":9,"nodeType":"ObjectExpression","messageId":"unexpectedLinebreakBeforeClosingBrace","endLine":72,"endColumn":10,"fix":{"range":[2622,2631],"text":""}}
},
};
}
}
18 changes: 9 additions & 9 deletions tests/milo/video.block.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ test.describe('Milo Video Block test suite', () => {
test(`${features[6].name},${features[6].tags}`, async ({ page, baseURL }) => {
test.slow();
console.info(`[Test Page]: ${baseURL}${features[6].path}${miloLibs}`);
const { data } = features[6];
// const { data } = features[6];

await test.step('step-1: Go to video block test page', async () => {
await page.goto(`${baseURL}${features[6].path}${miloLibs}`);
Expand All @@ -155,14 +155,14 @@ test.describe('Milo Video Block test suite', () => {
});

await test.step('step-2: Verify video block content/specs', async () => {
await expect(await video.miloVideo).toBeVisible();
await expect(await video.iframe).toBeVisible();
await expect(await video.youtubePlayButton).toBeVisible();
await expect(await video.youtubePlayButton).toHaveAttribute('title', 'Play');

await expect(await video.iframe).toHaveAttribute('title', data.iframeTitle);
await expect(await video.iframe).toHaveAttribute('src', data.source);
expect(await webUtil.verifyAttributes_(video.iframe, video.attributes['iframe-youtube'])).toBeTruthy();
await expect(video.miloVideo).toBeVisible();
await expect(video.liteYoutube).toBeVisible();
await expect(video.ltyPlaybtn).toBeVisible();
// await expect(await video.ltyPlaybtn).toHaveAttribute('title', 'Play');

// await expect(await video.liteYoutube).toHaveAttribute('title', data.iframeTitle);
// await expect(await video.liteYoutube).toHaveAttribute('src', data.source);
// expect(await webUtil.verifyAttributes_(video.liteYoutube, video.attributes['lite-youtube'])).toBeTruthy();
});
});

Expand Down
Loading