Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +28,9 @@ jobs:
shard:
- 1-2
- 2-2
configs:
- experimental
- stable
exclude:
- os: windows-latest
suite: chrome-bidi
Expand Down Expand Up @@ -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
23 changes: 18 additions & 5 deletions packages/puppeteer-core/src/node/ChromeLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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) {
Expand All @@ -187,7 +194,9 @@ export class ChromeLauncher extends ProductLauncher {
const enabledFeatures = [
'NetworkServiceInProcess2',
...userEnabledFeatures,
];
].filter(feature => {
return feature !== '';
});

const chromeArguments = [
'--allow-pre-commit-input',
Expand All @@ -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',
Expand All @@ -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,
Expand Down