Files
Diego Imbert a384b4c23d Playwright E2E (#7520)
* clean plate

* npm i

* log in e2e

* global setup login

* set license key

* Revert "set license key"

This reverts commit 86d5db2c48.

* create datatable test

* fix wrong pg_creds

* data table + db manager e2e test

* DbManagerPage class

* small refactor

* create resource test + improvements

* text db manager in resources

* Factor test logic in classes

* refactoring

* refacto

* alter table test

* alter table e2e test

* set schema in test

* nits

* fix wrong schema var

* Correct setup and parallelization

* reducedMotion

* tests passing headless !

* bigger timeout

* start e2e docker compose

* e2e runs on all databases

* nit test uid fix

* refactp

* stash

* Better Workspace Storage settings

* minio setup

* nit

* nit

* super nit

* Permission settings in modal

* badge indicator

* Fetch alter table metadata much faster

* Upgrade duckdb to 1.4.3

* Ducklake tests

* Disable transactional DDL for Ducklake (bug on their side)

* git ignore env

* bigquery tests passes

* getJsonEnv

* load coldef in parallel

* Make Bigquery schema fetching much faster

* makeLoadTableMetaDataQuery for entire db in bigquery

* refactor getDbSchemas to avoid assignment side effect

* fix col def

* Better loading state mgmt

* snowflake

* fix snowflake primary keys

* Test CI

* fix setTimeout type

* remove type node

* test e2e ci

* Revert "test e2e ci"

This reverts commit bf98a755dc.

* remove ci

* fix snowflake pk query in alternate schemas

* nit wait for coldefs

* nit snowflake

* Snowflake fk fix

* UNPROCESSABLE_ENTITY instead of INTERNAL_ERROR

* nits

* fix alter pk in snowflake

* yet other fixes

* snowflake tests pass

* nits
2026-01-22 16:20:01 +00:00

71 lines
2.3 KiB
TypeScript

// global-setup.ts
import { chromium, FullConfig } from '@playwright/test'
async function globalSetup(config: FullConfig) {
process.env.TEST_UNIQUE_ID = Date.now().toString()
const browser = await chromium.launch()
const context = await browser.newContext({
permissions: ['clipboard-read', 'clipboard-write']
})
const page = await context.newPage()
// Use baseURL from config
const baseURL = config.projects[0].use.baseURL || 'http://localhost:3000'
await page.goto(baseURL)
// Wait for and fill the email input
const emailInput = page.locator('input#email[type="email"]')
await emailInput.waitFor({ state: 'visible' })
await emailInput.fill('admin@windmill.dev')
// Wait for and fill the password input
const passwordInput = page.locator('input#password[type="password"]')
await passwordInput.waitFor({ state: 'visible' })
await passwordInput.fill('changeme')
// Click the sign-in button
const signInButton = page.locator('button:has-text("Sign in")')
await signInButton.click()
// Handle potential first-time user flow
await page.waitForURL(/\/user\/(first-time|workspaces)/)
if (page.url().includes('/user/first-time')) {
const skipButton = page.locator('button:has-text("Skip")')
await skipButton.click()
}
// Wait for navigation to workspaces page
await page.waitForURL('**/user/workspaces')
// Click on the "Admins" workspace
const adminsWorkspace = page.locator('text=Admins').first()
await adminsWorkspace.waitFor({ state: 'visible' })
await adminsWorkspace.click()
// Wait for workspace to load
await page.waitForURL('**/')
if (!process.env.SKIP_HUB_SYNC) {
await page.locator('#home-search-input').waitFor({ state: 'visible' })
await page.locator('#home-search-input').fill('u/admin/hub_sync')
const hubSyncBtn = page.locator('text=u/admin/hub_sync').first()
await hubSyncBtn.waitFor({ state: 'visible' })
await hubSyncBtn.click()
const runBtn = page.locator('#run-form-run-button')
await runBtn.waitFor({ state: 'visible' })
await runBtn.click()
await page.waitForURL(/\/run\/.+/)
await page.locator('text=Success').waitFor({ timeout: 30000, state: 'visible' })
}
// Save the authenticated state
await context.storageState({ path: './e2e/auth.json' })
await browser.close()
}
export default globalSetup
declare const process: any // ignore TS errors