Merge pull request #1347 from guardian/sp-price-rise #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: manage-frontend cypress (E2E) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
cypress: | |
name: Manage-frontend Cypress (E2E) | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.MANAGE_FRONTEND_IAM_ROLE }} | |
aws-region: eu-west-1 | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
- name: Setup OS, Nginx, and Certs | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libnss3-tools | |
sudo service nginx restart | |
wget -q https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 | |
wget -q https://github.com/guardian/dev-nginx/releases/latest/download/dev-nginx.tar.gz | |
sudo cp mkcert-v1.4.3-linux-amd64 /usr/local/bin/mkcert | |
sudo chmod +x /usr/local/bin/mkcert | |
sudo mkdir -p /usr/local/bin/dev-nginx | |
sudo tar -xzf dev-nginx.tar.gz -C /usr/local | |
sudo chmod +x /usr/local/bin/dev-nginx | |
sudo dev-nginx setup-cert "profile.thegulocal.com" | |
sudo dev-nginx setup-cert "manage.thegulocal.com" | |
sudo dev-nginx setup-cert "members-data-api.thegulocal.com" | |
sudo cp ./cypress/cypress-nginx.conf /etc/nginx/nginx.conf | |
sudo dev-nginx restart-nginx | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
env: | |
CYPRESS_IDAPI_CLIENT_ACCESS_TOKEN: ${{ secrets.IDAPI_CLIENT_ACCESS_TOKEN }} | |
# This env variable prevents Node from rejecting self-signed TLS certificates. It's | |
# required for the Cypress tests to run as we're unable to verify the created certs. | |
# See: https://nodejs.org/api/cli.html#node_tls_reject_unauthorizedvalue | |
NODE_TLS_REJECT_UNAUTHORIZED: 0 | |
with: | |
start: yarn cypress:e2e:server | |
wait-on: 'https://manage.thegulocal.com' | |
wait-on-timeout: 30 | |
quiet: true | |
browser: chrome | |
spec: cypress/tests/e2e/*.cy.ts | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots |