Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to abort the request? #455

Open
amirhoseinsalimi opened this issue Dec 9, 2022 · 4 comments
Open

Is there a way to abort the request? #455

amirhoseinsalimi opened this issue Dec 9, 2022 · 4 comments
Labels

Comments

@amirhoseinsalimi
Copy link

Hi,
I want to have the ability to abort the requests while testing so they don't get to the API server. Is there a way to do so?

Currenlty what I see is that requets are made to the server and 200 returns. I don't want to bother myself to check if the API server responds or not, I just want to make sure that the requets is being made.

Is there an API for this?

@erwinheitzman
Copy link

Not that I know of

@christian-bromann
Copy link
Contributor

Afaik there is, just not using this service. WebdriverIO has some native capabilities like the abort command that would allow this but these can only be run through the Devtools protocol which has its limitations.

@tehhowch
Copy link
Contributor

The approach taken by my coworkers has been to do something similar to what this service does: wrap the fetch / XMLHttpRequest object, filter the incoming URLs, and redirect / cancel them / etc as desired. That obviously only works when you get a chance to invoke your filter before the requests you'd like to block are made.

However, if you don't need to block the requests, just check they were made, then you can use getRequests and perform your own matching on the returned objects. Right now the service requires you to specify the status code in order to use its assert functionality.

A PR extending the capability to match just the method & url is welcomed!

@SubhenduShekhar
Copy link

You can write a custom command. Grab the sessionId using browser.sessionId and implement your actions using the jsonwire protocol.
I have done it in multiple scenarios and it has worked flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants