Create separate e2e workflow (#1243)
This commit is contained in:
parent
8d58a4efeb
commit
e831791493
3 changed files with 74 additions and 83 deletions
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -21,7 +21,7 @@ greatly reduce the amount of work needed to review your work. -->
|
|||
|
||||
### Test environment config
|
||||
|
||||
<!-- Do not remove this section. It is required to properly setup test instance.
|
||||
Modify API_URI if you want test instance to use custom backend. -->
|
||||
<!-- Do not remove this section. It is required to properly setup test deployment instance.
|
||||
Modify API_URI if you want test instance to use custom backend. CYPRESS_API_URI is optional, use when necessary. -->
|
||||
|
||||
API_URI=https://qa.staging.saleor.cloud/graphql/
|
||||
API_URI=https://master.staging.saleor.cloud/graphql/
|
||||
|
|
71
.github/workflows/e2e.yml
vendored
Normal file
71
.github/workflows/e2e.yml
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
name: E2E
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [reopened, synchronize, labeled]
|
||||
branches: ["*"]
|
||||
|
||||
jobs:
|
||||
cypress-run:
|
||||
if: github.event.pull_request.head.repo.full_name == 'mirumee/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-16.04
|
||||
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 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
|
||||
spec: cypress/integration/allEnv/**/*.js
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
name: cypress-videos
|
||||
path: cypress/videos
|
80
.github/workflows/test.yml
vendored
80
.github/workflows/test.yml
vendored
|
@ -69,86 +69,6 @@ jobs:
|
|||
run: |
|
||||
npm run test
|
||||
|
||||
cypress-run:
|
||||
if: github.event.pull_request.head.repo.full_name == 'mirumee/saleor-dashboard'
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Get custom API_URI
|
||||
id: api_uri
|
||||
# Search for API_URI in PR description
|
||||
env:
|
||||
pull_request_body: ${{ github.event.pull_request.body }}
|
||||
prefix: API_URI=
|
||||
pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/?
|
||||
run: |
|
||||
echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1)"
|
||||
|
||||
- name: Cypress run
|
||||
uses: cypress-io/github-action@v2
|
||||
env:
|
||||
API_URI: ${{ steps.api_uri.outputs.custom_api_uri || secrets.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
|
||||
spec: cypress/integration/allEnv/**/*.js
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-videos
|
||||
path: cypress/videos
|
||||
|
||||
cypress-run-staged:
|
||||
if: github.event.pull_request.head.repo.full_name == 'mirumee/saleor-dashboard'
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Get custom API_URI
|
||||
id: api_uri
|
||||
# Search for API_URI in PR description
|
||||
env:
|
||||
pull_request_body: ${{ github.event.pull_request.body }}
|
||||
prefix: API_URI=
|
||||
pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/?
|
||||
run: |
|
||||
echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1)"
|
||||
|
||||
- name: Cypress run staged only
|
||||
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 || secrets.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
|
||||
spec: cypress/integration/stagedOnly/**/*.js
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-videos
|
||||
path: cypress/videos
|
||||
|
||||
translation-messages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
Loading…
Reference in a new issue