ci: add an option to run with experimental features (#12210)

This commit is contained in:
Alex Rudenko 2024-04-05 11:05:39 +02:00 committed by GitHub
parent e455db447d
commit bb10e45696
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 7 deletions

View File

@ -11,7 +11,7 @@ on:
jobs: jobs:
canary-chrome-tests: canary-chrome-tests:
name: ${{ matrix.suite }} tests on ${{ matrix.os }} (${{ matrix.shard }}) name: ${{ matrix.suite }} tests on ${{ matrix.os }} (${{ matrix.shard }}) ${{ matrix.configs }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -28,6 +28,9 @@ jobs:
shard: shard:
- 1-2 - 1-2
- 2-2 - 2-2
configs:
- experimental
- stable
exclude: exclude:
- os: windows-latest - os: windows-latest
suite: chrome-bidi suite: chrome-bidi
@ -57,13 +60,15 @@ jobs:
run: npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json run: npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env: env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }} PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES: ${{ matrix.configs == 'experimental' }}
- name: Run all tests (for Linux) - name: Run all tests (for Linux)
if: ${{ matrix.os == 'ubuntu-latest' }} if: ${{ matrix.os == 'ubuntu-latest' }}
run: xvfb-run --auto-servernum npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json run: xvfb-run --auto-servernum npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env: env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }} PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES: ${{ matrix.configs == 'experimental' }}
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: always() if: always()
with: with:
name: test-results-${{ matrix.os }}-${{ matrix.suite }}-${{ matrix.shard }} name: test-results-${{ matrix.os }}-${{ matrix.suite }}-${{ matrix.shard }}-${{ matrix.configs }}
path: /tmp/artifacts/*.json path: /tmp/artifacts/*.json

View File

@ -166,6 +166,9 @@ export class ChromeLauncher extends ProductLauncher {
removeMatchingFlags(options.args, '--disable-features'); removeMatchingFlags(options.args, '--disable-features');
} }
const turnOnExperimentalFeaturesForTesting =
process.env['PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES'] === 'true';
// Merge default disabled features with user-provided ones, if any. // Merge default disabled features with user-provided ones, if any.
const disabledFeatures = [ const disabledFeatures = [
'Translate', 'Translate',
@ -174,9 +177,13 @@ export class ChromeLauncher extends ProductLauncher {
'MediaRouter', 'MediaRouter',
'OptimizationHints', 'OptimizationHints',
// https://crbug.com/1492053 // https://crbug.com/1492053
'ProcessPerSiteUpToMainFrameThreshold', turnOnExperimentalFeaturesForTesting
? ''
: 'ProcessPerSiteUpToMainFrameThreshold',
...userDisabledFeatures, ...userDisabledFeatures,
]; ].filter(feature => {
return feature !== '';
});
const userEnabledFeatures = getFeatures('--enable-features', options.args); const userEnabledFeatures = getFeatures('--enable-features', options.args);
if (options.args && userEnabledFeatures.length > 0) { if (options.args && userEnabledFeatures.length > 0) {
@ -187,7 +194,9 @@ export class ChromeLauncher extends ProductLauncher {
const enabledFeatures = [ const enabledFeatures = [
'NetworkServiceInProcess2', 'NetworkServiceInProcess2',
...userEnabledFeatures, ...userEnabledFeatures,
]; ].filter(feature => {
return feature !== '';
});
const chromeArguments = [ const chromeArguments = [
'--allow-pre-commit-input', '--allow-pre-commit-input',
@ -201,7 +210,9 @@ export class ChromeLauncher extends ProductLauncher {
'--disable-default-apps', '--disable-default-apps',
'--disable-dev-shm-usage', '--disable-dev-shm-usage',
'--disable-extensions', '--disable-extensions',
'--disable-field-trial-config', // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md turnOnExperimentalFeaturesForTesting
? ''
: '--disable-field-trial-config', // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
'--disable-hang-monitor', '--disable-hang-monitor',
'--disable-infobars', '--disable-infobars',
'--disable-ipc-flooding-protection', '--disable-ipc-flooding-protection',
@ -220,7 +231,9 @@ export class ChromeLauncher extends ProductLauncher {
'--use-mock-keychain', '--use-mock-keychain',
`--disable-features=${disabledFeatures.join(',')}`, `--disable-features=${disabledFeatures.join(',')}`,
`--enable-features=${enabledFeatures.join(',')}`, `--enable-features=${enabledFeatures.join(',')}`,
]; ].filter(arg => {
return arg !== '';
});
const { const {
devtools = false, devtools = false,
headless = !devtools, headless = !devtools,