Skip to content

Suggestion: Make amOnPage() wait for JavaScript to finish by default #151

Description

@ThomasLandauer

Starting point: Everybody always wants JavaScript to finish, before performing any action/assertion on the page, right?
At least my usual pattern is:

$I->amOnPage('/');
$I->waitForJS('return document.readyState === "complete";', 5); // https://gist.github.com/pastuhov/43674b195dc293ffd847

So I thought about ways to simplify this. My first idea was to introduce a new method, something like waitForJSToComplete().

But now, I think it's even better to include this in amOnPage(), by introducing a second parameter:

public function amOnPage($page, bool $waitTillJSIsComplete = true): void

This would be a BC break.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions