From 8d361293c55d8d1d4cc24e9fc6759577d30fc0a1 Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Fri, 3 Jun 2022 10:25:16 +0200 Subject: [PATCH] Add tags to tests runs (#2079) * Add tags to tests runs * remove unused workflow * add tags in command * add tags in command * add tags in command * add tags in command --- .github/workflows/critical-tests.yml | 68 --------------------------- .github/workflows/test-env-deploy.yml | 3 +- .github/workflows/tests-nightly.yml | 4 +- package.json | 4 +- 4 files changed, 6 insertions(+), 73 deletions(-) delete mode 100644 .github/workflows/critical-tests.yml diff --git a/.github/workflows/critical-tests.yml b/.github/workflows/critical-tests.yml deleted file mode 100644 index d9f429f27..000000000 --- a/.github/workflows/critical-tests.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: RUN_CRITICAL_TESTS - -# Only trigger, when the build workflow succeeded -on: - workflow_run: - workflows: [TEST-ENV-DEPLOYMENT] - types: [completed] - -jobs: - cypress-run-critical: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Get API_URI - id: api_uri - # Search for 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: Get base_URL - id: base_URL - run: | - echo "::set-output name=base_URL::https://$(echo ${GITHUB_HEAD_REF}).dashboard.saleor.rocks" - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-qa-${{ env.cache-name }}- - ${{ runner.os }}-qa- - ${{ runner.os }}- - - - name: Install Dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' - run: npm install - - - name: Cypress run critical - 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: ${{ steps.base_URL.outputs.base_URL }} - 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_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - with: - command: npm run cy:run:critical - wait-on: ${{ steps.base_URL.outputs.base_URL }} - - uses: actions/upload-artifact@v1 - with: - name: cypress-videos - path: cypress/videos \ No newline at end of file diff --git a/.github/workflows/test-env-deploy.yml b/.github/workflows/test-env-deploy.yml index 43904c1fa..31f750c4b 100644 --- a/.github/workflows/test-env-deploy.yml +++ b/.github/workflows/test-env-deploy.yml @@ -164,7 +164,8 @@ jobs: CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} with: - command: npm run cy:run:critical + tag: Critical, ${{github.event.action}} + command: npx cypress run --record --env tags=critical --spec cypress/integration/navigation.js, cypress/integration/products/createProduct.js, cypress/integration/products/productsVariants.js --tag Critical, PR_Deploy - uses: actions/upload-artifact@v1 with: name: cypress-videos diff --git a/.github/workflows/tests-nightly.yml b/.github/workflows/tests-nightly.yml index f3f52c8d8..e27047e67 100644 --- a/.github/workflows/tests-nightly.yml +++ b/.github/workflows/tests-nightly.yml @@ -130,7 +130,7 @@ jobs: with: parallel: true group: 'UI - Chrome' - command: npm run cy:run:allEnv:parallel + command: npx cypress run --record --env tags=all --parallel --tag ${{ steps.get-env-uri.outputs.ENV_URI }}, All_Tests - name: Cypress run if: ${{ github.event.inputs.tests == 'Critical' }} @@ -148,7 +148,7 @@ jobs: with: parallel: true group: 'UI - Chrome' - command: npm run cy:run:critical:parallel + command: npx cypress run --record --env tags=critical --spec cypress/integration/navigation.js, cypress/integration/products/createProduct.js, cypress/integration/products/productsVariants.js --parallel --tag ${{ steps.get-env-uri.outputs.ENV_URI }}, Critical diff --git a/package.json b/package.json index 1caeb6500..c749f2e4e 100644 --- a/package.json +++ b/package.json @@ -272,9 +272,9 @@ "cy:run:dashboard": "cypress run --record", "cy:open": "cypress open", "cy:run:refactored:locally": "cypress run --env tags=refactored --spec 'cypress/integration/navigation.js','cypress/integration/products/createProduct.js', 'cypress/integration/products/productsVariants.js', --reporter cypress-mochawesome-reporter --reporter-options reportDir='cypress/reports',overwrite=true,charts=true", - "cy:run:critical": "cypress run --record --env tags=critical --spec 'cypress/integration/navigation.js','cypress/integration/products/createProduct.js', 'cypress/integration/products/productsVariants.js'", + "cy:run:critical": "cypress run --record --env tags=critical --spec 'cypress/integration/navigation.js','cypress/integration/products/createProduct.js', 'cypress/integration/products/productsVariants.js' --tag Critical, PR Deploy", "cy:run:allEnv": "cypress run --record --env tags=all", - "cy:run:critical:parallel": "cypress run --record --env tags=critical --spec 'cypress/integration/navigation.js','cypress/integration/products/createProduct.js', 'cypress/integration/products/productsVariants.js' --parallel", + "cy:run:critical:parallel": "cypress run --record --env tags=critical --spec 'cypress/integration/navigation.js','cypress/integration/products/createProduct.js', 'cypress/integration/products/productsVariants.js' --parallel --tag Critical", "cy:run:allEnv:parallel": "cypress run --record --env tags=all --parallel", "test:e2e:run": "start-server-and-test start http://localhost:9000 cy:run", "test:e2e:run:record": "start-server-and-test start http://localhost:9000 cy:run:record",