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

Feature request: Restrict WaitFor.AjaxCallsToComplete to a list of specific domains or URLs #209

Open
isaldarriaga opened this issue Jul 15, 2015 · 1 comment

Comments

@isaldarriaga
Copy link

In a website is very common to have asynchronous requests to external domains which are not critical to the website execution.

Live chat services, analytics, tracing repos, static content, etc. are commonly placed in external domains.

Sometimes those async request are fired periodically from the local domain for ping purposes, and they can affect tests if they are just waiting for all ajax requests to complete.

Imagine this scenario:
Selenium instruct the browser to perform an action which is resolved via an ajax request.
The test runner enters in a waiting cycle for all ajax to complete after that.
A live chat window ping an external domain, so we have 2 requests scheduled for execution in the browser.
The browser execute the ping request but defer the one we want.
The first byte is received, the ping completed, so basically all running ajax completed.
It's time for the test runner to evaluate all ajax completion, succeeds, exits, and the next sentence in the test is performed.
The test fails.

Since the test runner, the driver and the browser run in isolated processes, other race conditions can occur in similar scenarios.

When waiting for ajax to complete I'm more interested on waiting for specific requests to the local domain, or external API domains, rather than just all requests. So it would be very useful either to restrict the WaitFor.AjaxCallsToComplete to the concrete list of domains hosting the services, or to the specific URL endpoints that I'm interested for the test.

Please vote.

@robdmoore
Copy link
Member

Assuming that you aren't constantly firing ajax requests in parallel there should be a gap where no ajax is currently in flight and so the existing method will still work.

It's a fair point though.

Off the top of my head I don't know of the best way to implement it. The current check is very basic and I'm not sure of the best way to check based on domain: https://github.com/TestStack/TestStack.Seleno/blob/master/src/TestStack.Seleno/PageObjects/Actions/Wait.cs#L21

If you (or something else) can come up with a way to do it feel free to submit a PR.

Thanks

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

No branches or pull requests

2 participants