-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[🐛 Bug]: Running tests in parallel in docker causing tests to choose the wrong open window #15609
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
Comments
@jonn-set, thank you for creating this issue. We will troubleshoot it as soon as we can. Selenium Triage Team: remember to follow the Triage Guide |
Hi, @jonn-set. Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue. Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough. Reply to this issue when all information is provided. Thank you. |
We would need to see code that can reproduce this along with some logging to even begin to troubleshoot this. |
I will create a project share it here, gimme some time please. |
Sorry, I haven't been able to create a separate project to isolate this issue. But after doing some debugging, I noticed that when starting the container on RHEL 8 agent (which has Podman and not Docker), its unable to create more than one Browser window inside the container. I am passing the below to
Screenshot from logs showing multiple driver instances being created but with the same Window handle: Can someone advise if I need to pass some other parameter to ensure it opens more than 1 browser window? Could it be processor limitation? What is surprising is that with Podman running in WSL on Windows 10 (my local dev machine), it successfully opens 4 browsers windows inside the container and the tests work. The issue is only seen on RHEL 8 agents on CI. |
You are most likely reusing the driver, probably using the |
No I am not, I am using Spring to autowire driver instance, my driver instances are not static, more over it works locally on Windows, but does not on a RHEL 8 agent running on TeamCity in a container:
This bean is thread scoped, my Thread Scope config:
All my test classes have this: |
Few things TestNG is notoriously difficult to run in parallel. Your scope looks ok, unless you need to add a proxyMode because you are injecting the driver into multiple classes. Regardless, double check if it is running multiple with something like this in the
|
@titusfortner thanks for your reply. I am running around 90 tests with 4 threads in parallel. I had to use the I was explicitly setting After removing this my tests are working fine, thanks for your help, really appreciate it. Logs showing different handles now: I will run the suite a few times, if everything's fine, will close this then. |
It works now, closing the issue. |
Description
I am running Selenium tests in parallel inside a Docker container (standalone-chrome) using the Surefire plugin. 80-90% of my tests fail and the screenshots captured in the After hook seem to indicate that a different test was running, like its querying a customer that is not part of thread the test is running in, etc., extremely difficult to put a finger on it and say what's wrong. I also see a lot of
org.openqa.selenium.StaleElementReferenceException: stale element reference: stale element not found in the current frame
. Which seems to indicate the test is trying to access the wrong open browser window.I also use Spring and am using
SimpleThreadScope()
to create a 'thread' scope, theWebDriver
&ScenarioContext
are all marked as@Scope(scopeName = "thread")
so I believe the configuration is correct as they all seem to work as expected in Windows on Edge, however when I run this in docker, it does not work.My Project code base is very big and cant be shared on the forum, but I will try to create a separate project and share the link here, in the meantime if anyone notice anything obvious I am doing wrong, can they comment and let me know please.
Reproducible Code
The text was updated successfully, but these errors were encountered: