Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the dev server for the Lite E2E test instead of the built version… #8031

Closed
wants to merge 9 commits into from
7 changes: 7 additions & 0 deletions .changeset/chatty-tires-tan.md
@@ -0,0 +1,7 @@
---
"@gradio/app": minor
"@gradio/tootils": minor
"gradio": minor
---

feat:Use the dev server for the Lite E2E test instead of the built version…
4 changes: 2 additions & 2 deletions .config/playwright.config.js
Expand Up @@ -31,8 +31,8 @@ normal.projects = undefined; // Explicitly unset this field due to https://githu

const lite = defineConfig(base, {
webServer: {
command: "python -m http.server 8000 --directory ../js/lite",
url: "http://localhost:8000/",
command: "pnpm --filter @gradio/app dev:lite",
url: "http://localhost:9876/lite.html",
reuseExistingServer: !process.env.CI
},
testMatch: [
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-functional.yml
Expand Up @@ -52,7 +52,6 @@ jobs:
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
with:
always_install_pnpm: true
build_lite: true
- name: install outbreak_forecast dependencies
run: |
. venv/bin/activate
Expand Down
4 changes: 4 additions & 0 deletions js/app/src/lite/dev/App.svelte
Expand Up @@ -81,8 +81,12 @@ def hi(name):
playground: false,
layout: null
});
// @ts-ignore
window.controller = controller; // For Playwright
});
onDestroy(() => {
// @ts-ignore
window.controller = undefined;
controller.unmount();
});

Expand Down
3 changes: 2 additions & 1 deletion js/app/vite.config.ts
Expand Up @@ -49,13 +49,14 @@ export default defineConfig(({ mode }) => {
const production = mode === "production" || mode === "production:lite";
const development = mode === "development" || mode === "development:lite";
const is_lite = mode.endsWith(":lite");
const is_e2e_test = process.env.GRADIO_E2E_TEST_LITE;

return {
base: "./",

server: {
port: 9876,
open: is_lite ? "/lite.html" : "/"
open: is_e2e_test ? false : is_lite ? "/lite.html" : "/"
},

build: {
Expand Down
2 changes: 1 addition & 1 deletion js/tootils/src/index.ts
Expand Up @@ -37,7 +37,7 @@ const test_normal = base.extend<{ setup: void }>({
]
});

const lite_url = "http://localhost:8000/for_e2e.html";
const lite_url = "http://localhost:9876/lite.html";
// LIte taks a long time to initialize, so we share the page across tests, sacrificing the test isolation.
let shared_page_for_lite: Page;
const test_lite = base.extend<{ setup: void }>({
Expand Down