Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Add visual tests for live story notification label #22813

Merged
merged 3 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/visual-tests/amp-story/amp-story-live-story.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-story"
src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script>
<script async custom-element="amp-live-list" src="https://cdn.ampproject.org/v0/amp-live-list-0.1.js"></script>
<title>amp-story live story diff</title>
<meta name="viewport"
content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<link rel="canonical" href="index.html">
<style amp-custom>
amp-story-page {
background: black;
color: white;
font-family: sans-serif;
}
</style>
</head>

<body>
<amp-story standalone publisher="AMP Team" title="Visual Diff Test"
publisher-logo-src="/examples/visual-tests/photos/120.png"
poster-portrait-src="/examples/visual-tests/picsum.photos/image981_900x1600.jpg"
poster-landscape-src="/examples/visual-tests/picsum.photos/image981_1600x900.jpg"
poster-square-src="/examples/visual-tests/picsum.photos/image981_1600x1600.jpg"
id="story1" dynamic-live-list="story-list">

<amp-story-page id="cover" data-sort-time="1552330790">
<amp-story-grid-layer template="vertical">
<p>Page one of one</p>
</amp-story-grid-layer>
</amp-story-page>
</amp-story>
</body>

</html>
32 changes: 32 additions & 0 deletions examples/visual-tests/amp-story/amp-story-live-story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';

module.exports = {
'should show the notification.': async page => {
await page.waitFor('amp-story-page#cover[active]');
await page.$eval('.i-amphtml-story-system-layer', e => e.setAttribute('i-amphtml-story-has-new-page', 'show'));
await page.waitFor(2000); // For animations to finish.
await page.waitForSelector('.i-amphtml-story-has-new-page-notification-container', {opacity: 1});
},
'[RTL] should show the notification.': async page => {
await page.$eval('body', e => e.setAttribute('dir', 'rtl'));
await page.waitFor('amp-story-page#cover[active]');
await page.$eval('.i-amphtml-story-system-layer', e => e.setAttribute('i-amphtml-story-has-new-page', 'show'));
await page.waitFor(2000); // For animations to finish.
await page.waitForSelector('.i-amphtml-story-has-new-page-notification-container', {opacity: 1});
},
};
18 changes: 18 additions & 0 deletions test/visual-diff/visual-tests
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,24 @@
],
"interactive_tests": "examples/visual-tests/amp-story/amp-story-landscape-templates.js"
},
{
"url": "examples/visual-tests/amp-story/amp-story-live-story.html",
"name": "amp-story: live story",
"viewport": {"width": 320, "height": 480},
"loading_complete_selectors": [
".i-amphtml-story-loaded"
],
"interactive_tests": "examples/visual-tests/amp-story/amp-story-live-story.js"
},
{
"url": "examples/visual-tests/amp-story/amp-story-live-story.html",
"name": "amp-story: live story desktop",
"viewport": {"width": 1440, "height": 900},
"loading_complete_selectors": [
".i-amphtml-story-loaded",
],
"interactive_tests": "examples/visual-tests/amp-story/amp-story-live-story.js"
},
{
"flaky": true,
// See https://percy.io/ampproject/amphtml/builds/1434487/view/95137509/375?browser=firefox&mode=diff
Expand Down