forked from pixelcabin/shopify_theme_integration_tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
42 lines (42 loc) · 1.58 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
language: node_js
node_js:
- '7'
sudo: required
cache:
npm: true
directories:
- /home/travis/.cache/Cypress
- ~/.npm
install:
- npm install
- npm install -g ngrok
before_script:
- mkdir public
- curl -sO http://stedolan.github.io/jq/download/linux64/jq
- ngrok http file://$(pwd)/public/ --authtoken=${NGROK_AUTH_TOKEN} > /dev/null &
- sleep 3
script:
- echo {} > credentials.json
- grunt zip
- NGROK_PATH=$(curl 'http://localhost:4040/api/tunnels' | jq -r '.tunnels[0].public_url')/theme.zip
- echo "{\"theme\":{\"name\":\"Travis Curl Test - $(date +"%D %T %Z")\",\"src\":\"$NGROK_PATH\"}}"
> body.json
- echo $(cat body.json)
- 'TEST_THEME_ID=$(curl -d @body.json -H "Accept: application/json" -H "Content-Type:
application/json" https://${SHOPIFY_API_KEY}:${SHOPIFY_API_PASSWORD}@${SHOPIFY_URL}/admin/api/2019-04/themes.json
| jq -r ''.theme.id'')'
- if [ ${TEST_THEME_ID} == null ] ; then exit 1 ; fi
- while [ $(curl https://${SHOPIFY_API_KEY}:${SHOPIFY_API_PASSWORD}@${SHOPIFY_URL}/admin/api/2019-04/themes/$TEST_THEME_ID.json
| jq -r '.theme.previewable') != 'true' ]; do echo 'Waiting for theme'; sleep 2;
done
- cypress run --env SHOPIFY_URL=${SHOPIFY_URL},SHOPIFY_THEME_ID=$TEST_THEME_ID
- 'curl -H "Accept: application/json" -X DELETE https://${SHOPIFY_API_KEY}:${SHOPIFY_API_PASSWORD}@${SHOPIFY_URL}/admin/api/2019-04/themes/$TEST_THEME_ID.json'
addons:
chrome: stable
apt:
packages:
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
env:
global:
- SHOPIFY_URL: integration-testing-example.myshopify.com