Skip to content

Commit

Permalink
update video tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySun9 committed Sep 6, 2024
1 parent 67987f6 commit 87b352b
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 78 deletions.
152 changes: 77 additions & 75 deletions selectors/milo/video.block.page.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,77 @@
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');
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');
this.video = this.page.locator('.content video');
this.videoSource = this.video.locator('source');

// video block attributes
this.attributes = {
'video.default': {
'playsinline': '',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'playsinline' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'playsinline' found.","line":30,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":30,"endColumn":26,"fix":{"range":[1642,1655],"text":"playsinline"}}
'controls': '',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'controls' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'controls' found.","line":31,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":31,"endColumn":23,"fix":{"range":[1669,1679],"text":"controls"}}
},
'video.source': {
'type': 'video/mp4',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'type' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'type' found.","line":34,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":34,"endColumn":28,"fix":{"range":[1726,1732],"text":"type"}}
'src': /.*.mp4/,

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'src' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'src' found.","line":35,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":35,"endColumn":24,"fix":{"range":[1755,1760],"text":"src"}}
},
'video.autoplay': {
'playsinline': '',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'playsinline' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'playsinline' found.","line":38,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":38,"endColumn":26,"fix":{"range":[1815,1828],"text":"playsinline"}}
'autoplay': '',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'autoplay' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'autoplay' found.","line":39,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":39,"endColumn":23,"fix":{"range":[1842,1852],"text":"autoplay"}}
'loop': '',

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'loop' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'loop' found.","line":40,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":40,"endColumn":19,"fix":{"range":[1866,1872],"text":"loop"}}
'muted': ''

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Unnecessarily quoted property 'muted' found. Raw Output: {"ruleId":"quote-props","severity":2,"message":"Unnecessarily quoted property 'muted' found.","line":41,"column":9,"nodeType":"Property","messageId":"unnecessarilyQuotedProperty","endLine":41,"endColumn":20,"fix":{"range":[1886,1893],"text":"muted"}}

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

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 Missing trailing comma. Raw Output: {"ruleId":"comma-dangle","severity":2,"message":"Missing trailing comma.","line":41,"column":20,"nodeType":"Property","messageId":"missing","endLine":42,"endColumn":1,"fix":{"range":[1895,1905],"text":"'',\n }"}}
},
'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/,
},
},
};
}
}
6 changes: 3 additions & 3 deletions tests/milo/video.block.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ 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.liteYoutube).toBeVisible();
await expect(await video.ltyPlaybtn).toBeVisible();
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);
Expand Down

0 comments on commit 87b352b

Please sign in to comment.