I'd like to start Selenium as a Grunt task, run Cucumber, then stop Selenium after Cucumber exits.
I tried using grunt-shell to start Selenium. While this works, Selenium continues to run (as expected) and so Grunt hangs waiting for it to exit.
I also tried grunt-bgshell. This starts Selenium, but Grunt immediately starts Cucumber before Selenium is ready, and then Selenium continues to run after Grunt exits.
As a workaround for stopping Selenium I could probably use shell and curl to send the shutdown request to Selenium. But if there's a way to accomplish this without a workaround that would be even better.
Update
See my answer below:
David Souther has written the grunt-selenium-launcher plugin which does exactly what I needed.
However, even after using the grunt-selenium-launcher plugin, Julien Biezeman helped me discover the best way to solve my problem was to launch selenium directly from my end to end tests in Cucumber using selenium-launcher.
I hope this helps someone!
Related
I have observed that whenever I run my automated script along with reporter, the test runs through successfully but the testcafe process does not end. After closing the application browser the testcafe run window never closes. This happens only when run command includes reporter details like
'testcafe chrome RegressionTestHappyFlows/calculatePremium_ShortTermTravelInsurance.ts --env=Test_English_ET --reporter html:TestRun.html'.
If I remove the reporter details from the command then the testcafe process ends properly as expected. I have tried with testcafe-reporter-html(version : 1.4.6) and also with multiple-cucumber-html-reporter(version : 1.18.0). In both cases I face the same issue. Testcafe version that I am using is 1.9.1
Could some one please help and suggest me a solution.
Thanks
I am using Hound (https://github.com/HashNuke/hound) for integration testing a Phoenix application. I have chrome and chrome headless working. To get it working I have another terminal window running chromedriver (installed via brew). This feels odd to me. Is there a library or test setup that would feel more "integrated" into the application? What's the Elixir way of doing this?
In the Ruby world there's the webdrivers gem (https://github.com/titusfortner/webdrivers). As far as I know it downloads a specified driver (lets say chromedriver) to $HOME. Then with every test run, the test uses the driver downloaded to that destination to execute the tests.
Before the webdrivers gem there was chromedriver-helper gem. Before that it was phantomjs. These implementations made it so running integration tests required 1: downloading the driver 2: running the test
In Elixir (with Hound) I have my tests working by first running chromedriver --verbose in a terminal split, and in the other screen I run mix test. This works fine but feels disjointed. This adds extra steps, 1: download the driver 2: start the driver 3: run the test 4: stop driver
I could write a script manually to run chromedriver in the background, and stop it after the tests are run.
I am new to the Elixir community and so I've researched a lot. It's still not clear to me if there is a "traveled path" I should go down vs just hooking everything up manually.
Have I missed a recommended abstraction? Is this intentional? Is this "just not created, yet"?
Thank you
Have you checked out wallaby? See https://github.com/keathley/wallaby
I have a series of automated tests that use selenium, specifically Geb with Spock. When I run all my tests cases one after another using a chromedriver, my tests run fine. Each test method gets a new session and therefore start with a fresh browser each time. This is not the case when using phantomJS. If a test method happens to fail when using phantomJS, all following test cases will fail because the session was not reset. I can see this happening because the screenshots taken at the end of each test method.
I have tried researching this issue and have discovered it has been a known issue for a couple of years now. Some say it was fixed in phantomjs 2.1 but I'm currently using version 2.1.1, which is the most recent version.
I have also tried using driver.manage().deleteAllCookies(); with no luck, as other threads have mentioned.
Is there a workaround anyone is aware of?
have you tried webdriver's quit method?
Is it possible when running an entire test suite to make it stop on an assert failure?
It currently stops running that failed test then continues to run the next test.
I want it just to stop and fail on the first failure.
Thanks
I found https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/ which is a Selenium IDE plugin which adds a Pause on fail button to Selenium IDE.
In selenium ide we can add Pause on fail button by simple install one plugin in the selenium IDE. When pause on fail is turned on, Selenium IDE would pause the execution of the test case when there is an error is produced or a command failure
Install plugin from https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/
don't know if you ever got this issue resolved but I use a plugin to cater for this issue.
The plugin is 'Selenium debugger' and I was able to download it from
https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/
install using firefox. Then, once firefox has restarted, an additional icon will appear on the Selenium toolbar (pause on fail). Works a treat for me!
The only thing of note is that if the script fails on the last line of a test CASE it may still continue to the next test case in the suite. The way round this that I use is to add a 'pause 100' entry to the last line of each test case so that the plugin can 'hook' onto it.
I hope his helps
You could write the assert into if and on false stop the run.
I have a problem with Selenium under Jenkins 1.446 together with Xvfb: It looks like firefox is started correctly because I let my failing tests record screenshots. These screenshots all show the same failing page, which in my case is the starting page where the tests should begin. So I gues the selenium WebDriver commands do not arrive. What could be the reason? By the way, the tests are running perfectly on my local machine.
I'm using Firefox 9.0.1 with no specific test profile and no AddOns, Ubuntu 10.04, Senlenium 2.16.1
Log entry: com.thoughtworks.selenium.SeleniumException: Timed out waiting for action to finish
Thanks!
EDIT: Issue seems to be fixed by a system reboot ...
I experienced a very similar issue with FF9.0.1 and Selenium 2.16.1 running through JUnit launched by Maven SureFire plugin run by Jenkins on a WinXP node.
2.17.0 fixed the issue for me. Try updating to the latest Selenium.
Through RDP, I was able to watch the tests running. The tests appeared to be partially blocked by a prompt from Firefox asking about collecting anonymous usage statistics. Manually answering the prompt would allow the test to continue but because Selenium creates a new profile each time by default, the prompt would return on the next browser launch. Running the tests locally with a pre-configured FF profile allowed me to persist that the prompt had been answered. This isn't possible on my XP node because the tests are running as 'System'.
Selenium/WebDriver would normally take care of this for you by marking the prompt as already answered in a temporary FF profile configuration but a bug was causing the value to be set to the wrong value. You can inject a profile configuration to the Selenium FirefoxDriver driver to pragmatically configure stuff like this prompt but the bug appeared to prevent this as well. This has been resolved in Selenium 2.17.0 (http://selenium.googlecode.com/svn/trunk/java/CHANGELOG see 2.17.0 WebDriver bug fixes).