Selenium WebDriverJS Using in Browser - selenium

http://code.google.com/p/selenium/wiki/WebDriverJs#In_the_Browser
Where I can get javascript file "webdriver.js" from
So I can test and use it. Has anyone have done it..

webdriver.js can be built from the selenium sources. You need java and svn to take the following steps:
Get the selenium sources:
svn checkout http://selenium.googlecode.com/svn/trunk/ selenium-read-only
Change to trunk:
cd selenium-read-only/trunk
Build webdriver.js:
./go webdriverjs
This step generates a single javascript file in build/javascript/webdriver/webdriver.js. You can then go ahead and use this file as described in selenium's wiki.

Related

“ERROR Unable to find the browser. “saucelabs:Chrome#83.0:Windows10” is not a browser alias or path to an executable file

I am trying to run my UI test using testcafe and saucelabs. I am facing this above error. Currently I am using testcafe v1.8.3 and testcafe-browser-provider-saucelabs v1.7.0
I have tried changing versions of browser provider also but still facing the above error. Pls help out with a solution for this as i am stuck with it for more than a week
So, it looks like the runner you are using (testcafe-browser-provider) is a very old one, there is a new runner you can use for testcafe tests called saucectl.
TLDR:
Install saucectl globally npm install -g saucectl
Set up saucectl within your project folder with saucectl init This will create a .sauce/config.yml file
Tweak the settings to run the spec files and OS/ browser of your choice
Use saucectl run
You can see an example proj here: https://github.com/saucelabs/saucectl-testcafe-example
It looks like your provider is installed locally, while you are using the global TestCafe installation. You also need to install TestCafe locally or both packages globally. After this, check your browser provider: testcafe -b saucelabs.
I am using testcafe v1.8.3 and testcafe-browser-provider-saucelabs v1.7.0
Please update your testcafe and testcafe-browser-provider-saucelabs versions to the latest ones.

Can TestCafe be configured with single file reporter

I have been working in TestCafe recently and I need a custom reporter. I was looking for something like mocha reporter. But all I could find is generating a plugin and publish it to npm. Is there a way to have a single file reporter?
Is there a way to have a single file reporter?
You can redirect the reporter's output to the file.
testcafe chrome test.js -r spec:result.txt
I was looking for something like mocha reporter.
TestCafe ships with 5 reporters: spec, list, minimal, xUnit, JSON. Also, many custom reporters can be find in npm: https://www.npmjs.com/search?q=testcafe-reporter.

How to run CI selenium side runner tests on Jenkins

I have a .side file generated by the Selenium IDE, which I need to run on CI using Jenkins.
I am running it as a build step with the following shell command:
selenium-side-runner /path/to/file.ide
The problem arises due to the fact that no matter if the selenium test fails, Jenkins always shows is as success.
In this thread it's suggested to upload the file as generic, but still, the commands to execute it are missing
How to upload a generic file into a Jenkins job?
I've found a possible solution to it on this posts, but I would appreciate having a cleaner way to solve this instead of parsing the results checking for errors.
How to mark a build unstable in Jenkins when running shell scripts
Is there a plugin able to run selenium .side files on Jenkins and this one showing the success/failures of the test?
You can generate a Junit test report file and then use the Jenkins Junit plugin after your tests execution.
selenium-side-runner --output-directory=results --output-format=junit
# Outputs results in `junit` frormat in `./results/projectName.xml'
Check the official documentation for more details.

Send build status from Travis to Sauce Labs

I have my testing up and running with Travis/SauceLabs. Now I would like to add a SauceLabs test badge to my repo.
I added the badge markdown to my Readme file but how can I send the build pass/fail to SauceLabs? I found this instructions for Selenium,
Key: passed
Value type: bool
Example: "passed": true
but how/where do I add info in my files for my Grunt-Karma/Travis/SauceLabs testing?
The Karma-Sauce-Launcher was using the wrong id, and this was fixed on Github by this PR and released in NPM as version 0.2.5
Aditionally the saucelabs reporter has to be added to the gruntfile options, besides the existing ones or the default progress.
So the bugfix I added to my package.json:
"karma-sauce-launcher": "~0.2.5"
and added this:
reporters: ['progress', 'saucelabs'],
in the Karma options.
You have to use the REST API. What you would do is add code in a function that is executed at the very end of your test suite and knows the result of your test run. This code would have to perform a query equivalent to this curl command:
$ curl -H "Content-Type:text/json" -s -X PUT -d '{"passed": <status>}' http://<username>:<key>#saucelabs.com/rest/v1/<username>/jobs/<job-id>
(The identifiers in angular brackets have to be replaced with appropriate values.)
I've done it with Python but I don't have JavaScript code to share. And by the way, you have to do this for Selenium too because as the documentation states, when Selenium sends the job data to Sauce Labs, it cannot know yet what the test result is going to be.
If you're using Grunt already, you should use https://github.com/axemclion/grunt-saucelabs as it is the official plug-in that is worked on by devs from SauceLabs.

play auto-test selenium test failed, no test-result TEST-{testname}.xml file generated

We have a Play (1.2.4) application which is auto-tested via our Teamcity server. The regular (JUnit) tests return a Test-{classname}.xml datafile in the /test-result/ directory when using
play.bat auto-test
but the selenium tests do not. They only generate a /test-result/{testname}.test.html.failed.html or ...succes.html
This is annoying because i can not easily show which selenium test has failed from within Teamcity. I have to look at the logfiles/artifacts and see which failed.html file is present, open it and look at it which testcase has failed. Annoying!
How can i have play 1.2.4 generate a datafile/xml something which i can parse to see which selenium test has failed?
Since i could find no information what so ever and no clue's how to get it done i wrote my own parsers of the Selenium HTML testresult files. I have released it on github with sourcecode under GPL: https://github.com/crunchie84/play-seleniumresults-parser