Skip to content

Conversation

@nopcoder
Copy link
Contributor

@nopcoder nopcoder commented Feb 6, 2026

Summary

Rewrites and simplifies the E2E Playwright test infrastructure. Net result is -92 lines (844 added, 936 removed) with better architecture.

What changed

  • Decomposed God Object: repositoryPage.ts was a 246-line class handling branches, uploads, commits, merges, reverts, and navigation. It's now a 52-line facade that composes 5 focused sub-POMs (branchOperations, objectOperations, changesOperations, commitsOperations, revertOperations), accessed via repositoryPage.branches.createBranch(...), repositoryPage.changes.commitChanges(...), etc.

  • Playwright fixtures: Tests no longer manually construct POMs. A custom fixture system in fixtures.ts provides POMs via destructuring (async ({ repositoriesPage, repositoryPage }) => { ... }), eliminating 2-4 lines of boilerplate per test.

  • Named timeouts: Replaced magic numbers (5000, 10000, 120000) scattered through tests with self-documenting constants: TIMEOUT_LONG_OPERATION (120s), TIMEOUT_ELEMENT_VISIBLE (10s), TIMEOUT_NAVIGATION (5s).

  • API client: New lakeFSApi.ts wraps Playwright's APIRequestContext with Basic auth for test setup via the lakeFS REST API.

  • Auth simplification: Flattened directory structure, removed consts.ts, consolidated credential paths into credentialsFile.ts. Added .gitignore entry for generated credential files.

  • Bug fix: getUncommittedCount() used .isVisible() (a boolean check that doesn't wait) instead of expect().toBeVisible() (an assertion that auto-retries). This could return 0 on slow page loads.

  • Test README: Added webui/test/README.md documenting how to run, debug, and extend the tests, plus architecture and design principles.

Test plan

  • SKIP_SETUP=true npx playwright test — passing tests still pass (4/4 unrelated to sample data creation)
  • Full setup run on fresh lakeFS instance

@github-actions github-actions bot added area/testing Improvements or additions to tests area/UI Improvements or additions to UI labels Feb 6, 2026
@nopcoder nopcoder self-assigned this Feb 6, 2026
@nopcoder nopcoder marked this pull request as draft February 6, 2026 18:34
@nopcoder nopcoder added the exclude-changelog PR description should not be included in next release changelog label Feb 6, 2026
- Add custom Playwright fixtures to eliminate POM construction boilerplate
- Add lakeFSApi helper wrapping Playwright APIRequestContext for test setup
- Split RepositoryPage god object into focused sub-POMs (branches, objects,
  changes, commits, revert) with a thin facade
- Add named timeout constants replacing magic numbers across all specs
- Separate setup infrastructure (auth state saving) from setup validation
  tests so validation failures don't break all downstream projects
- Add test.step() for logical grouping in long test scenarios
- Pin @duckdb/duckdb-wasm to 1.28.0 (1.32.0 has a regression where
  COPY TO lakefs:// silently fails)
- Fix objectViewerPage.clickExecuteButton to wait for query completion,
  eliminating a false positive in DuckDB result verification
- Fix pullsPage.getPullsListCount to handle empty pull request lists
- Fix repositoriesPage.createRepository to fill Storage Namespace when
  the server has no default_namespace_prefix configured
- Consolidate duplicate credential types in credentialsFile.ts
- Remove test-upload.txt side-effect file; use Buffer.from() instead
- Use TypeScript parameter properties across all POMs (eliminates
  manual field + constructor assignment boilerplate)
- Extract shared createLakeFSApi factory in fixtures.ts (dedup
  lakeFSApi and lakeFSApiWorker fixture code)
- Combine chained locator selectors into single CSS selectors
  (e.g. table.table tbody tr instead of 3 chained .locator calls)
- Collapse single-line fixture definitions to reduce visual noise
- Extract SETUP_SPECS constant in playwright config to DRY testIgnore
- Simplify createRepository: single heading assertion with ternary
  instead of duplicated if/return/else branches
- Add test/README.md with instructions for running tests, headed mode,
  debugging (inspector, traces, UI mode, VS Code), env vars, and
  project structure
@nopcoder nopcoder force-pushed the webui/e2e-test-rewrite branch 2 times, most recently from 3ddc346 to 091518c Compare February 7, 2026 06:36
@nopcoder nopcoder force-pushed the webui/e2e-test-rewrite branch from 05f998f to 669e641 Compare February 7, 2026 07:16
@nopcoder nopcoder marked this pull request as ready for review February 7, 2026 07:16
Reduce documentation surface area and prevent stale structure docs as tests evolve.
Avoid redirects to /setup in environments where only the comm prefs step is pending, improving e2e test reliability when SKIP_SETUP is set.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the WebUI E2E Playwright suite to reduce boilerplate and flakiness by introducing fixtures, decomposing the repository POM into focused “operations” sub-POMs, and standardizing timeouts and setup via a small API client.

Changes:

  • Split the former RepositoryPage “god object” into a facade that composes BranchOperations, ObjectOperations, ChangesOperations, RevertOperations, and CommitsOperations.
  • Added a shared fixture layer (fixtures.ts) and an API helper (LakeFSApi) to simplify test setup and reduce per-test POM construction.
  • Introduced named timeout constants and updated tests/specs accordingly; added a new E2E README and updated Playwright project configuration.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
webui/test/e2e/timeouts.ts Adds named timeout constants for E2E waits.
webui/test/e2e/poms/setupPage.ts Minor POM cleanup via constructor parameter property.
webui/test/e2e/poms/revertOperations.ts New sub-POM for revert flows.
webui/test/e2e/poms/repositoryPage.ts Converts RepositoryPage into a thin facade composing sub-POMs.
webui/test/e2e/poms/repositoriesPage.ts Uses named timeouts; adds conditional storage-namespace handling.
webui/test/e2e/poms/pullsPage.ts Updates pull-list selectors and tab navigation helper.
webui/test/e2e/poms/objectViewerPage.ts Simplifies selectors and adds “wait for execute” logic.
webui/test/e2e/poms/objectOperations.ts New sub-POM for uploads/deletes in object views.
webui/test/e2e/poms/loginPage.ts Minor POM cleanup via constructor parameter property.
webui/test/e2e/poms/commitsOperations.ts New sub-POM for commit-list queries.
webui/test/e2e/poms/changesOperations.ts New sub-POM for uncommitted changes, commits, merges.
webui/test/e2e/poms/branchOperations.ts New sub-POM for branch creation/switching/compare controls.
webui/test/e2e/lakeFSApi.ts New API wrapper for setup actions using Basic auth.
webui/test/e2e/fixtures.ts Adds Playwright fixtures for POMs + worker-scoped setup/api helpers.
webui/test/e2e/credentialsFile.ts Consolidates credential/storage-state paths and read/write helpers.
webui/test/e2e/consts.ts Removes now-redundant constants file.
webui/test/e2e/common/viewParquetObject.spec.ts Migrates spec to fixtures + new POM structure.
webui/test/e2e/common/uploadFile.spec.ts Migrates spec to fixtures; uses in-memory upload payloads.
webui/test/e2e/common/test-upload.txt Removes checked-in upload artifact.
webui/test/e2e/common/syncCommitMerge.spec.ts Migrates spec to fixtures, steps, named timeouts, and sub-POM ops.
webui/test/e2e/common/setupInfra.spec.ts New setup project to save auth state + credentials.
webui/test/e2e/common/setup.spec.ts Narrows to setup validation tests (infra moved elsewhere).
webui/test/e2e/common/revertCommit.spec.ts Migrates spec to fixtures + new revert/commit ops.
webui/test/e2e/common/repositoriesPage.spec.ts Migrates spec to fixtures.
webui/test/e2e/common/readOnlyRepository.spec.ts Uses lakeFSApi for setup and fixtures for POM access.
webui/test/e2e/common/quickstart.spec.ts Migrates spec to fixtures, steps, and sub-POM operations.
webui/test/README.md Adds documentation for running/debugging/extending E2E tests and conventions.
webui/playwright.config.ts Updates project graph for setup vs SKIP_SETUP runs; switches to new storage-state path.
webui/.gitignore Ignores generated Playwright credential/state JSON files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fix resource leak, wrong POM references, missing directory creation,
magic timeouts, and flaky visibility checks identified in code review.
@nopcoder
Copy link
Contributor Author

Addressed all 6 review comments in 2380499:

  1. fixtures.ts — Wrapped request usage in try/finally; added resp.ok() check before .json()
  2. readOnlyRepository.spec.ts — Moved uploadButtonLocator to ObjectOperations POM; updated assertion to repositoryPage.objects.uploadButtonLocator
  3. credentialsFile.ts — Added mkdir with { recursive: true } before writing credentials; exported ensureStorageDir() helper
  4. setupInfra.spec.ts — Calls ensureStorageDir() before storageState({ path })
  5. objectViewerPage.ts — Replaced magic timeouts with TIMEOUT_NAVIGATION / TIMEOUT_LONG_OPERATION
  6. pullsPage.ts — Replaced instant isVisible() with waitFor + try/catch fallback

@nopcoder nopcoder changed the title webui: rewrite and simplify E2E Playwright tests WebUI: rewrite and simplify E2E Playwright tests Feb 10, 2026
@nopcoder nopcoder requested a review from Copilot February 10, 2026 16:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 29 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nopcoder nopcoder added minor-change Used for PRs that don't require issue attached e2e-tests labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Improvements or additions to tests area/UI Improvements or additions to UI e2e-tests exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant