From 7cf15992086dbbedd1c74c310b9869948ce77cbf Mon Sep 17 00:00:00 2001 From: nigeljamesstevenson Date: Wed, 18 Jan 2023 17:12:55 +0000 Subject: [PATCH] update smoke test daily workflow to run api tests first --- .github/workflows/smoke-test-daily.yml | 93 ++++++++++--------- ...kflow-run-API-tests-first-before-E2E-tests | 5 + 2 files changed, 52 insertions(+), 46 deletions(-) create mode 100644 plugins/woocommerce/changelog/update-smoke-test-daily-workflow-run-API-tests-first-before-E2E-tests diff --git a/.github/workflows/smoke-test-daily.yml b/.github/workflows/smoke-test-daily.yml index 7c5b9ea78ea..8643b6d395b 100644 --- a/.github/workflows/smoke-test-daily.yml +++ b/.github/workflows/smoke-test-daily.yml @@ -17,11 +17,57 @@ concurrency: permissions: {} jobs: + api-tests: + name: API tests on nightly build + runs-on: ubuntu-20.04 + permissions: + contents: read + if: success() || failure() + env: + ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results + ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ env.BRANCH_NAME }} + + - name: Setup WooCommerce Monorepo + uses: ./.github/actions/setup-woocommerce-monorepo + with: + install-filters: woocommerce + build: false + + - name: Run API tests. + working-directory: plugins/woocommerce + env: + BASE_URL: ${{ secrets.SMOKE_TEST_URL }} + USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }} + USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} + DEFAULT_TIMEOUT_OVERRIDE: 120000 + run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello.test.js + + - name: Generate API Test report. + if: success() || failure() + working-directory: plugins/woocommerce + run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }} + + - name: Archive API test report + if: success() || failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.API_ARTIFACT }} + path: | + ${{ env.ALLURE_RESULTS_DIR }} + ${{ env.ALLURE_REPORT_DIR }} + if-no-files-found: ignore + retention-days: 5 + e2e-tests: name: E2E tests on nightly build runs-on: ubuntu-20.04 permissions: contents: read + needs: [api-tests] env: ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }} @@ -78,52 +124,6 @@ jobs: if-no-files-found: ignore retention-days: 5 - api-tests: - name: API tests on nightly build - runs-on: ubuntu-20.04 - permissions: - contents: read - needs: [e2e-tests] - if: success() || failure() - env: - ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results - ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ env.BRANCH_NAME }} - - - name: Setup WooCommerce Monorepo - uses: ./.github/actions/setup-woocommerce-monorepo - with: - install-filters: woocommerce - build: false - - - name: Run API tests. - working-directory: plugins/woocommerce - env: - BASE_URL: ${{ secrets.SMOKE_TEST_URL }} - USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }} - USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }} - DEFAULT_TIMEOUT_OVERRIDE: 120000 - run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello.test.js - - - name: Generate API Test report. - if: success() || failure() - working-directory: plugins/woocommerce - run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }} - - - name: Archive API test report - if: success() || failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.API_ARTIFACT }} - path: | - ${{ env.ALLURE_RESULTS_DIR }} - ${{ env.ALLURE_REPORT_DIR }} - if-no-files-found: ignore - retention-days: 5 - k6-tests: name: k6 tests on nightly build runs-on: ubuntu-20.04 @@ -181,6 +181,7 @@ jobs: runs-on: ubuntu-20.04 permissions: contents: read + needs: [api-tests] env: USE_WP_ENV: 1 ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results diff --git a/plugins/woocommerce/changelog/update-smoke-test-daily-workflow-run-API-tests-first-before-E2E-tests b/plugins/woocommerce/changelog/update-smoke-test-daily-workflow-run-API-tests-first-before-E2E-tests new file mode 100644 index 00000000000..8e9c06e0c30 --- /dev/null +++ b/plugins/woocommerce/changelog/update-smoke-test-daily-workflow-run-API-tests-first-before-E2E-tests @@ -0,0 +1,5 @@ +Significance: patch +Type: update +Comment: Update smoke test daily workflow to run api tests before e2e tests + +