Skip to content

Commit

Permalink
Update optimizer test specs (#4527)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierlon authored and westonruter committed Apr 4, 2020
1 parent 601d24a commit e6bdefb
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 50 deletions.
5 changes: 3 additions & 2 deletions lib/optimizer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"cs": "if [ -z $TEST_SKIP_PHPCS ]; then phpcs --standard=PSR12 -s -n src tests; fi",
"lint": "if [ -z $TEST_SKIP_LINTING ]; then parallel-lint -j 10 --colors --exclude vendor .; fi",
"post-update-cmd": [
"rm -rf tests/spec && bin/sync-amp-toolbox-test-suite.php",
"@update-test-specs",
"bin/sync-amp-runtime-local-fallback-resources.php"
],
"test": [
Expand All @@ -72,6 +72,7 @@
"@analyze"
],
"analyze": "if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan analyze --ansi; fi",
"unit": "if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi"
"unit": "if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi",
"update-test-specs": "rm -rf tests/spec && bin/sync-amp-toolbox-test-suite.php"
}
}
2 changes: 1 addition & 1 deletion lib/optimizer/resources/local_fallback/rtv/metadata
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"ampRuntimeVersion":"012002251816300","ampCssUrl":"https://cdn.ampproject.org/rtv/012002251816300/v0.css","canaryPercentage":"0.005","diversions":["002002251816300","032002251816300","022002251816300"],"ltsRuntimeVersion":"012002191527100","ltsCssUrl":"https://cdn.ampproject.org/rtv/012002191527100/v0.css"}
{"ampRuntimeVersion":"012004030010070","ampCssUrl":"https://cdn.ampproject.org/rtv/012004030010070/v0.css","canaryPercentage":"0.005","diversions":["002004012111560","002004012158290","022004030010070","032004012111560","032004012158290","042004030033570"],"ltsRuntimeVersion":"012002251816300","ltsCssUrl":"https://cdn.ampproject.org/rtv/012002251816300/v0.css"}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
<meta name="viewport" content="width=device-width,minimum-scale=1">
<link rel="preload" href="/amp/rtv/123456789000000/v0.js" as="script">
<meta name="runtime-host" content="/amp">
<meta name="amp-geo-api" content="/geo">
<script async src="/amp/rtv/123456789000000/v0.js"></script>
<script async custom-element="amp-experiment" src="/amp/rtv/123456789000000/v0/amp-experiment-0.1.js"></script>
<script async custom-element="amp-video" src="/amp/rtv/123456789000000/v0/amp-video-0.1.js"></script>
<script async custom-template="amp-mustache" src="/amp/rtv/123456789000000/v0/amp-mustache-0.1.js"></script>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px;}</style>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px}</style>
<link rel="amphtml" href="https://example.com/amp-version.html">
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"></script>
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px;}</style>
<link rel="canonical" href="self.html"><style amp-custom>h1{margin:16px}</style>
</head>
<body>
<h1>Hello, AMP world!</h1>
Expand Down
3 changes: 2 additions & 1 deletion lib/optimizer/tests/spec/end-to-end/hello-world/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"ampUrlPrefix": "/amp",
"ampRuntimeVersion": "123456789000000",
"ampUrl": "https://example.com/amp-version.html"
"ampUrl": "https://example.com/amp-version.html",
"geoApiUrl": "/geo"
}
-->
<!doctype html>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!doctype html>
<html >
<head>
<meta name="runtime-host" content="/amp">
<script async custom-element="amp-experiment" src="/amp/rtv/001515617716922/v0/amp-experiment-0.1.js"></script>
<script async src="/amp/rtv/001515617716922/v0.js"></script>
<link rel="stylesheet" href="/amp/rtv/001515617716922/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<link rel="preload" href="/amp/rtv/001515617716922/v0.js" as="script">
<link rel="preload" href="/amp/rtv/001515617716922/v0.css" as="style">
<meta name="runtime-host" content="/amp">
</head>
<body></body>
</html>
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!doctype html>
<html >
<head>
<meta name="runtime-host" content="/amp">
<script async custom-element="amp-experiment" src="/amp/v0/amp-experiment-0.1.js"></script>
<script async src="/amp/v0.js"></script>
<link rel="stylesheet" href="/amp/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<link rel="preload" href="/amp/v0.js" as="script">
<link rel="preload" href="/amp/v0.css" as="style">
<meta name="runtime-host" content="/amp">
</head>
<body></body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html><html ><head><script async src="https://cdn.ampproject.org/v0.js"></script><script async custom-element="amp-img" src="https://cdn.ampproject.org/v0/amp-img-0.1.js"></script><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 href="https://example.com/favicon.ico" rel="icon"></head><body> <amp-analytics type="nielsen"> <script type="application/json">{"vars":{"apid":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","apv":"1.0","apn":"My AMP Website","section":"Entertainment","segA":"Music","segB":"News","segC":"Google AMP"}}</script> </amp-analytics> <script type="application/ld+json">{"@context":"http://schema.org","@type":"Webpage","url":"http://localhost:8081/documentation/examples/components/amp-bind/ ","name":"amp.dev","headline":"Example: &lt;amp-bind&gt;","description":"amp-bind allows you to add custom interactivity to your pages beyond using AMP&#39;s pre-built components.","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:8080"},"publisher":{"@type":"Organization","name":"AMP Project","logo":{"url":"http://localhost:8080/static/img/icons/icon-512x512.png","width":512,"height":512,"@type":"ImageObject"}}}</script> <amp-analytics type="nielsen"> <script type="application/json">
-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 href="https://example.com/favicon.ico" rel="icon"></head><body> <amp-analytics type="nielsen"> <script type="application/json">{"vars":{"apid":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX","apv":"1.0","apn":"My AMP Website","section":"Entertainment","segA":"Music","segB":"News","segC":"Google AMP"}}</script> </amp-analytics> <script type="application/ld+json">{"@context":"http://schema.org","@type":"Webpage","url":"http://localhost:8081/documentation/examples/components/amp-bind/ ","name":"amp.dev","headline":"Example: \u0026lt;amp-bind\u0026gt;","description":"amp-bind allows you to add custom interactivity to your pages beyond using AMP\u0026#39;s pre-built components.","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:8080"},"publisher":{"@type":"Organization","name":"AMP Project","logo":{"url":"http://localhost:8080/static/img/icons/icon-512x512.png","width":512,"height":512,"@type":"ImageObject"}}}</script> <amp-analytics type="nielsen"> <script type="application/json">
invalid json
</script> </amp-analytics> </body></html>
</script> </amp-analytics> <script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"content":[{"embed_html":"\u003cscript src=\"foo.bar\"\u003e\u003c/script\u003e"}]}},"page":"/","query":{},"buildId":"development","isFallback":false}</script> </body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
invalid json
</script>
</amp-analytics>
<!-- escape JSON values https://github.com/zeit/next.js/issues/11159 -->
<script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"content":[{"embed_html":"\u003cscript src=\"foo.bar\"\u003e\u003c/script\u003e"}]}},"page":"/","query":{},"buildId":"development","isFallback":false}</script>
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.something{display:block;}.another{display:none;}</style>
<style amp-custom>.something{display:block}.another{display:none}</style>
</head>
<body>
<p>There shouldn't be a style[amp-keyframes] tag added</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.another{display:block;}@keyframes invalidKeyframe{from{height:0;}to{height:1;}}.foo{height:0;}@supports (display:grid){@keyframes alsoInvalid{from{overflow:visible;}to{overflow:hidden;}}}</style>
<style amp-custom>.another{display:block}@keyframes invalidKeyframe{0%{height:0}to{height:1}}.foo{height:0}@supports (display:grid){@keyframes alsoInvalid{0%{overflow:visible}to{overflow:hidden}}}</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>
<style amp-keyframes>@keyframes validAnim{from{opacity:0;}to{opacity:1;}}</style>
<style amp-keyframes>@keyframes validAnim{0%{opacity:0}to{opacity:1}}</style>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.another{display:block;}.foo{height:0;}@media screen and (max-width:960px){.bar{height:0px;}}.bar{height:auto;}@supports (display:grid){div{display:grid;}}</style>
<style amp-custom>.another{display:block}.foo{height:0}@media screen and (max-width:960px){.bar{height:0}}.bar{height:auto}@supports (display:grid){div{display:grid}}</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>
<style amp-keyframes>@keyframes anim1{from{opacity:0;}top{opacity:1;}}</style>
<style amp-keyframes>@keyframes anim1{0%{opacity:0}to{opacity:1}}</style>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css>
<link href=https://example.com/favicon.ico rel=icon>
<style amp-custom>
.another{display:block}@keyframes anim1{from{opacity:0}top{opacity:1}}.foo{height:0}@media screen and (max-width:960px){.bar{height: 0px;}}.bar{height:auto}@supports (display:grid){div{display:grid}}
.another{display:block}@keyframes anim1{from{opacity:0}to{opacity:1}}.foo{height:0}@media screen and (max-width:960px){.bar{height: 0px;}}.bar{height:auto}@supports (display:grid){div{display:grid}}
</style>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.another{display:block;}.foo{height:0;}.bar{height:auto;}</style>
<style amp-custom>.another{display:block}.foo{height:0}.bar{height:auto}</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>

