diff --git a/.github/workflows/test-optimization.yml b/.github/workflows/test-optimization.yml index 15b74c1eacc..a547bcbb2c8 100644 --- a/.github/workflows/test-optimization.yml +++ b/.github/workflows/test-optimization.yml @@ -47,12 +47,12 @@ 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: diff --git a/integration-tests/ci-visibility/automatic-log-submission.spec.js b/integration-tests/ci-visibility/automatic-log-submission.spec.js index 93bc40b1ef0..72190ca7649 100644 --- a/integration-tests/ci-visibility/automatic-log-submission.spec.js +++ b/integration-tests/ci-visibility/automatic-log-submission.spec.js @@ -27,19 +27,23 @@ 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() + // 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() + if (!address || typeof address === 'string') { + reject(new Error('Failed to determine web app server port')) + return + } + webAppPort = address.port + resolve() + }) }) })