From fae7cb2e0db286b0584cf199441cdc8f3f74ff49 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Tue, 17 Sep 2024 21:04:30 +0200 Subject: [PATCH] Don't run cleanup hook in CI Cleanup is not relevant in CI since the container does not live past the tests. --- .github/workflows/functional-tests.yml | 4 ++++ frontend/tests/functional/user-permissions.test.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 1965d315c..1d4bd99bd 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -100,6 +100,8 @@ jobs: - name: Run tests with browser ${{ matrix.playwright-browser }} working-directory: ${{ env.frontend-directory }} run: npx playwright test --project=${{ matrix.playwright-browser }} + env: + CI: true - uses: actions/upload-artifact@v4 if: always() with: @@ -196,6 +198,8 @@ jobs: - name: Run tests with browser ${{ matrix.playwright-browser }} working-directory: ${{ env.enterprise-frontend-build-directory }} run: npx playwright test --project=${{ matrix.playwright-browser }} + env: + CI: true - uses: actions/upload-artifact@v4 if: always() with: diff --git a/frontend/tests/functional/user-permissions.test.ts b/frontend/tests/functional/user-permissions.test.ts index 694a4626d..15f0bfb11 100644 --- a/frontend/tests/functional/user-permissions.test.ts +++ b/frontend/tests/functional/user-permissions.test.ts @@ -17,8 +17,8 @@ Object.entries(userGroups).forEach(([userGroup, userGroupData]) => { test.describe(`${userGroupData.name} user has the right permissions`, async () => { test.describe.configure({ mode: 'serial' }); - let vars = TestContent.generateTestVars(); - let testObjectsData: { [k: string]: any } = TestContent.itemBuilder(vars); + const vars = TestContent.generateTestVars(); + const testObjectsData: { [k: string]: any } = TestContent.itemBuilder(vars); test.beforeEach(async ({ page }) => { setHttpResponsesListener(page); @@ -212,6 +212,10 @@ Object.entries(userGroups).forEach(([userGroup, userGroupData]) => { }); test.afterAll('cleanup', async ({ browser }) => { + if (process.env.CI) { + // Don't cleanup in CI + return true; + } const page = await browser.newPage(); const loginPage = new LoginPage(page); const usersPage = new PageContent(page, '/users', 'Users');