Skip to content

Commit

Permalink
smoke test: simplify --harmony branching. check for viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jul 12, 2016
1 parent fe5f57d commit d45883a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
32 changes: 21 additions & 11 deletions lighthouse-cli/scripts/run-smoke-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@

cd lighthouse-cli/test/fixtures && python -m SimpleHTTPServer 9999 &

if [[ $(node -v) =~ ^v4.* ]]; then
node --harmony lighthouse-cli/index.js http://localhost:9999/online-only.html > results
else
./lighthouse-cli/index.js http://localhost:9999/online-only.html > results
NODE=$([ $(node -v | grep -E "v4") ] && echo "node --harmony" || echo "node")
offline200result="URL responds with a 200 when offline"


$NODE lighthouse-cli http://localhost:9999/online-only.html > results

# test that we have results
if ! grep -q "$offline200result" results; then
echo "Fail! Lighthouse run didn't create a result file"
exit 1
fi

if ! grep -q "URL responds with a 200 when offline: false" results; then
# test that we have a meta viewport defined in the static page
if ! grep -q "HTML has a viewport <meta>: true" results; then
echo "Fail! Meta viewort not detected in the page"
exit 1
fi

# test static page which should fail the offline test
if ! grep -q "$offline200result: false" results; then
echo "Fail! online only site worked while offline"
cat results
exit 1
fi

sleep 5s

if [[ $(node -v) =~ ^v4.* ]]; then
node --harmony lighthouse-cli/index.js https://www.moji-brush.com > results
else
./lighthouse-cli/index.js https://www.moji-brush.com > results
fi
# test mojibrush which should pass the offline test
$NODE lighthouse-cli https://www.moji-brush.com > results

if ! grep -q "URL responds with a 200 when offline: true" results; then
if ! grep -q "$offline200result: true" results; then
echo "Fail! offline ready site did not work while offline"
cat results
exit 1
Expand Down
1 change: 1 addition & 0 deletions lighthouse-cli/test/fixtures/online-only.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<body>
There was nothing special about this site,
nothing was left to be seen,
Expand Down

0 comments on commit d45883a

Please sign in to comment.