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:
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 }}
strategy:
fail-fast: false
@ -28,6 +28,9 @@ jobs:
shard:
- 1-2
- 2-2
configs:
- experimental
- stable
exclude:
- os: windows-latest
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
env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES: ${{ matrix.configs == 'experimental' }}
- name: Run all tests (for Linux)
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
env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES: ${{ matrix.configs == 'experimental' }}
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: always()
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

View File

@ -166,6 +166,9 @@ export class ChromeLauncher extends ProductLauncher {
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.
const disabledFeatures = [
'Translate',
@ -174,9 +177,13 @@ export class ChromeLauncher extends ProductLauncher {
'MediaRouter',
'OptimizationHints',
// https://crbug.com/1492053
'ProcessPerSiteUpToMainFrameThreshold',
turnOnExperimentalFeaturesForTesting
? ''
: 'ProcessPerSiteUpToMainFrameThreshold',
...userDisabledFeatures,
];
].filter(feature => {
return feature !== '';
});
const userEnabledFeatures = getFeatures('--enable-features', options.args);
if (options.args && userEnabledFeatures.length > 0) {
@ -187,7 +194,9 @@ export class ChromeLauncher extends ProductLauncher {
const enabledFeatures = [
'NetworkServiceInProcess2',
...userEnabledFeatures,
];
].filter(feature => {
return feature !== '';
});
const chromeArguments = [
'--allow-pre-commit-input',
@ -201,7 +210,9 @@ export class ChromeLauncher extends ProductLauncher {
'--disable-default-apps',
'--disable-dev-shm-usage',
'--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-infobars',
'--disable-ipc-flooding-protection',
@ -220,7 +231,9 @@ export class ChromeLauncher extends ProductLauncher {
'--use-mock-keychain',
`--disable-features=${disabledFeatures.join(',')}`,
`--enable-features=${enabledFeatures.join(',')}`,
];
].filter(arg => {
return arg !== '';
});
const {
devtools = false,
headless = !devtools,