ToolJet/.github/workflows/cypress.yml
2023-06-27 21:12:13 +05:30

78 lines
2.5 KiB
YAML

name: Cypress E2E Test
on:
pull_request_target:
types: [labeled, unlabeled, closed]
workflow_dispatch:
env:
PR_NUMBER: ${{ github.event.number }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
cancel-in-progress: true
jobs:
Run-Cypress:
if: ${{ github.event.action == 'labeled' && (github.event.label.name == 'run-cypress' || github.event.label.name == 'run-cypress-app-builder'|| github.event.label.name == 'run-cypress-workspace')}}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Node.js 18.3.0
uses: actions/setup-node@v3
with:
node-version: 18.3.0
- name: Checking the PR URL
run: |
timeout 1500 bash -c '
until curl --silent --fail https://tooljet-pr-cypress-${{ env.PR_NUMBER }}.onrender.com; do
sleep 100
done'
- name: Create Cypress environment file
id: create-json
uses: jsdaniell/create-json@1.1.2
with:
name: "cypress.env.json"
json: ${{ secrets.CYPRESS_SECRETS }}
dir: './cypress-tests'
- name: Cypress Integration Test
if: ${{ github.event.label.name == 'run-cypress' }}
uses: cypress-io/github-action@v5
with:
working-directory: ./cypress-tests
config: "baseUrl=https://tooljet-pr-cypress-${{ env.PR_NUMBER }}.onrender.com"
config-file: cypress-run.config.js
- name: Cypress Integration Test (App Builder)
if: ${{ github.event.label.name == 'run-cypress-app-builder' }}
uses: cypress-io/github-action@v5
with:
working-directory: ./cypress-tests
config: "baseUrl=https://tooljet-pr-cypress-${{ env.PR_NUMBER }}.onrender.com"
config-file: cypress-app-builder.config.js
- name: Cypress Integration Test (Workspace)
if: ${{ github.event.label.name == 'run-cypress-workspace' }}
uses: cypress-io/github-action@v5
with:
working-directory: ./cypress-tests
config: "baseUrl=https://tooljet-pr-cypress-${{ env.PR_NUMBER }}.onrender.com"
config-file: cypress-workspace.config.js
- name: Capture Screenshots
uses: actions/upload-artifact@v3
if: always()
with:
name: screenshots
path: cypress-tests/cypress/screenshots