Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drive Browser tests with playwright #609

Merged
merged 1 commit into from
Jul 15, 2022
Merged

Conversation

seanpdoyle
Copy link
Contributor

Replaces the intern-powered functional test suite with one powered
by playwright.

The majority of the changes made aim to preserve the structure and
method names of the original intern suite. There are some
out-of-the-box Playwright features that could replace many of our
bespoke helpers, but that work should be done after the migration.

As a result, the majority of the changes involve a combination of:

  • replacing async "test ..."() { ... } with test("test ...", async ({ page }) => { ... }
  • replacing calls in the style of this.methodName with calls in the
    style of methodName(page)

In some cases, exceptions were made. For example, most calls to
this.clickSelector were replaced with calls to page.click.

The unit test suite

Playwright's focus on a browser-powered test harness make it an odd fit
for our small suite of "unit" tests. Unlike their browser-test
counterparts, the unit tests do not have a history of flakiness.

This changeset defers migrating those tests off of intern for a later
batch of work.

@seanpdoyle seanpdoyle force-pushed the playwright branch 2 times, most recently from a12197b to 92e685b Compare June 23, 2022 17:58
@seanpdoyle seanpdoyle marked this pull request as ready for review June 23, 2022 18:05
@seanpdoyle
Copy link
Contributor Author

cc: @keithamus

}

export function nextBody(_page: Page, timeout = 500) {
return sleep(timeout)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keithamus this is one of the bigger hurdles for the migration. The old version tracked the <body> element with instance state. Since playwright test blocks have no context, I'm not sure of the best way to synchronize on a change.

@seanpdoyle seanpdoyle force-pushed the playwright branch 11 times, most recently from b92703b to 83a280e Compare July 15, 2022 21:22
Replaces the [intern][]-powered functional test suite with one powered
by [playwright][].

The majority of the changes made aim to preserve the structure and
method names of the original `intern` suite. There are some
out-of-the-box Playwright features that could replace many of our
bespoke helpers, but that work should be done after the migration.

As a result, the majority of the changes involve a combination of:

* replacing `async "test ..."() { ... }` with `test("test ...", async
  ({ page }) => { ... }`
* replacing calls in the style of `this.methodName` with calls in the
  style of `methodName(page)`

In some cases, exceptions were made. For example, most calls to
`this.clickSelector` were replaced with calls to [page.click][].

The unit test suite
---

Playwright's focus on a browser-powered test harness make it an odd fit
for our small suite of "unit" tests. Unlike their browser-test
counterparts, the unit tests do not have a history of flakiness.

This changeset defers migrating those tests off of `intern` for a later
batch of work.

[intern]: https://theintern.io
[playwright]: https://playwright.dev
[page.click]: https://playwright.dev/docs/api/class-page#page-click
@dhh dhh merged commit 15e45da into hotwired:main Jul 15, 2022
@seanpdoyle seanpdoyle deleted the playwright branch July 15, 2022 22:31
dhh added a commit to seanpdoyle/turbo that referenced this pull request Jul 15, 2022
* main:
  Drive Browser tests with `playwright` (hotwired#609)
  Allow Turbo Streams w/ GET via `data-turbo-stream` (hotwired#612)
  Only update history when Turbo visit is renderable (hotwired#601)
  Support development ChromeDriver version overrides (hotwired#606)
  Turbo stream source (hotwired#415)
  Expose Frame load state via `[complete]` attribute (hotwired#487)
dhh added a commit to feliperaul/turbo that referenced this pull request Jul 16, 2022
* main:
  Allow frames to scroll smoothly into view (hotwired#607)
  Export Type declarations for `turbo:` events (hotwired#452)
  Add .php as a valid isHTML extension (hotwired#629)
  Add original click event to 'turbo:click' details (hotwired#611)
  Drive Browser tests with `playwright` (hotwired#609)
  Allow Turbo Streams w/ GET via `data-turbo-stream` (hotwired#612)
  Only update history when Turbo visit is renderable (hotwired#601)
  Support development ChromeDriver version overrides (hotwired#606)
  Turbo stream source (hotwired#415)
  Expose Frame load state via `[complete]` attribute (hotwired#487)
  fix(ie/edge): form.method='delete', raises Invalid argument. (hotwired#586)
  Do not declare global types/constants (hotwired#524)
  Defensively create custom turbo elements (hotwired#483)
  Use `replaceChildren` in StreamActions.update (hotwired#534)
cvkef added a commit to cvkef/turbo that referenced this pull request Oct 19, 2022
This commit moves the minimum required `node` version under a
`devEngines` section at the `package.json`.

The introduction of the [playwright][] test suite forced the minimum
required `node` version to v14. As a side effect, using the `engines`
section of the `package.json` to set this dependency, introduces
an unreasonable constraint to use the `turbo` library in other projects.

Considering that `playwright` is a development only dependency, it
seems justified to keep it under a `devEngines` section of the
`package.json`.

[playwright]: hotwired#609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants