From d5946c7449ead77425b60f1d4687b70951989a1e Mon Sep 17 00:00:00 2001 From: Anand Suthar Date: Sun, 26 May 2024 17:51:20 +0530 Subject: [PATCH] Updated workflow to continue-on-error on tests for rollback --- .github/workflows/playwright.yml | 4 +++- tests/intro.spec.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 3d695456..50b0ab66 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -37,4 +37,6 @@ jobs: retention-days: 30 - name: Rollback Deployment on Test Failure if: ${{ failure() }} - run: vercel rollback ${{ steps.deploy.outputs.vercel-deployment-url }} --token=${{ secrets.VERCEL_TOKEN }} + run: | + DEPLOYMENT_ID=$(vercel list --token=${{ secrets.VERCEL_TOKEN }} --json | jq -r '.[0].uid') + vercel --token=${{ secrets.VERCEL_TOKEN }} rollback $DEPLOYMENT_ID diff --git a/tests/intro.spec.ts b/tests/intro.spec.ts index 565b924f..668f2da7 100644 --- a/tests/intro.spec.ts +++ b/tests/intro.spec.ts @@ -8,7 +8,7 @@ test("Displays the landing page correctly and triggers rollback on failure", asy await page.goto(`${baseURL}`); // Intentionally fail the test by expecting a non-existent element - await expect(page.getByText("NonExistentElement")).toBeVisible(); // This will intentionally fail the test + // await expect(page.getByText("NonExistentElement")).toBeVisible(); // This will intentionally fail the test // If the test reaches this point, the intentional failure did not occur // This line should not be reached if the test fails as expected