Skip to content

Commit

Permalink
TRY FIX // webkit // Gutenberg: "Headless webkit won't receive dataTr…
Browse files Browse the repository at this point in the history
…ansfer with custom types in the drop event on Linux. The solution is to use `xvfb-run` to run the tests."
  • Loading branch information
carstingaxion committed Aug 22, 2024
1 parent 67cf8db commit 907e977
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 16 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,32 @@ jobs:
- run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'

- name: Starting Playwright & Running the tests
# - name: Starting Playwright & Running the tests
# env:
# WP_BASE_URL: 'http://127.0.0.1:9400'
# run: |
# npm run test:e2e

# - name: Run the tests
# env:
# WP_BASE_URL: 'http://127.0.0.1:9400'
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
# run: |
# xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e


- name: Start the server
run: |
npm run playground -- &
- name: Run the tests
env:
WP_BASE_URL: 'http://127.0.0.1:9400'
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
npm run test:e2e
WP_BASE_URL=http://127.0.0.1:9400/ \
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- \
npm run test:e2e
- name: Retain failed test results
uses: actions/upload-artifact@v4
Expand Down
42 changes: 29 additions & 13 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
import os from 'os';
import { defineConfig, devices } from '@playwright/test';

/**
Expand Down Expand Up @@ -39,7 +40,18 @@ export default defineConfig({

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
use: {
...devices[ 'Desktop Safari' ],

Check failure on line 44 in test/e2e/playwright.config.ts

View workflow job for this annotation

GitHub Actions / JavaScript Coding Standards

Replace `·'Desktop·Safari'·` with `'Desktop·Safari'`
/**
* Headless webkit won't receive dataTransfer with custom types in the
* drop event on Linux. The solution is to use `xvfb-run` to run the tests.
* ```sh
* xvfb-run npm run test:e2e
* ```
* See `.github/workflows/e2e-tests.yml` for advanced usages.
*/
headless: os.type() !== 'Linux',
},
},

/* Test against mobile viewports. */
Expand All @@ -64,16 +76,20 @@ export default defineConfig({
],
// Don't report slow test "files", as we will be running our tests in serial.
reportSlowTests: null,
webServer: {
...baseConfig.webServer,
command: 'set WP_BASE_URL=http://127.0.0.1:9400/ && npm run playground',
// timeout: 180_000, // 180 seconds.
port: 9400,
reuseExistingServer: !process.env.CI,
},
use: {
...baseConfig.use,
baseURL: 'http://127.0.0.1:9400',
actionTimeout: 15_000, // 10 seconds +5 seconds to help webkit tests pass.
},
// webServer: {
// ...baseConfig.webServer,
// command: 'set WP_BASE_URL=http://127.0.0.1:9400/ && npm run playground',
// // timeout: 180_000, // 180 seconds.
// port: 9400,
// reuseExistingServer: !process.env.CI,
// // reuseExistingServer: true,
// // reuseExistingServer: false,
// },
// use: {
// ...baseConfig.use,
// baseURL: 'http://127.0.0.1:9400',
// actionTimeout: 15_000, // 10 seconds +5 seconds to help webkit tests pass.
// },
retries: 0,
webServer: undefined,
});

0 comments on commit 907e977

Please sign in to comment.