Repository navigation
fix: reuse a single PendingAwaitablePage in On::__call() - #274
Open
DaniilSkLi wants to merge 1 commit into
Open
DaniilSkLi wants to merge 1 commit into
DaniilSkLi wants to merge 1 commit into
Conversation
Every magic method call on On created a fresh PendingAwaitablePage and
a new browser context, so separate (non-chained) calls lost state:
$page = visit('/')->on()->mobile();
$page->click('@search-button'); // page pestphp#1
$page->assertVisible('@search-modal'); // page pestphp#2 — state lost
Cache the instance like PendingAwaitablePage already does, and add
Webpage/AwaitableWebpage mixins to On so IDEs resolve methods without
relying on recursive @mixin resolution.
Fixes pestphp/pest#1931
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every magic method call on
Oncreated a freshPendingAwaitablePageand anew browser context, so separate (non-chained) calls lost state:
This PR:
pattern PendingAwaitablePage already uses for AwaitableWebpage), keeping
the class readonly
forwarded methods without relying on recursive @mixin resolution
iPhone14Pro) and without choosing a device
Fixes pestphp/pest#1931