Skip to content

tests: Migrate to @playwright/test and add core behavior coverage#1498

Open
DSingh0304 wants to merge 10 commits intozulip:mainfrom
DSingh0304:playwright-migration-prototype
Open

tests: Migrate to @playwright/test and add core behavior coverage#1498
DSingh0304 wants to merge 10 commits intozulip:mainfrom
DSingh0304:playwright-migration-prototype

Conversation

@DSingh0304
Copy link
Collaborator

@DSingh0304 DSingh0304 commented Mar 10, 2026

This PR serves as a demonstration of a modernized, non-flaky testing infrastructure for the desktop client.

Why this is needed: The current testing setup relies on tape and playwright core, requiring manual window/page queue management which is inefficient and prone to flakiness. Transitioning to @playwright/test provides:

  • Native Electron Fixtures: Eliminates the need for manual window handling/FIFO queues.
  • Stability: Better handling of async interactions and built in "auto-waiting" for selectors.
  • Maintainability: Provides a standardized, industry standard foundation that is easier for new contributors to learn.
  • Visibility: Integrated HTML reporters and CI trace viewers for debugging failures.

Changes included:

  • Completely migrated the E2E suite to @playwright/test.
  • Added a centralized playwright.config.ts.
  • Rewrote test-add-organization.ts using modern expect and window-handling patterns.
  • Added a new App Settings test to verify core UI functionality (gear icon interactions).
  • Cleaned up legacy tape boilerplate and manual window logic in setup.ts.

Screenshots and screen captures:
image

Platforms this PR was tested on:

  • Windows
  • macOS
  • Linux (Ubuntu)
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

Deep added 5 commits March 10, 2026 13:20
This migration is the first step in building an efficient testing
process for the app, as discussed in issue #D82.

The legacy testing setup relied on 'tape' and 'playwright-core' with
manual window state management. By switching to '@playwright/test',
we gain:
- Native Electron test fixtures and window handling.
- Parallel test execution capabilities.
- Robust built-in reporter and CI trace viewer.

This commit updates the dependencies and the 'test-e2e' script to
use the new runner.
This provides a standardized configuration for the new testing
framework. We set 'workers: 1' to avoid potential conflicts
during Electron application launches in parallel and configure
the HTML reporter for better visibility into CI failures.
Refactor the setup utility to use types and methods from the new
testing framework. This ensures that our test helpers are
correctly typed and provide a stable foundation for launching
and closing the Electron instance during tests.
This commit replaces the primitive manual window queue logic with
Playwright's automated window handling.

We removed 'tests/index.ts' and 'tests/test-new-organization.ts'
which were using the old 'tape' runner and replaced the core
organization management test with a non-flaky version that
reliably handles organization connection flows.
This adds a second 'core behavior' test to demonstrate the stability
of the new Playwright framework. It verifies that:
1. The settings button is interactable.
2. The modal successfully transitions the UI to the active state.
3. The functional settings view is rendered correctly.

This serves as a template for building further UI coverage for the
rest of the desktop client.
Deep added 5 commits March 10, 2026 13:43
This configuration file sets up the modern testing runner for the
project. It defines the test directory, matches test files by
pattern, and configures the HTML reporter.

Specifically, we set 'workers: 1' to prevent multiple Electron
instances from conflicting with each other during parallel
testing, which ensures a non-flaky execution environment as
requested by the maintainers.
This update adjusts the 'createApp' and 'endTest' helpers to use
types from '@playwright/test'.

By unifying the framework across the setup and the tests, we
ensure better type safety and compatibility with the new runner's
fixtures. This provides a clean foundation for launching and
cleaning up the Electron instance for every test.
This change removes the old tests that relied on 'tape' and manual
window queue management, and replaces them with a modern
fixture-based approach in 'test-add-organization.ts'.

By using the native Electron window handling from @playwright/test,
we can reliably verify the initial screen title and organization
connection flow (including 'chat.zulip.org') in a non-flaky
manner. This provides the stable, well-written demonstration
requested by the maintainers.
This adds a second 'core behavior' test to demonstrate the
reliability and extensibility of the new Playwright framework.

It verifies that clicking the gear icon correctly opens the
settings modal by checking for the active UI class and the
presence of the functional settings view. This provides a
concrete baseline for expanding UI coverage across the rest of
the application.
This change applies Prettier formatting to the 'package.json' file,
resolving a lint warning that was causing the PR checks to fail.

The file now correctly matches the project's code style standards
as verified by the 'node --run test' command.
@DSingh0304
Copy link
Collaborator Author

Ready for review!

@timabbott
Copy link
Member

This PR needs to be cleaned up for review-ability. Check out our GitHub guide and commit guidelines for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants