[pest-plugin-browser] Give page navigation its own timeout, separate from the assertion timeout
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 57/100
調査の方向性
The issue names PendingAwaitablePage::buildAwaitablePage() and InteractsWithToolbar as the navigation entry points. Read how timeout() is applied to goto and the toolbar navigation methods, then check the related tests for navigation timeouts. Done means a separate navigation timeout applies to all listed navigation methods, defaults to the existing timeout, and the failure message identifies a timed out navigation.
索引モデルが issue の本文から書いたものです。
説明
Filing here because pestphp/pest-plugin-browser has issues disabled.
Problem
pest()->browser()->timeout() sets one timeout for both assertions and page navigation. visit() is lazy: the first call chained on it opens a new context and page and calls goto with waitUntil: 'load', all within that timeout (PendingAwaitablePage::buildAwaitablePage()). navigate(), refresh(), back() and forward() use it as well.
So when a page's load event is slow, its first assertion fails with a bare timeout, even though the assertion never ran and the text it looks for was in the HTML at once:
use Illuminate\Support\Facades\Route;
it('sees the text', function (): void {
Route::get('/repro/slow.js', function () {
usleep(6_000_000);
return response('', 200, ['Content-Type' => 'text/javascript']);
});
Route::get('/repro/page', fn () => '<html><body><p>Hello</p><script src="/repro/slow.js"></script></body></html>');
visit('/repro/page')->assertSee('Hello');
});
With the default timeout of 5000 ms, this fails on the ->assertSee('Hello') line with nothing but:
Timeout 5000ms exceeded.
There is no screenshot either, because the timeout is hit before the page is handed to the test.
In a real app the load event is slow more often than you would expect. It waits for every script, stylesheet, font and image, and each test starts with an empty browser cache, while every parallel worker loads its first page at the same moment. Our app loads about 60 files from public CDNs. With 16 parallel workers, the first call after visit() regularly took more than 5 seconds, and one run failed 11 of 69 tests with Timeout 5000ms exceeded. on that call.
Raising timeout() avoids that, but makes every genuinely failing assertion take that much longer to report.
Workaround
visit() and navigate() pass their options on to goto, so this works:
visit('/repro/page', ['timeout' => 30_000])->assertSee('Hello');
But it has to be repeated in every call, and refresh(), back() and forward() take no options.
Proposal
A separate navigation timeout, like Playwright's setDefaultNavigationTimeout() next to setDefaultTimeout():
pest()->browser()
->timeout(5_000) // assertions and other actions
->navigationTimeout(30_000); // visit(), navigate(), refresh(), back(), forward()
It would apply to goto in PendingAwaitablePage::buildAwaitablePage() and to the navigation methods in InteractsWithToolbar. Defaulting it to timeout() keeps the current behaviour for everyone who does not set it.
Related, and smaller: name the step that timed out, e.g. Timeout 5000ms exceeded while loading [http://127.0.0.1:61284/repro/page]., so the failure does not read as a failed assertion.
The browser launch already has its own timeout: it happens during initialize, which uses LAUNCH_TIMEOUT since pestphp/pest-plugin-browser#275.
Happy to open a PR if this direction works for you.
Versions: pest-plugin-browser 5.2.0 (the code is the same on 5.x today), Playwright 1.64.1, PHP 8.5, macOS and Ubuntu (GitHub Actions).
- 主要言語
- PHP
- スター
- 11.8k
- フォーク
- 559
- 平均マージ
- 5日 23時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pestphp/pest のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 5 日以内に返信
-
[Bug]: --mutate hides unreadable files, so mutants behind a failed read can never be killed再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 5 日以内に返信
-
[Bug]: [mutate] Windows: @pest-mutate-ignore comments land on line 1 in files with LF line endings対応中かも @webdevsamran が 57 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 5 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 5 日以内に返信
-
[pest-plugin-browser] Page::waitForLoadState() never sends its message — waitForEvent() is a silent no-op対応中かも @asllanmaciel が 70 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
pestphp/pest#1892 · コメント 2 件 ·
メンテナーはふだん 5 日以内に返信
似ている issue
-
Group 2 - Data Storage | Tripal DBX | Chado Group 5 - Search | ElasticSearch | Views Priority - Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
nginx update required due to NGINX2Root対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
mailcow/mailcow-dockerized#7668 · コメント 5 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
lara-zeus/spatie-translatable#80 ·
メンテナーはふだん 1 日以内に返信
-
small
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
uiowa/uiowa#10296 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
asyncapi/modelina#2709 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信