feat: Enable Cooperative Intercept Mode for puppeteer E2E testing
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- testing
調査の方向性
src/testing/puppeteer/puppeteer-page.ts の、参照されているリクエストインターセプトのコード周辺から始め、Puppeteer の Cooperative Intercept Mode のドキュメントを確認してください。優先度引数と後方互換性が既存の E2EPage API にどのような影響を与えるかを判断してください。複数のリクエストハンドラーが、現在のインターセプト動作を壊すことなく共存できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Puppeteer provides what's called Cooperative Intercept Mode which would allow for multiple request handlers to be registered. I'm asking for the following code to be modified to take advantage of this feature:
I think that passing a second argument to the .respond() and .continue() methods of 0 would allow multiple request interceptors to be added.
Describe the Use Case
I have a component that dynamically builds an href, and when the markup gets rendered a request is made to the URL. The file doesn't really exist since I'm passing in dummy values for the test, so I get console.error logs in the test output for the 404 even though my tests pass. I would like to intercept the request and respond with a mock so that I don't get the noisy messages that don't represent real-world use.
Describe Preferred Solution
I think this would be a starting point:
const interceptedReqCallback = (interceptedRequest: any) => {
if (pageUrl === interceptedRequest.url()) {
interceptedRequest.respond({
status: 200,
contentType: 'text/html',
body: output.join('\n'),
}, 0);
} else {
interceptedRequest.continue({}, 0);
}
};
This is based on a few things from the documentation:
All resolutions must supply a numeric
priorityargument toabort/continue/respond.
There are more details on how to maintain backwards compatibility, so a full solution may involve another export on the E2EPage.
Describe Alternatives
This is a known issue and there is a workaround in https://github.com/ionic-team/stencil/issues/2434#issuecomment-714776773. However, it is admittedly hacky, especially since puppeteer provides a built-in way of handling this exact situation.
Related Code
No response
Additional Information
No response
- 主要言語
- TypeScript
- スター
- 13.2k
- フォーク
- 865
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 29
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stenciljs/core のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug(mock-doc): `Element.toggleAttribute()` is missing, so components that use it fail during SSRオープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19対応中かも @johnjenkins が 230 日前に担当しました。 オープンStencil v5
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
stenciljs/core#7016 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtag対応中かも @bardrop が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nbd-wtf/nostr-tools#578 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
backnotprop/plannotator#3427 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/DebateAI#801 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信