Skip to content

E2E UI workflow

E2E UI workflow #11

Workflow file for this run

# This workflow is a reusable one called by other workflows
name: E2E UI workflow
on:
workflow_dispatch:
# Variables to set when calling this reusable workflow
inputs:
browser:
description: Web browser to test
required: true
type: string
cypress_image:
description: Cypress docker image to use
required: true
type: string
default: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
rancher_version:
description: Rancher version to deploy
required: true
type: string
jobs:
installation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install K3s / Helm / Rancher
id: installation
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
HELM_VERSION: 3.12.0
K3S_VERSION: v1.25.9+k3s1
RANCHER_VERSION: ${{ inputs.rancher_version }}
run: |
## Export information to other jobs
ETH_DEV=$(ip route | awk '/default via / { print $5 }')
MY_IP=$(ip a s ${ETH_DEV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
export MY_HOSTNAME=$(hostname)
echo "MY_IP=${MY_IP}" >> $GITHUB_OUTPUT
echo "MY_HOSTNAME=${MY_HOSTNAME}" >> $GITHUB_OUTPUT
make prepare-e2e-ci-rancher
outputs:
MY_HOSTNAME: ${{ steps.installation.outputs.MY_HOSTNAME }}
MY_IP: ${{ steps.installation.outputs.MY_IP }}
# Use a Cypress container to run all tests
cypress-tests:
needs:
- installation
runs-on: ubuntu-latest
container:
image: ${{ inputs.cypress_image }}
env:
RANCHER_USER: admin
RANCHER_PASSWORD: rancherpassword
RANCHER_URL: https://${{ needs.installation.outputs.MY_HOSTNAME }}/dashboard
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host --user 1000
steps:
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: ${{ inputs.browser }}
# headless: true
spec: |
cypress/e2e/unit_tests/first_connection.spec.ts
cypress/e2e/unit_tests/menu.spec.ts
config-file: cypress.config.ts
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots-tests
path: cypress/screenshots
retention-days: 7
# Test run video was always captured, so this action uses "always()" condition
- name: Upload Cypress videos
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos-tests
path: cypress/videos
retention-days: 7
delete-cluster:
if: always()
needs: [installation, cypress-tests]
runs-on: ubuntu-latest
steps:
- name: Delete k3s cluster
if: always()
run: |
make clean-all
- name: Clean all
if: always()
uses: colpal/actions-clean@v1