Codeception / Codeception/module-webdriver

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

Aperta
#151 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
39
Fork
25
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Starting point: Everybody always wants JavaScript to finish, before performing any action/assertion on the page, right?
At least my usual pattern is:
```php
$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:
```php
public function amOnPage($page, bool $waitTillJSIsComplete = true): void
```
This would be a BC break.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.