diff --git a/selectors/milo/video.block.page.js b/selectors/milo/video.block.page.js index 9fb2dde2..466de5d4 100644 --- a/selectors/milo/video.block.page.js +++ b/selectors/milo/video.block.page.js @@ -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': { + 'daa-lh': /s[1-9]/, + }, + 'content.daa-lh': { + 'daa-lh': /b[1-9]|content|default|default/, + }, + }, + }; + } +} diff --git a/tests/milo/video.block.test.js b/tests/milo/video.block.test.js index 13d99a08..562e0e03 100644 --- a/tests/milo/video.block.test.js +++ b/tests/milo/video.block.test.js @@ -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}`); @@ -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(); }); });