2023-12-15 04:40:36 +08:00
|
|
|
import { defineConfig } from "@playwright/test";
|
|
|
|
|
2024-02-07 15:46:54 +08:00
|
|
|
const base = defineConfig({
|
2022-03-23 23:19:12 +08:00
|
|
|
use: {
|
|
|
|
screenshot: "only-on-failure",
|
2023-11-16 22:45:48 +08:00
|
|
|
trace: "retain-on-failure",
|
2024-01-23 08:19:48 +08:00
|
|
|
permissions: ["clipboard-read", "clipboard-write", "microphone"],
|
2023-11-16 22:45:48 +08:00
|
|
|
bypassCSP: true,
|
|
|
|
launchOptions: {
|
2024-01-23 08:19:48 +08:00
|
|
|
args: [
|
|
|
|
"--disable-web-security",
|
|
|
|
"--use-fake-device-for-media-stream",
|
2024-01-27 01:13:27 +08:00
|
|
|
"--use-fake-ui-for-media-stream",
|
|
|
|
"--use-file-for-fake-audio-capture=../gradio/test_data/test_audio.wav"
|
2024-01-23 08:19:48 +08:00
|
|
|
]
|
2023-11-16 22:45:48 +08:00
|
|
|
}
|
2022-03-23 23:19:12 +08:00
|
|
|
},
|
2024-02-01 22:23:59 +08:00
|
|
|
expect: { timeout: 15000 },
|
2024-03-13 21:46:40 +08:00
|
|
|
timeout: 30000,
|
2023-07-06 17:55:45 +08:00
|
|
|
testMatch: /.*.spec.ts/,
|
2023-03-28 07:12:58 +08:00
|
|
|
testDir: "..",
|
2024-03-21 04:38:15 +08:00
|
|
|
workers: process.env.CI ? 1 : undefined,
|
|
|
|
retries: 3
|
2023-12-15 04:40:36 +08:00
|
|
|
});
|
2024-02-07 15:46:54 +08:00
|
|
|
|
|
|
|
const normal = defineConfig(base, {
|
2024-03-22 03:59:53 +08:00
|
|
|
globalSetup: process.env.CUSTOM_TEST ? undefined : "./playwright-setup.js"
|
2024-02-07 15:46:54 +08:00
|
|
|
});
|
2024-03-04 22:03:46 +08:00
|
|
|
|
2024-02-07 15:46:54 +08:00
|
|
|
normal.projects = undefined; // Explicitly unset this field due to https://github.com/microsoft/playwright/issues/28795
|
|
|
|
|
|
|
|
const lite = defineConfig(base, {
|
|
|
|
webServer: {
|
2024-03-04 22:03:46 +08:00
|
|
|
command: "python -m http.server 8000 --directory ../js/lite",
|
|
|
|
url: "http://localhost:8000/",
|
2024-02-07 15:46:54 +08:00
|
|
|
reuseExistingServer: !process.env.CI
|
|
|
|
},
|
2024-02-07 22:57:52 +08:00
|
|
|
testMatch: [
|
|
|
|
"**/file_component_events.spec.ts",
|
|
|
|
"**/chatbot_multimodal.spec.ts",
|
2024-04-02 22:43:59 +08:00
|
|
|
"**/kitchen_sink.spec.ts",
|
2024-03-04 22:03:46 +08:00
|
|
|
"**/gallery_component_events.spec.ts"
|
2024-02-07 22:57:52 +08:00
|
|
|
],
|
2024-03-21 04:38:15 +08:00
|
|
|
workers: 1,
|
|
|
|
retries: 3
|
2024-02-07 15:46:54 +08:00
|
|
|
});
|
2024-03-04 22:03:46 +08:00
|
|
|
|
2024-02-07 15:46:54 +08:00
|
|
|
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;
|