Skip to content

Commit

Permalink
(bento-youtube) add e2e test (ampproject#36438)
Browse files Browse the repository at this point in the history
* (bento-youtube) add e2e test

* Update test/fixtures/e2e/bento/bento-youtube.html

Co-authored-by: Alan Orozco <[email protected]>

* (bento-youtube) rename variables in e2e test

Co-authored-by: Alan Orozco <[email protected]>
  • Loading branch information
dethstrobe and alanorozco authored Oct 21, 2021
1 parent 44a18b0 commit 584cd3c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
26 changes: 26 additions & 0 deletions extensions/amp-youtube/1.0/test-e2e/test-bento-youtube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
describes.endtoend(
'bento-youtube',
{
version: '1.0',
fixture: 'bento/bento-youtube.html',
environments: ['single'],
},
(env) => {
let controller;

beforeEach(() => {
controller = env.controller;
});

it('should render a youtube video', async () => {
const element = await controller.findElement('bento-youtube');
await controller.switchToShadowRoot(element);

const iframe = await controller.findElement('iframe');

await expect(controller.getElementAttribute(iframe, 'src')).to.equal(
'https://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1&amp=1&playsinline=1'
);
});
}
);
30 changes: 30 additions & 0 deletions test/fixtures/e2e/bento/bento-youtube.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Bento Youtube</title>
<meta
name="viewport"
content="width=device-width,minimum-scale=1,initial-scale=1"
/>
<script async src="https://cdn.ampproject.org/bento.js"></script>
<script
async
src="https://cdn.ampproject.org/v0/bento-youtube-1.0.js"
></script>
</head>
<body>
<h1>Youtube</h1>
<p>
<bento-youtube
data-videoid="dQw4w9WgXcQ"
width="358"
height="204"
layout="responsive"
style="height: 204px; width: 358px"
>
fallback message here
</bento-youtube>
</p>
</body>
</html>

0 comments on commit 584cd3c

Please sign in to comment.