-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
playwright.config.js
48 lines (44 loc) 路 1.84 KB
/
playwright.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { defineConfig } from "@playwright/test";
const base = defineConfig({
use: {
screenshot: "only-on-failure",
trace: "retain-on-failure",
permissions: ["clipboard-read", "clipboard-write", "microphone"],
bypassCSP: true,
launchOptions: {
args: [
"--disable-web-security",
"--use-fake-device-for-media-stream",
"--use-fake-ui-for-media-stream",
"--use-file-for-fake-audio-capture=../gradio/test_data/test_audio.wav"
]
}
},
expect: { timeout: 15000 },
timeout: 15000,
testMatch: /.*.spec.ts/,
testDir: "..",
workers: process.env.CI ? 1 : undefined
});
const normal = defineConfig(base, {
globalSetup: "./playwright-setup.js"
});
normal.projects = undefined; // Explicitly unset this field due to https://github.com/microsoft/playwright/issues/28795
const lite = defineConfig(base, {
webServer: {
command: "pnpm --filter @gradio/app dev:lite",
url: "http://localhost:9876/lite.html",
reuseExistingServer: !process.env.CI
},
testIgnore: [
"**/audio_component_events.spec.ts", // Uploading a file requires ffprobe on the server-side, which is not supported in lite.
"**/cancel_events.spec.ts", // This sample app uses `time.sleep` which is not supported on Pyodide.
"**/custom_css.spec.ts", // Media queries is not working somehow.
"**/clear_components.spec.ts", // `gr.Image()` with remote image is not supported in lite because it calls `httpx.stream` through `processing_utils.save_url_to_cache()`.
"**/load_space.spec.ts", // `gr.load()`, which calls `httpx.get` is not supported in lite.
"**/gradio_pdf_demo.spec.ts" // The PDF component is not working on Lite, https://github.com/gradio-app/gradio/issues/7476
],
workers: 1
});
lite.projects = undefined; // Explicitly unset this field due to https://github.com/microsoft/playwright/issues/28795
export default !!process.env.GRADIO_E2E_TEST_LITE ? lite : normal;