From d6482fa6bf0dbaed0966c7a3984b94de6adbc8a9 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 30 Sep 2023 11:23:20 +0530 Subject: [PATCH] fix: Increased worker count and increased test action timeout to test stability --- .github/workflows/ci-cd.yml | 16 ++-------------- .github/workflows/playwright-test-workflow.yml | 5 +---- tests/playwright/playwright.config.ts | 13 ++++++++++--- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index babd895ead..388cb7c8a6 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -110,7 +110,6 @@ jobs: with: db: mysql shard: 1 - workers: 4 playwright-mysql-2: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -118,7 +117,6 @@ jobs: with: db: mysql shard: 2 - workers: 4 playwright-mysql-3: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -126,7 +124,6 @@ jobs: with: db: mysql shard: 3 - workers: 4 playwright-mysql-4: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -134,7 +131,6 @@ jobs: with: db: mysql shard: 4 - workers: 4 playwright-sqlite-1: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -142,7 +138,6 @@ jobs: with: db: sqlite shard: 1 - workers: 1 playwright-sqlite-2: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -150,7 +145,6 @@ jobs: with: db: sqlite shard: 2 - workers: 1 playwright-sqlite-3: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -158,15 +152,13 @@ jobs: with: db: sqlite shard: 3 - workers: 1 playwright-sqlite-4: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} uses: ./.github/workflows/playwright-test-workflow.yml with: db: sqlite - shard: 4 - workers: 1 + shard: 4 playwright-pg-shard-1: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -174,7 +166,6 @@ jobs: with: db: pg shard: 1 - workers: 4 playwright-pg-shard-2: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -182,7 +173,6 @@ jobs: with: db: pg shard: 2 - workers: 4 playwright-pg-shard-3: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -190,12 +180,10 @@ jobs: with: db: pg shard: 3 - workers: 4 playwright-pg-shard-4: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} uses: ./.github/workflows/playwright-test-workflow.yml with: db: pg - shard: 4 - workers: 4 \ No newline at end of file + shard: 4 \ No newline at end of file diff --git a/.github/workflows/playwright-test-workflow.yml b/.github/workflows/playwright-test-workflow.yml index 91db353fe5..f753fec7f8 100644 --- a/.github/workflows/playwright-test-workflow.yml +++ b/.github/workflows/playwright-test-workflow.yml @@ -10,9 +10,6 @@ on: db: required: true type: string - workers: - required: true - type: string jobs: playwright: @@ -147,7 +144,7 @@ jobs: timeout-minutes: 2 - name: Run Playwright Tests working-directory: ./tests/playwright - run: E2E_DB_TYPE=${{ inputs.db }} npm run ci:test:shard:${{ inputs.shard }} --workers=${{ inputs.workers }} + run: E2E_DB_TYPE=${{ inputs.db }} npm run ci:test:shard:${{ inputs.shard }} timeout-minutes: 60 # Stress test added/modified tests - name: Fetch develop branch diff --git a/tests/playwright/playwright.config.ts b/tests/playwright/playwright.config.ts index 5ea4151fd1..e6ce067c3f 100644 --- a/tests/playwright/playwright.config.ts +++ b/tests/playwright/playwright.config.ts @@ -10,6 +10,14 @@ require('dotenv').config(); * See https://playwright.dev/docs/test-configuration. */ +let workers = process.env.CI ? 2 : 4; + +if (process.env.CI) { + if (process.env.E2E_DB_TYPE === 'sqlite') workers = 1; + if (process.env.E2E_DB_TYPE === 'mysql') workers = 4; + if (process.env.E2E_DB_TYPE === 'pg') workers = 4; +} + export default defineConfig({ testDir: process.env.PW_QUICK_TEST ? './quickTests' : './tests', /* Maximum time one test can run for. */ @@ -29,8 +37,7 @@ export default defineConfig({ /* Retry on CI only */ retries: process.env.CI ? 3 : 0, /* Opt out of parallel tests on CI. */ - // workers: process.env.CI ? 2 : 4, - workers: process.env.CI ? 2 : 4, + workers: workers, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ @@ -38,7 +45,7 @@ export default defineConfig({ // headless: !!process.env.CI, headless: true, /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: process.env.E2E_DB_TYPE === 'sqlite' ? 12000 : 4000, + actionTimeout: 4000, /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: 'http://localhost:3000',