Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: add chromium-headless-shell bots (#33242)

Max Schmitt487134fbafcd
diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml
index 8b8555eb86..71c7ed105f 100644
--- a/.github/workflows/tests_secondary.yml
+++ b/.github/workflows/tests_secondary.yml
@@ -284,3 +284,24 @@ jobs:
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW: 1
+
+ test_linux_chromium_headless_shell:
+ name: Chromium Headless Shell
+ environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
+ strategy:
+ fail-fast: false
+ matrix:
+ runs-on: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: ${{ matrix.runs-on }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/run-test
+ with:
+ browsers-to-install: chromium-headless-shell
+ command: npm run ctest
+ bot-name: "headless-shell-${{ matrix.runs-on }}"
+ flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
+ flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
+ flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
+ env:
+ PWTEST_CHANNEL: chromium-headless-shell
diff --git a/tests/library/chromium/launcher.spec.ts b/tests/library/chromium/launcher.spec.ts
index f36a089fa7..8758e63c12 100644
--- a/tests/library/chromium/launcher.spec.ts
+++ b/tests/library/chromium/launcher.spec.ts
@@ -52,7 +52,8 @@ it('should open devtools when "devtools: true" option is given', async ({ browse
await browser.close();
});
-it('should return background pages', async ({ browserType, createUserDataDir, asset }) => {
+it('should return background pages', async ({ browserType, createUserDataDir, asset, channel }) => {
+ it.skip(channel === 'chromium-headless-shell', 'Headless Shell has no support for extensions');
const userDataDir = await createUserDataDir();
const extensionPath = asset('simple-extension');
const extensionOptions = {
@@ -75,7 +76,8 @@ it('should return background pages', async ({ browserType, createUserDataDir, as
expect(context.backgroundPages().length).toBe(0);
});
-it('should return background pages when recording video', async ({ browserType, createUserDataDir, asset }, testInfo) => {
+it('should return background pages when recording video', async ({ browserType, createUserDataDir, asset, channel }, testInfo) => {
+ it.skip(channel === 'chromium-headless-shell', 'Headless Shell has no support for extensions');
const userDataDir = await createUserDataDir();
const extensionPath = asset('simple-extension');
const extensionOptions = {
@@ -99,7 +101,8 @@ it('should return background pages when recording video', async ({ browserType,
await context.close();
});
-it('should support request/response events when using backgroundPage()', async ({ browserType, createUserDataDir, asset, server }) => {
+it('should support request/response events when using backgroundPage()', async ({ browserType, createUserDataDir, asset, server, channel }) => {
+ it.skip(channel === 'chromium-headless-shell', 'Headless Shell has no support for extensions');
server.setRoute('/empty.html', (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html', 'x-response-foobar': 'BarFoo' });
res.end(`<span>hello world!</span>`);
@@ -148,7 +151,8 @@ it('should support request/response events when using backgroundPage()', async (
it('should report console messages from content script', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32762' }
-}, async ({ browserType, createUserDataDir, asset, server }) => {
+}, async ({ browserType, createUserDataDir, asset, server, channel }) => {
+ it.skip(channel === 'chromium-headless-shell', 'Headless Shell has no support for extensions');
const userDataDir = await createUserDataDir();
const extensionPath = asset('extension-with-logging');
const extensionOptions = {
diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.ts
index 5832ef44da..92f2e044e0 100644
--- a/tests/library/headful.spec.ts
+++ b/tests/library/headful.spec.ts
@@ -19,6 +19,7 @@ import { PNG } from 'playwright-core/lib/utilsBundle';
import { expect, playwrightTest as it } from '../config/browserTest';
it.use({ headless: false });
+it.skip(({ channel }) => channel === 'chromium-headless-shell');
it('should have default url when launching browser @smoke', async ({ launchPersistent }) => {
const { context } = await launchPersistent();
diff --git a/tests/library/launcher.spec.ts b/tests/library/launcher.spec.ts
index 54b74c6366..e7d71182cb 100644
--- a/tests/library/launcher.spec.ts
+++ b/tests/library/launcher.spec.ts
@@ -41,9 +41,10 @@ it('should kill browser process on timeout after close', async ({ browserType, m
expect(stalled).toBeTruthy();
});
-it('should throw a friendly error if its headed and there is no xserver on linux running', async ({ mode, browserType, platform }) => {
+it('should throw a friendly error if its headed and there is no xserver on linux running', async ({ mode, browserType, platform, channel }) => {
it.skip(platform !== 'linux');
it.skip(mode.startsWith('service'));
+ it.skip(channel === 'chromium-headless-shell', 'Headless Shell is always headless');
const error: Error = await browserType.launch({
headless: false,