112 lines
5 KiB
YAML
112 lines
5 KiB
YAML
name: E2E
|
|
|
|
on:
|
|
pull_request:
|
|
types: [reopened, synchronize, labeled]
|
|
branches: ["*"]
|
|
|
|
jobs:
|
|
cypress-run:
|
|
if: github.event.pull_request.head.repo.full_name == 'saleor/saleor-dashboard' && (((github.event.action == 'labeled') && (github.event.label.name == 'run e2e')) || ((github.event.action != 'labeled') && contains(github.event.pull_request.labels.*.name, 'run e2e')))
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Get API_URI
|
|
id: api_uri
|
|
# Search for CYPRESS_API_URI in PR description and use default if not defined
|
|
env:
|
|
pull_request_body: ${{ github.event.pull_request.body }}
|
|
prefix: API_URI=
|
|
pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/?
|
|
fallback_uri: ${{ secrets.CYPRESS_API_URI }}
|
|
run: |
|
|
echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1 | { read custom_uri; if [ -z "$custom_uri" ]; then echo "$fallback_uri"; else echo "$custom_uri"; fi })"
|
|
|
|
- name: Cypress run full spec
|
|
if: ${{ steps.api_uri.outputs.custom_api_uri == 'https://qa.staging.saleor.cloud/graphql/' }}
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
API_URI: ${{ steps.api_uri.outputs.custom_api_uri }}
|
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
|
CYPRESS_baseUrl: ${{ secrets.CYPRESS_BASEURL }}
|
|
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
|
|
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
|
|
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
|
|
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
|
|
CYPRESS_MAILHOG: ${{ secrets.CYPRESS_MAILHOG }}
|
|
with:
|
|
build: npm run build
|
|
start: npx local-web-server --spa index.html
|
|
wait-on: http://localhost:9000/
|
|
wait-on-timeout: 120
|
|
- uses: actions/upload-artifact@v1
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: cypress-videos
|
|
path: cypress/videos
|
|
|
|
- name: Cypress run allEnvs spec
|
|
if: ${{ steps.api_uri.outputs.custom_api_uri != 'https://qa.staging.saleor.cloud/graphql/' }}
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
API_URI: ${{ steps.api_uri.outputs.custom_api_uri }}
|
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
|
CYPRESS_baseUrl: ${{ secrets.CYPRESS_BASEURL }}
|
|
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
|
|
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
|
|
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
|
|
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
|
|
with:
|
|
build: npm run build
|
|
start: npx local-web-server --spa index.html
|
|
wait-on: http://localhost:9000/
|
|
wait-on-timeout: 120
|
|
command: npm run cy:run:allEnv
|
|
- uses: actions/upload-artifact@v1
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: cypress-videos
|
|
path: cypress/videos
|
|
|
|
cypress-run-critical:
|
|
if: github.event.pull_request.head.repo.full_name == 'saleor/saleor-dashboard' && ((github.event.label.name != 'run e2e') || !(contains(github.event.pull_request.labels.*.name, 'run e2e')))
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Get API_URI
|
|
id: api_uri
|
|
# Search for CYPRESS_API_URI in PR description and use default if not defined
|
|
env:
|
|
pull_request_body: ${{ github.event.pull_request.body }}
|
|
prefix: CYPRESS_API_URI=
|
|
pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/?
|
|
fallback_uri: ${{ secrets.CYPRESS_API_URI }}
|
|
run: |
|
|
echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1 | { read custom_uri; if [ -z "$custom_uri" ]; then echo "$fallback_uri"; else echo "$custom_uri"; fi })"
|
|
|
|
- name: Cypress run critical
|
|
if: ${{ steps.api_uri.outputs.custom_api_uri != 'https://qa.staging.saleor.cloud/graphql/' }}
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
API_URI: ${{ steps.api_uri.outputs.custom_api_uri }}
|
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
|
CYPRESS_baseUrl: ${{ secrets.CYPRESS_BASEURL }}
|
|
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
|
|
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
|
|
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
|
|
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
|
|
with:
|
|
build: npm run build
|
|
start: npx local-web-server --spa index.html
|
|
wait-on: http://localhost:9000/
|
|
wait-on-timeout: 120
|
|
command: npm run cy:run:critical
|
|
- uses: actions/upload-artifact@v1
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: cypress-videos
|
|
path: cypress/videos
|