Skip to content

Commit d45883a

Browse files
authored
smoke test: simplify --harmony branching. check for viewport
1 parent fe5f57d commit d45883a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

lighthouse-cli/scripts/run-smoke-tests.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,37 @@
22

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

5-
if [[ $(node -v) =~ ^v4.* ]]; then
6-
node --harmony lighthouse-cli/index.js http://localhost:9999/online-only.html > results
7-
else
8-
./lighthouse-cli/index.js http://localhost:9999/online-only.html > results
5+
NODE=$([ $(node -v | grep -E "v4") ] && echo "node --harmony" || echo "node")
6+
offline200result="URL responds with a 200 when offline"
7+
8+
9+
$NODE lighthouse-cli http://localhost:9999/online-only.html > results
10+
11+
# test that we have results
12+
if ! grep -q "$offline200result" results; then
13+
echo "Fail! Lighthouse run didn't create a result file"
14+
exit 1
915
fi
1016

11-
if ! grep -q "URL responds with a 200 when offline: false" results; then
17+
# test that we have a meta viewport defined in the static page
18+
if ! grep -q "HTML has a viewport <meta>: true" results; then
19+
echo "Fail! Meta viewort not detected in the page"
20+
exit 1
21+
fi
22+
23+
# test static page which should fail the offline test
24+
if ! grep -q "$offline200result: false" results; then
1225
echo "Fail! online only site worked while offline"
1326
cat results
1427
exit 1
1528
fi
1629

1730
sleep 5s
1831

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

25-
if ! grep -q "URL responds with a 200 when offline: true" results; then
35+
if ! grep -q "$offline200result: true" results; then
2636
echo "Fail! offline ready site did not work while offline"
2737
cat results
2838
exit 1

lighthouse-cli/test/fixtures/online-only.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<html>
2+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
23
<body>
34
There was nothing special about this site,
45
nothing was left to be seen,

0 commit comments

Comments
 (0)