diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b41eef434..7f49f7f8f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -21,7 +21,7 @@ greatly reduce the amount of work needed to review your work. --> ### Test environment config - + -API_URI=https://qa.staging.saleor.cloud/graphql/ \ No newline at end of file +API_URI=https://master.staging.saleor.cloud/graphql/ diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 000000000..e650f9202 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63055e198..58bb8b640 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: