[Question] How to wait for several responses that differs only with body?
See original GitHub issueAfter clicking button multiple requests to GraphQL are made. URL is the same, only body is different. I tried the following:
async uploadFile() {
const [fileChooser] = await Promise.all([
this.page.waitForEvent('filechooser'),
this.page.click(this.elements.csvInput)
]);
await fileChooser.setFiles('./resources/upload_findings.csv');
await this.page.click(this.elements.uploadButton);
}
async function waitForFindingUpload(page, findingName) {
return await page.waitForResponse(async (response) => {
let body = await response.text();
return body.includes(findingName)
}, {
timeout: 10000
});
}
const [response1, response2] = await Promise.all([
waitForFindingUpload(page, "Name of Finding 1"),
waitForFindingUpload(page, "Name of Finding 2"),
uploadFindingsPage.uploadFile()
])
These response1, response2 are both either “Name of Finding 1” or “Name of Finding 2”. I can not get both responses. How can I do this ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cypress: Stub response for same route with three different ...
When the dashboard page is loaded, we trigger 3 concurrent AJAX POST requests with different actions. Even if we write response as a...
Read more >Create approval flows with custom responses - Power Automate
Select Custom Responses - Wait for one response. Approval type. Next, you will create the custom responses that your approvers will use when ......
Read more >What Are Frontotemporal Disorders? Causes, Symptoms, and ...
Speak slowly and clearly, use simple sentences, wait for responses, and ask for clarification if needed. Work with a speech-language pathologist ...
Read more >Federal Employees' Compensation Act — Frequently Asked ...
The following "Frequently Asked Questions" (FAQs) are a supplement to ... There are several of these detailing the different sorts of documentation to...
Read more >Ask the Experts: Administering Vaccines
If I need to give more than 1 injection in a muscle, are certain vaccines best given at different anatomic sites? Since DTaP...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Would rather use async/await but this seems to work on a graphql query for the time being:
I think the issue here is that
waitForResponse
does not support an async predicate. So it treats the returned promise as truthy, and always returns the response that comes first, for bothwaitForResponse
calls. We should fix that.