-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
api: remove waitForLoadState() in favor of PageEvent.page(options) #1323
Conversation
This is a useful helper for third party libraries, for example we use it in waitForPage. The purpose of waitForPage is to have a standard way of looking up pages based on their creation order. We use it to make creating tests with multiple pages cleaner.
|
@jperl IIUC you should still be able to set const creationIndex = ++lastPageCreationIndex;
event.page().then(p => p.creationIndex = creationIndex); . context.pages() |
Yes if context.pages allowed passing a LifecycleEvent to filter by We want to mark the creationIndex immediately, in case there is a race. And allow users to decide on the waitUntil lifecycle event in I could hack around it by marking a bunch of load states on the page inside the "page" event handler, but that is not so clean. |
Another approach that could work without const indexedPages = new Set;
const lastPageIndex = 0;
context.on('page', event => {
const pageIndex = ++lastPageIndex;
event.page().then(page => {
page.creationIndex = pageIndex;
indexedPages.add(page);
});
}); Now that we have |
Yes I already do it this way, the issue is allowing waitForPage to specify which lifecycle event to wait for on that page. |
I find api like
I'd suggest to use |
The point of the
Good point, so I would prefer |
No description provided.