From e1d6bd70c129a9870382fb0d1ffb5a29637333c5 Mon Sep 17 00:00:00 2001 From: Juan Fernandez Date: Mon, 23 Feb 2026 16:46:47 +0100 Subject: [PATCH 1/2] fix flakiness --- .github/workflows/test-optimization.yml | 4 +++ .../automatic-log-submission.spec.js | 25 +++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-optimization.yml b/.github/workflows/test-optimization.yml index 15b74c1eacc..0a359490d1e 100644 --- a/.github/workflows/test-optimization.yml +++ b/.github/workflows/test-optimization.yml @@ -58,6 +58,10 @@ jobs: with: path: ~/.cache/ms-playwright key: playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} + # Install chromium (configured in integration-tests/playwright.config.js) + # *Be advised*: this means that we'll only be using chromium for this test suite + - name: Install Playwright Chromium + run: npx playwright install chromium - run: yarn test:integration:testopt integration-playwright: diff --git a/integration-tests/ci-visibility/automatic-log-submission.spec.js b/integration-tests/ci-visibility/automatic-log-submission.spec.js index 93bc40b1ef0..08e0b72fac9 100644 --- a/integration-tests/ci-visibility/automatic-log-submission.spec.js +++ b/integration-tests/ci-visibility/automatic-log-submission.spec.js @@ -1,7 +1,7 @@ 'use strict' const assert = require('assert') -const { exec, execSync } = require('child_process') +const { exec } = require('child_process') const { once } = require('events') const { @@ -27,19 +27,18 @@ describe('test optimization automatic log submission', () => { '@playwright/test', ], true) - before(done => { + before(async () => { cwd = sandboxCwd() - const { NODE_OPTIONS, ...restOfEnv } = process.env - // Install chromium (configured in integration-tests/playwright.config.js) - // *Be advised*: this means that we'll only be using chromium for this test suite - execSync('npx playwright install --with-deps chromium', { cwd, env: restOfEnv, stdio: 'inherit' }) - webAppServer.listen(0, () => { - const address = webAppServer.address() - if (!address || typeof address === 'string') { - return done(new Error('Failed to determine web app server port')) - } - webAppPort = address.port - done() + await new Promise((resolve, reject) => { + webAppServer.listen(0, () => { + const address = webAppServer.address() + if (!address || typeof address === 'string') { + reject(new Error('Failed to determine web app server port')) + return + } + webAppPort = address.port + resolve() + }) }) }) From bfbf4f69ebe461e1e3ea9b911f42063b67d52a4d Mon Sep 17 00:00:00 2001 From: Juan Fernandez Date: Mon, 23 Feb 2026 16:57:58 +0100 Subject: [PATCH 2/2] fix --- .github/workflows/test-optimization.yml | 10 +++------- .../ci-visibility/automatic-log-submission.spec.js | 7 ++++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-optimization.yml b/.github/workflows/test-optimization.yml index 0a359490d1e..a547bcbb2c8 100644 --- a/.github/workflows/test-optimization.yml +++ b/.github/workflows/test-optimization.yml @@ -47,21 +47,17 @@ jobs: with: version: ${{ matrix.version }} - uses: ./.github/actions/install - - name: Get latest Playwright version + - name: Get Playwright version from versions package.json id: playwright-version run: | - PLAYWRIGHT_VERSION=$(npm view @playwright/test version) + PLAYWRIGHT_VERSION=$(node -p "require('./packages/dd-trace/test/plugins/versions/package.json').dependencies['@playwright/test']") echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT - echo "Latest Playwright version: $PLAYWRIGHT_VERSION" + echo "Playwright version: $PLAYWRIGHT_VERSION" - name: Cache Playwright browsers uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 with: path: ~/.cache/ms-playwright key: playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} - # Install chromium (configured in integration-tests/playwright.config.js) - # *Be advised*: this means that we'll only be using chromium for this test suite - - name: Install Playwright Chromium - run: npx playwright install chromium - run: yarn test:integration:testopt integration-playwright: diff --git a/integration-tests/ci-visibility/automatic-log-submission.spec.js b/integration-tests/ci-visibility/automatic-log-submission.spec.js index 08e0b72fac9..72190ca7649 100644 --- a/integration-tests/ci-visibility/automatic-log-submission.spec.js +++ b/integration-tests/ci-visibility/automatic-log-submission.spec.js @@ -1,7 +1,7 @@ 'use strict' const assert = require('assert') -const { exec } = require('child_process') +const { exec, execSync } = require('child_process') const { once } = require('events') const { @@ -29,6 +29,11 @@ describe('test optimization automatic log submission', () => { before(async () => { cwd = sandboxCwd() + const { NODE_OPTIONS, ...restOfEnv } = process.env + // Install chromium (configured in integration-tests/playwright.config.js) + // *Be advised*: this means that we'll only be using chromium for this test suite + // Must run in before hook: sandbox is created at test time so workflow can't install + execSync('npx playwright install chromium', { cwd, env: restOfEnv, stdio: 'inherit' }) await new Promise((resolve, reject) => { webAppServer.listen(0, () => { const address = webAppServer.address()