<p>I should also come before style[amp-keyframes]</p>
<style amp-keyframes>@keyframes anim1{from{opacity:0;}top{opacity:1;}}@media screen and (max-width:960px){@keyframes anim1{from{opacity:1;}to{opacity:0;}}}@keyframes existing{from{height:0px;}to{height:100px;}}</style>
<style amp-keyframes>@keyframes anim1{0%{opacity:0}to{opacity:1}}@media screen and (max-width:960px){@keyframes anim1{0%{opacity:1}to{opacity:0}}}@keyframes existing{0%{height:0}to{height:100px}}</style>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css>
<link href=https://example.com/favicon.ico rel=icon>
<style amp-custom>
.another{display:block}@keyframes anim1{from{opacity:0}top{opacity:1}}.foo{height:0}@media screen and (max-width:960px){@keyframes anim1{from{opacity:1}to{opacity:0}}}.bar{height:auto}
.another{display:block}@keyframes anim1{from{opacity:0}to{opacity:1}}.foo{height:0}@media screen and (max-width:960px){@keyframes anim1{from{opacity:1}to{opacity:0}}}.bar{height:auto}
</style>
</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.another{display:block;}.foo{height:0;}</style>
<style amp-custom>.another{display:block}.foo{height:0}</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>
<style amp-keyframes>@keyframes anim1{from{opacity:0;}top{opacity:1;}}@keyframes anim2{from{opacity:1;}to{opacity:0;}}</style>
<style amp-keyframes>@keyframes anim1{0%{opacity:0}to{opacity:1}}@keyframes anim2{0%{opacity:1}to{opacity:0}}</style>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css>
<link href=https://example.com/favicon.ico rel=icon>
<style amp-custom>
.another{display:block}@keyframes anim1{from{opacity:0}top{opacity:1}}.foo{height:0}@keyframes anim2{from{opacity:1;}to{opacity:0;}}
.another{display:block}@keyframes anim1{from{opacity:0}to{opacity:1}}.foo{height:0}@keyframes anim2{from{opacity:1;}to{opacity:0;}}
</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<link rel="stylesheet" href="https://cdn.ampproject.org/v0.css">
<link href="https://fonts.googleapis.com/css?foobar" rel="stylesheet" type="text/css">
<link href="https://example.com/favicon.ico" rel="icon">
<style amp-custom>.another{display:block;}.foo{height:0;}.bar{height:auto;}</style>
<style amp-custom>.another{display:block}.foo{height:0}.bar{height:auto}</style>
</head>
<body>
<p>I should come before style[amp-keyframes]</p>

<style amp-keyframes>@keyframes anim1{from{opacity:0;}to{opacity:1;}}@media screen and (max-width:960px){@keyframes anim1{from{opacity:1;}to{opacity:0;}}}@supports (display:grid){@keyframes anim2{from{opacity:0;}to{opacity:1;}}}@keyframes existing{from{height:0px;}to{height:100px;}}</style>
<style amp-keyframes>@keyframes anim1{0%{opacity:0}to{opacity:1}}@media screen and (max-width:960px){@keyframes anim1{0%{opacity:1}to{opacity:0}}}@supports (display:grid){@keyframes anim2{0%{opacity:0}to{opacity:1}}}@keyframes existing{0%{height:0}to{height:100px}}</style>
</body>
</html>

This file was deleted.

0 comments on commit e6bdefb

Please sign in to comment.