diff --git a/.github/workflows/smoke-test-daily.yml b/.github/workflows/smoke-test-daily.yml index 7c5b9ea78ea..bf4e89ea759 100644 --- a/.github/workflows/smoke-test-daily.yml +++ b/.github/workflows/smoke-test-daily.yml @@ -17,11 +17,56 @@ concurrency: permissions: {} jobs: + api-tests: + name: API tests on nightly build + runs-on: ubuntu-20.04 + permissions: + contents: read + 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 +123,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 +180,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 @@ -256,7 +256,7 @@ jobs: runs-on: ubuntu-20.04 permissions: contents: read - needs: [test-plugins, k6-tests] + needs: [e2e-tests, test-plugins, k6-tests] steps: - name: Create dirs run: | @@ -312,7 +312,7 @@ jobs: ( success() || failure() ) && ! github.event.pull_request.head.repo.fork runs-on: ubuntu-20.04 - needs: [test-plugins, k6-tests] + needs: [e2e-tests, test-plugins, k6-tests] env: GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }} RUN_ID: ${{ github.run_id }} 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 + +