1
0
mirror of synced 2025-12-25 02:17:36 -05:00

test that youtube embeds work (#24726)

* test that YouTube embeds work

* tidying
This commit is contained in:
Peter Bengtsson
2022-01-27 12:18:33 -05:00
committed by GitHub
parent 226d6d605a
commit fa00513864

View File

@@ -474,3 +474,34 @@ describe.skip('next/link client-side navigation', () => {
await page.setViewport(initialViewport)
})
})
describe('iframe pages', () => {
it('can open YouTube embed iframes', async () => {
// Going to create a fresh page instance, so we can intercept the requests.
const newPage = await browser.newPage()
await newPage.setRequestInterception(true)
const interceptedURLs = []
newPage.on('request', (request) => {
interceptedURLs.push(request.url())
request.continue()
})
const failedURLs = []
newPage.on('requestfailed', (request) => {
failedURLs.push(request.url())
request.continue()
})
// Hardcoded path to a page where we know we have a YouTube embed
const res = await newPage.goto('http://localhost:4001/en/codespaces')
expect(res.ok()).toBeTruthy()
expect(failedURLs.length, `Following URLs ${failedURLs.join(', ')} failed`).toBeFalsy()
const iframeSrc = await newPage.$eval('iframe', (el) => el.src)
expect(iframeSrc.startsWith('https://www.youtube-nocookie.com/embed')).toBeTruthy()
expect(
interceptedURLs.filter((url) => url.startsWith('https://www.youtube-nocookie.com/')).length
).toBeTruthy()
})
})