diff --git a/webui/react/playwright.config.ts b/webui/react/playwright.config.ts index 839480af472..84c7f7de11d 100644 --- a/webui/react/playwright.config.ts +++ b/webui/react/playwright.config.ts @@ -14,7 +14,7 @@ export default defineConfig({ forbidOnly: !!process.env.CI, /* Run tests in files in parallel */ - fullyParallel: true, + fullyParallel: !!process.env.CI, /* https://playwright.dev/docs/test-timeouts#global-timeout */ globalTimeout: 3 * 60 * 1000, // 3 min @@ -28,15 +28,6 @@ export default defineConfig({ name: 'chromium', use: { ...devices['Desktop Chrome'], channel: 'chrome' } }, - - { - name: 'chromium-no-cors', - use: { ...devices['Desktop Chrome'], channel: 'chrome', - bypassCSP: true, - launchOptions: { - args: ['--disable-web-security'] - }}, - }, { name: 'firefox', @@ -60,7 +51,7 @@ export default defineConfig({ /* Test against branded browsers. */ // { - // name: 'Microsoft Edge', + // name: 'edge', // use: { ...devices['Desktop Edge'], channel: 'msedge' }, // }, // { @@ -77,7 +68,7 @@ export default defineConfig({ ], /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, + retries: process.env.CI ? 1 : 0, testDir: './src/e2e', @@ -98,6 +89,5 @@ export default defineConfig({ reuseExistingServer: !process.env.CI, }, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 4 : undefined, + workers: process.env.CI ? 4 : 1, }); diff --git a/webui/react/src/e2e/README.md b/webui/react/src/e2e/README.md index 4c03118ea37..f2cc0a94533 100644 --- a/webui/react/src/e2e/README.md +++ b/webui/react/src/e2e/README.md @@ -14,7 +14,7 @@ Deteremined AI uses [Playwright 🎭](https://playwright.dev/). - Run `npx playwright install` - Run `SERVER_ADDRESS={set server address} npm run build` in `webui/react` - It is `SERVER_ADDRESS` here. not `PW_SERVER_ADDRESS`, but the both values should be the same -- Run `npm run e2e` in `webui/react` +- Run `npm run e2e` in `webui/react`. Use `-- --project=` to run a specific browser. \*\*Avoid using `make` command because it does not take env variables @@ -24,10 +24,10 @@ If you don't want to use dev cluster, you can use det deploy to initiate the bac 1. `det deploy local cluster-up --det-version="0.29.0" --no-gpu --master-port=8080` - use whatever det-version you want here. -2. `SERVER_ADDRESS="http://localhost:8080" npm run build --prefix webui/react` +2. `SERVER_ADDRESS="http://localhost:3001" npm run build --prefix webui/react` 3. Optional if you want an experiment created for the test: `det experiment create ./examples/tutorials/mnist_pytorch/const.yaml ./examples/tutorials/mnist_pytorch/` -4. To run the tests: `CI=true PW_SERVER_ADDRESS="http://localhost:8080" PW_USER_NAME="admin" PW_PASSWORD="" npm run e2e --prefix webui/react -- --project=chromium-no-cors` - - `CI=true` currently causes Playwright to start a frontend webserver for the test. If `CI=false` you'll need to do `npm run preview` manually and point the tests at the right port. +4. `npm run preview --prefix webui/react` to run the preview app. Not necessary if CI=true +5. To run the tests: `PW_SERVER_ADDRESS="http://localhost:3001" PW_USER_NAME="admin" PW_PASSWORD="" npm run e2e --prefix webui/react` ## CI diff --git a/webui/react/vite.config.mts b/webui/react/vite.config.mts index 3f0c708fa5f..cf1585e8047 100644 --- a/webui/react/vite.config.mts +++ b/webui/react/vite.config.mts @@ -131,6 +131,14 @@ export default defineConfig(({ mode }) => ({ ], preview: { port: 3001, + proxy: { + '/api': { target: webpackProxyUrl}, + '/proxy': { target: webpackProxyUrl}, + '/stream': { + target: websocketProxyUrl, + ws: true, + }, + }, strictPort: true, }, resolve: {