feat: Enable Cooperative Intercept Mode for puppeteer E2E testing
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- testing
Direzione di ricerca
Inizia in src/testing/puppeteer/puppeteer-page.ts, intorno al codice di intercettazione delle richieste indicato, e consulta la documentazione di Cooperative Intercept Mode di Puppeteer. Determina in che modo gli argomenti di priorità e la retrocompatibilità influiscono sull’API E2EPage esistente. Il lavoro è completato quando più gestori delle richieste possono coesistere senza interrompere il comportamento attuale dell’intercettazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 13.2k
- Fork
- 865
- Merge medio
- 2g 16h
- PR unite (30g)
- 29
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stenciljs/core
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug(mock-doc): `Element.toggleAttribute()` is missing, so components that use it fail during SSRApertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19Forse già presa @johnjenkins l’ha presa 230 giorni fa. ApertaStencil v5
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
stenciljs/core#7016 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stenciljs/core
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtagForse già presa @bardrop l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
nbd-wtf/nostr-tools#578 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
backnotprop/plannotator#3427 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AOSSIE-Org/DebateAI#801 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno