2022-05-04 10:37:11 -05:00

84 lines
2.8 KiB
YAML

name: E2E on Chrome
on: [push]
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Version 1: no parallelization
# - name: Cypress run
# uses: cypress-io/github-action@v3.0.4
# with:
# browser: chrome
# start: yarn dev
# wait-on: 'http://localhost:3000'
# wait-on-timeout: 120000
# record: true
# env:
# COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
# NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}
# NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN }}
# NEXT_PUBLIC_COMMERCE_SEARCH_ENABLED: true
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# # pass GitHub token to allow accurately detecting a build vs a re-run build
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#############################################################################################################################
# Version 2: install in one job, parallelize the e2e jobs
- name: Cypress install
uses: cypress-io/github-action@v2
with:
runTests: false
# probably Vercel relevant. No idea why we have to build anything
# In version 1, I did not have to build anything to get things to work in CI
# here, without the build job generating an artifact, the test jobs do not really get items related to our store
- run: yarn build
env:
COMMERCE_PROVIDER: ${{ secrets.COMMERCE_PROVIDER }}
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN }}
NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN }}
- name: Save build folder
uses: actions/upload-artifact@v2
with:
name: build
if-no-files-found: error
path: dist
ui-chrome-tests:
runs-on: ubuntu-latest
needs: install
strategy:
fail-fast: false
matrix:
containers: [1, 2]
steps:
- name: Checkout
uses: actions/checkout@v2
# must be Vercel relevant. No idea why we have to build anything
- name: Download the build folders
uses: actions/download-artifact@v2
with:
name: build
path: dist
- name: 'Chrome E2E Tests'
uses: cypress-io/github-action@v2
with:
browser: chrome
start: yarn dev
wait-on: 'http://localhost:3000'
wait-on-timeout: 120000
record: true
# spec: cypress/integration/*
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}