86 lines
3.0 KiB
YAML

name: E2E on Chrome
on:
push:
workflow_dispatch: # to test out if GITHUB_TOKEN env var can be a solution for rerunning CI and having it re-record on Cypress Dashboard
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: ./packages/**/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: ./packages/**/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 }}