Add workflow for percy demo test (#3430)
* add workflow for percy demo tests * add to run on PR for tests reasons * use default url if not set in inputs * fix record * fix record * add cache * remove run on PR
This commit is contained in:
parent
34bf4731f4
commit
8ef76a7518
1 changed files with 68 additions and 0 deletions
68
.github/workflows/percy-demo-tests.yml
vendored
Normal file
68
.github/workflows/percy-demo-tests.yml
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
name: Execute percy demo tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
dashboardUrl:
|
||||||
|
description: 'Environment to run tests against'
|
||||||
|
required: true
|
||||||
|
default: 'https://staging-demo.saleor.io/'
|
||||||
|
apiUrl:
|
||||||
|
required: true
|
||||||
|
description: 'Environment api to run tests against'
|
||||||
|
default: 'https://staging-demo.saleor.io/graphql/'
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
- cron: '00 2 * * 1-5'
|
||||||
|
|
||||||
|
repository_dispatch:
|
||||||
|
types: [demo-tests]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cypress-run-test-percy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: cypress/browsers:node18.12.0-chrome106-ff106
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Get environments urls
|
||||||
|
id: get-env-urls
|
||||||
|
env:
|
||||||
|
DEFAULT_DASHBOARD_URL: 'https://staging-demo.saleor.io/'
|
||||||
|
DEFAULT_API_URL: 'https://staging-demo.saleor.io/graphql/'
|
||||||
|
run: |
|
||||||
|
echo "DASHBOARD_URL=${{ github.event.inputs.dashboardUrl || env.DEFAULT_DASHBOARD_URL }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "API_URL=${{ github.event.inputs.apiUrl || env.DEFAULT_API_URL }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
cache-name: cache-node-modules
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-percy_demo-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-percy_demo-${{ env.cache-name }}-
|
||||||
|
${{ runner.os }}-percy_demo-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: NODE_OPTIONS=--max_old_space_size=4096 npm install
|
||||||
|
|
||||||
|
- name: Cypress run test percy
|
||||||
|
uses: cypress-io/github-action@v4
|
||||||
|
env:
|
||||||
|
API_URI: ${{ steps.get-env-urls.outputs.API_URL }}
|
||||||
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
||||||
|
CYPRESS_DEMO_URI: ${{ steps.get-env-urls.outputs.DASHBOARD_URL }}
|
||||||
|
CYPRESS_USER_NAME: admin@example.com
|
||||||
|
CYPRESS_USER_PASSWORD: admin
|
||||||
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
COMMIT_INFO_MESSAGE: Percy - Demo dashboard tests - ${{github.event.inputs.dashboardUrl}} - ${{ steps.get-env-urls.outputs.DASHBOARD_URL }}
|
||||||
|
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
||||||
|
CYPRESS_demoTests: true
|
||||||
|
with:
|
||||||
|
group: "UI - Chrome"
|
||||||
|
command: npx percy exec -- npx cypress run --record
|
Loading…
Reference in a new issue