langflow/src/frontend/playwright.config.ts
Gabriel Luiz Freitas Almeida f19c449f15
Add Frontend Tests (#1571)
* Add TypeScript test workflow

* Update follow-redirects and katex versions

* Add Python setup and Poetry installation for backend

* Update Poetry version and setup Python in workflows

* Add Poetry installation step to GitHub Actions workflow

* Add Playwright report artifact upload and improve test script

* Update Playwright test configuration and add global teardown script

* Update path for playwright-report directory

* Update timeout value in playwright.config.ts

* Update page URLs in end-to-end tests

* Update GitHub Actions workflow and Playwright configuration

* Update TypeScript test workflow

* Add pattern and merge-multiple options to artifact download

* Update TypeScript test workflow to install Poetry

* Add cache steps for Playwright and Poetry

* Update PLAYWRIGHT_BROWSERS_PATH in TypeScript test workflow

* Add 'stuff/' to .gitignore

* Remove caching of Poetry virtualenv

* Update frontend tests to use Playwright for UI testing

* Add global teardown for removing temp database

* Add cache-hit condition to setup-node and setup-python steps

* Add new file to .gitignore and update ignored files

* Update playwright cache key in TypeScript test workflow

* Update path for blob-report in GitHub workflow

* Update path for playwright cache

* Update dependency installation in workflows

* Update baseURL in playwright.config.ts

* Update baseURL in playwright.config.ts

* Refactor test timeouts

* Remove playwright-report index.html file

* Add npm run start command to playwright.config.ts

* Update npm start command in playwright.config.ts

* Update Playwright browser caching and installation

* Update playwright cache path

* Update playwright cache path

* Update actions/cache version to v4

* Update Playwright cache key to use package-lock.json

* Update Playwright cache and install dependencies

* Fix typo in Playwright installation command

* Fix npm ci command in TypeScript test workflow

* Update TypeScript test workflow
2024-03-27 14:27:40 -03:00

79 lines
2.1 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 2 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
timeout: 120 * 1000,
// reporter: [
// ["html", { open: "never", outputFolder: "playwright-report/test-results" }],
// ],
reporter: process.env.CI ? "blob" : "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:3000/",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},
globalTeardown: require.resolve("./tests/globalTeardown.ts"),
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] },
// },
],
/* Run your local dev server before starting the tests */
webServer: [
{
command:
"poetry run uvicorn --factory langflow.main:create_app --host 127.0.0.1 --port 7860",
port: 7860,
env: {
LANGFLOW_DATABASE_URL: "sqlite:///./temp",
LANGFLOW_AUTO_LOGIN: "true",
},
stdout: "ignore",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
{
command: "npm start",
port: 3000,
env: {
VITE_PROXY_TARGET: "http://127.0.0.1:7860",
},
},
],
});