Skip to content

feat (Frame): Accept all supported options to goto#49

Merged
ftes merged 1 commit into
ftes:mainfrom
Jump-App:ty/goto-options
May 13, 2026
Merged

feat (Frame): Accept all supported options to goto#49
ftes merged 1 commit into
ftes:mainfrom
Jump-App:ty/goto-options

Conversation

@s3cur3
Copy link
Copy Markdown
Contributor

@s3cur3 s3cur3 commented May 12, 2026

This expands the list of selected options for PlaywrightEx.Frame.goto/2 to match those of the JavaScript API (docs).

I found that in CI, I was often hitting 30 second timeouts waiting for the load event—even though in the trace, I could clearly see the page had (at least conceptually!) loaded. When switching to waitUntil: 'commit' (rather than the default waitUntil: 'load'), not only did the flakiness of that initial page load get fixed, but the tests also got much faster: from an average of >5 seconds per test down to under 1.5 seconds/test.

(The Referer stuff isn't strictly necessary for my own work, but I figured while I was in here, I might as well make goto accept everything the JavaScript version does.)

This expands the list of selected options for `PlaywrightEx.Frame.goto/2` to match those of the JavaScript API ([docs](https://playwright.dev/docs/api/class-page#page-goto)).

I found that in CI, I was often hitting 30 second timeouts waiting for the `load` event—even though in the trace, I could clearly see the page had (at least conceptually!) loaded. When switching to `waitUntil: 'commit'` (rather than the default `waitUntil: 'load'`), not only did the flakiness of that initial page load get fixed, but the tests also got _much_ faster: from an average of >5 seconds per test down to under 1.5 seconds/test.
@ftes
Copy link
Copy Markdown
Owner

ftes commented May 13, 2026

Beautiful, thanks!

the tests also got much faster

Is there any downside to using waitUntil: 'commit'?
Could this be the default (in PhoenixTestPlaywright)?

@ftes ftes enabled auto-merge (squash) May 13, 2026 06:27
@ftes ftes disabled auto-merge May 13, 2026 06:28
@ftes ftes merged commit 8e96071 into ftes:main May 13, 2026
ftes pushed a commit to ftes/phoenix_test_playwright that referenced this pull request May 13, 2026
The corresponding change to be able to use [#49 from
playwright_ex](ftes/playwright_ex#49). The
description from that PR:

> This expands the list of selected options for
`PlaywrightEx.Frame.goto/2` to match those of the JavaScript API
([docs](https://playwright.dev/docs/api/class-page#page-goto)).
>
> I found that in CI, I was often hitting 30 second timeouts waiting for
the `load` event—even though in the trace, I could clearly see the page
had (at least conceptually!) loaded. When switching to `waitUntil:
'commit'` (rather than the default `waitUntil: 'load'`), not only did
the flakiness of that initial page load get fixed, but the tests also
got _much_ faster: from an average of >5 seconds per test down to under
1.5 seconds/test.
>
> (The `Referer` stuff isn't strictly necessary for my own work, but I
figured while I was in here, I might as well make `goto` accept
everything the JavaScript version does.)

It doesn't feel _great_ having the docs copied and pasted between the
two projects, but it seemed cleaner than, say, exposing a function from
PlaywrightEx that would provide the options at compile-time.
@s3cur3
Copy link
Copy Markdown
Contributor Author

s3cur3 commented May 13, 2026

Thank you! ☺️

Re: whether commit is the right default for PhoenixTestPlaywright, I'm not sure. In our test suite we're visiting the home page, but them immediately waiting for [data-phx-main].phx-connected to exist before starting the actual body of each test. I think if we were missing that wait, we might start trying to interact with the page before the WebSocket connection is alive, and therefore our clicks would just be dropped on the floor.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants