2023-12-14 15:40:36 -05:00
import { defineConfig } from "@playwright/test" ;
2024-02-07 07:46:54 +00:00
const base = defineConfig ( {
2022-03-23 15:19:12 +00:00
use : {
screenshot : "only-on-failure" ,
2023-11-16 09:45:48 -05:00
trace : "retain-on-failure" ,
2024-01-23 01:19:48 +01:00
permissions : [ "clipboard-read" , "clipboard-write" , "microphone" ] ,
2023-11-16 09:45:48 -05:00
bypassCSP : true ,
launchOptions : {
2024-01-23 01:19:48 +01:00
args : [
"--disable-web-security" ,
"--use-fake-device-for-media-stream" ,
2024-01-26 17:13:27 +00:00
"--use-fake-ui-for-media-stream" ,
"--use-file-for-fake-audio-capture=../gradio/test_data/test_audio.wav"
2024-01-23 01:19:48 +01:00
]
2023-11-16 09:45:48 -05:00
}
2022-03-23 15:19:12 +00:00
} ,
2024-02-01 14:23:59 +00:00
expect : { timeout : 15000 } ,
2024-03-13 13:46:40 +00:00
timeout : 30000 ,
2023-07-06 10:55:45 +01:00
testMatch : /.*.spec.ts/ ,
2023-03-28 00:12:58 +01:00
testDir : ".." ,
2024-03-20 13:38:15 -07:00
workers : process . env . CI ? 1 : undefined ,
retries : 3
2023-12-14 15:40:36 -05:00
} ) ;
2024-02-07 07:46:54 +00:00
const normal = defineConfig ( base , {
2024-03-21 12:59:53 -07:00
globalSetup : process . env . CUSTOM _TEST ? undefined : "./playwright-setup.js"
2024-02-07 07:46:54 +00:00
} ) ;
2024-03-04 14:03:46 +00:00
2024-02-07 07:46:54 +00: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 14:03:46 +00:00
command : "python -m http.server 8000 --directory ../js/lite" ,
url : "http://localhost:8000/" ,
2024-02-07 07:46:54 +00:00
reuseExistingServer : ! process . env . CI
} ,
2024-02-07 14:57:52 +00:00
testMatch : [
"**/file_component_events.spec.ts" ,
"**/chatbot_multimodal.spec.ts" ,
2024-04-02 23:43:59 +09:00
"**/kitchen_sink.spec.ts" ,
2024-04-17 03:54:34 +09:00
"**/gallery_component_events.spec.ts" ,
"**/image_remote_url.spec.ts" // To detect the bugs on Lite fixed in https://github.com/gradio-app/gradio/pull/8011 and https://github.com/gradio-app/gradio/pull/8026
2024-02-07 14:57:52 +00:00
] ,
2024-03-20 13:38:15 -07:00
workers : 1 ,
retries : 3
2024-02-07 07:46:54 +00:00
} ) ;
2024-03-04 14:03:46 +00:00
2024-02-07 07:46:54 +00: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 ;