test that youtube embeds work (#24726)
* test that YouTube embeds work * tidying
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user