mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-03 01:50:59 +08:00
cccab27fe8
* Set up E2E test config for lite * Use the same Page instance for all the tests in the case of lite * Fix reading demo files * Fix config * Install requirements based on `requirements.txt` * Add the "loaded" event dispatched from the main component to make a promise wait for the compoonent to be loaded * Refactor js/tootils/src/index.ts * Add testIgnore for lite * Fix chatbot_multimodal.spec.ts * Stop raising an exception when trying to cache examples but just show warning * Update comment * Mark the test slow when the page is initialized in it * Add logs * Set timeout * add changeset * Add the CI file .github/workflows/test-lite.yml * Add E2E testing for Lite to the test-functional job --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
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: [
|
|
"**/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.
|
|
]
|
|
});
|
|
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;
|