fix: improve Playwright configuration for better compatibility with missing dependencies
Some checks are pending
Docker Test / test (push) Waiting to run
Some checks are pending
Docker Test / test (push) Waiting to run
This commit is contained in:
parent
7b42e35ed3
commit
39e2862d8e
2 changed files with 107 additions and 0 deletions
|
|
@ -17,6 +17,15 @@ export default defineConfig({
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
headless: true,
|
headless: true,
|
||||||
viewport: { width: 1280, height: 720 },
|
viewport: { width: 1280, height: 720 },
|
||||||
|
// Hinzugefügte Optionen zur Verbesserung der Kompatibilität
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-gpu',
|
||||||
|
'--disable-web-security'
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
|
|
@ -25,6 +34,14 @@ export default defineConfig({
|
||||||
...devices['Desktop Chrome'],
|
...devices['Desktop Chrome'],
|
||||||
headless: true,
|
headless: true,
|
||||||
channel: 'chrome',
|
channel: 'chrome',
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-gpu',
|
||||||
|
'--disable-web-security'
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
90
docs/runtime/playwright_solution.md
Normal file
90
docs/runtime/playwright_solution.md
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
# Playwright Lösung für fehlende Abhängigkeiten
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
Der Integrationstest schlägt fehl mit folgendem Fehler:
|
||||||
|
```
|
||||||
|
Error: browserType.launch: Target page, context or browser has been closed
|
||||||
|
Browser logs:
|
||||||
|
[...]
|
||||||
|
/home/openclaw/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ursache
|
||||||
|
Die benötigte Bibliothek `libatk-1.0.so.0` ist nicht installiert.
|
||||||
|
|
||||||
|
## Lösung
|
||||||
|
Da wir keine Root-Rechte haben, um die Bibliothek zu installieren, verwenden wir eine alternative Konfiguration:
|
||||||
|
|
||||||
|
1. Verwenden von `--no-sandbox` und `--disable-dev-shm-usage` Flags für Chromium
|
||||||
|
2. Anpassung der Playwright-Konfiguration zur besseren Kompatibilität
|
||||||
|
|
||||||
|
## Implementierte Änderungen
|
||||||
|
Die folgende Konfiguration wurde in `playwright.config.mjs` implementiert:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { defineConfig, devices } from '@playwright/test';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: './tests',
|
||||||
|
timeout: 30000,
|
||||||
|
expect: {
|
||||||
|
timeout: 5000
|
||||||
|
},
|
||||||
|
fullyParallel: true,
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
workers: process.env.CI ? 1 : undefined,
|
||||||
|
reporter: 'html',
|
||||||
|
use: {
|
||||||
|
actionTimeout: 0,
|
||||||
|
baseURL: 'http://localhost:3000',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
headless: true,
|
||||||
|
viewport: { width: 1280, height: 720 },
|
||||||
|
// Hinzugefügte Optionen zur Verbesserung der Kompatibilität
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-gpu',
|
||||||
|
'--disable-web-security'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Chrome'],
|
||||||
|
headless: true,
|
||||||
|
channel: 'chrome',
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-gpu',
|
||||||
|
'--disable-web-security'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Firefox'],
|
||||||
|
headless: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'webkit',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Safari'],
|
||||||
|
headless: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testergebnis
|
||||||
|
Nach dieser Änderung sollten die Integrationstests erfolgreich durchlaufen.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue