Problem How can I ensure correct browser versions at test execution time for selenium to run against?
Given that selenium requires specific browser version and I don't want to manage installing and updating versions on win (lin would be easier via puppet) I need a way to deploy the right browser version during my build.
Is this what other folks are doing?
bundle firefox, chrome browser versions as archive files
deploy these to my maven repository (nexus)
at build time use dependency plugin unpack goal to extract browser archive to target//
at test execution time, feed in location to browser executable and use that with selenium driver
Or is there a plugin that already handles this for me and am I re-inventing the wheel.
Thanks for the help.
Peter
This ceased to be an issue as my team decided to use chrome not firefox. So, here's the whole process for handling chrome driver and unpacking chrome. you can easily adjust it for firefox.
https://stackoverflow.com/a/38984738/9950
Related
I have installed the GWT SDK version as 2.8.1. I am able to run the application in GWT with Jersy. But, when I try to run the application in GWT Development mode(Super), URL is generating like http://127.0.0.1:9876. When I place this URL in browser not loading the expected UI page. I am getting the page like,
When I click on Dev Mode On button, I am getting this page.
Even I clicked on module name (gwtsample), then I am getting the page like below,
I have even added the GWT extension in browser level and tried the same. But, still no luck.
Instead of trying with the eclipse downloaded GWT SDK, I have externally downloaded the same version of GWT SDK and applied in the Project Properties > GWT > General Settings. Still, facing the same issue only.
I have observed one more thing is, in project facets GWT version is showing like 1.0 where originally I am using 2.8.1 version of SDK. My project is configured with Maven.
I have even gone through multiple questions and solutions which are mentioned in stackoverflow as well as other websites, still, no solution found.
Links which I referred was,
GWT Super Dev Mode
Debugging in GWT Super Dev Mode?
GWT Super Dev mode and in production
some other as well...
You have to compile your GWT application and host in a webserver.
Then navigate to this webserver with your browser. And finally press the DevModeOn bookmarklet to switch to superdevmode.
Drag the bookmarklets (Dev mode on/off) to your bookmarks bar
Compile your gwtsample project into a war
Deploy the war into a webserver like tomcat or jetty
Take your browser (Chrome highly recommended for GWT debugging) and navigate to your installation : for example http://localhost:8080/gwtsample
Now you are just seeing your compiled version in the browser
Next hit the "Dev mode on" bookmarklet.
You will see a message in the browser that compilation is taking place
Now you are in SuperDevMode
Change something in your code
Hit F5 in the browser. Now a recompile will happen and you will see your changes
You can always hit "Dev mode off" to switch off superdevmode. Now you will just see your original compiled application.
Extra : if you are using Eclipse I highly recommend using the branflake plugin : https://github.com/gwt-plugins/gwt-eclipse-plugin
He has some great videos of how to use it : https://www.youtube.com/watch?v=DU7ZQVLR5Zo&list=PLBbgqtDgdc_TqzA-qXrjgTFMC_6DKAQyT
This way you don't even need to compile and host in some webserver as you can run with an embedded Jetty webserver.
You need a HTTP server to serve your HTML host page and webapp (Tomcat, Jetty, Wildfly, Apache+PHP, Rails, choose whatever you need).
Then, launch GWT's CodeServer with -launcherDir pointing to where your webapp lives. It will create a *.nocache.js specific for SuperDevMode, possibly overwriting your production one.
Now, load your webapp as usual from the web server, the specific *.nocache.js will compile your sources on the fly.
If you can live with a simple servlet container, then DevMode (instead of CodeServer) will do all the above setup automatically: use -war instead of -launcherDir.
You shouldn't need to open the CodeServer URL (on port 9876 by default) or use the bookmarklets with any recent GWT version, starting with 2.7.
I am developing a GWT project with Netbeans. When I debug it I always get the screen saying "Development Mode requires the GWT Developer Plugin". The problem is that my version of firefox is too recent to run that plugin. So what can I do?
Update to GWT 2.7, DevMode no longer requires a browser plugin (uses so-called "super dev mode" instead; where you debug in the browser rather than the IDE)
There's documentation for using the GWT Hosted Mode debugging in Netbeans, but you should be better able to use the newer GWT Super Dev Mode. To be able to set breakpoints in Netbeans though, you'd need to properly configure the source map support in Netbeans to map between the compiled JavaScript and the source Java files. I wasn't able to find an obvious reference for doing that with Netbeans.
The fun thing was that gwtproject.org made the sourcemaps part of the released site, and there was a tutorial to using them against their site to step you through how to setup your IDE... But again I didn't find that for Netbeans... Here's an example java source that's linked from gwtproject.org's JavaScript sourcemaps:
http://www.gwtproject.org/src/com/google/gwt/site/webapp/client/GWTProjectEntryPoint.java
If we choose latest version of Firefox or latest version of Selenium-Webdriver, we couldn't automate few tests because of either something not supported in latest version of Firefox or latest version of Selenium-WebDriver.
In such situation, which combinations of Firefox version and Selenium Webdriver version should we choose? (I mean, should we go for one/two version back of latest Firefox version and/or one/two version back of latest selenium webdriver version or some other combination?)
The Latest piece of softwares are always preferable, But the selection of browser version is highly depend upon your application under test.
For newer versions of selenium (v3), check out the selenium-docker releases here, https://github.com/SeleniumHQ/docker-selenium/releases, you can even use docker to test all the Selenium/Firefox combinations easily. For older versions of selenium (v2), check out the selenium site here, https://www.seleniumhq.org/about/platforms.jsp .
I recommend moving to the docker path for local testing; then you can also use the docker files to migrate to cloud platforms.
Use whatever your acceptance criteria states. If you have to support an earlier version of Firefox because it is in a contract or requirement, then you must test that version and use whatever version of selenium is necessary
When ever you download latest webdriver version, make sure that you look into https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG
to check the latest browser version support.
Is it possible to set an execution goal for maven so that the default browser is opened in a given url?
In my experience, Maven doesn't have the notion of a default system browser, nor does Java. There's some information here if you're looking to do this on Windows:
http://groups.google.com/group/comp.lang.java.programmer/msg/bd52c25dad8c1589
That solution also says that this is a platform specific detail.
My advice would be to write your own Maven plugin (surprisingly easy to do) and just set an execution for it under the part of the lifecycle you desire. If you could give me more details of the context under which you want to open a URL, I could help you with that. In my experience, any execution you define for Maven for a phase will happen after that phase. So, setting something for the deploy phase will cause your plugin to run immediately after the artifact is uploaded.
As far as actually opening the browser is concerned, I would recommend using Selenium 2 to accomplish that:
http://code.google.com/p/selenium/wiki/GettingStarted
The nice thing about Selenium 2/WebDriver (they're in the same API) is that it takes care of the logistics of finding default installations of things like Firefox and Chrome, and knows how to interact with that browser and open a URL. You could opt for a platform inspecific default (Firefox would be a good candidate), and if you have an exception opening it, launch Internet Explorer instead (there's no longer current Safari support in Selenium 2 however).
Combining those two things, Selenium 2 inside of a Maven plugin, should accomplish your goal quite well :)
I am writing a GWT project that uses HTML5 canvas.
To test application I use GWTTestCase.
For firefox some functions are supported since gecko 1.9.
While testing, firefox 3.0.1 is being used and errors occur.
How can I set up GWT tests to be launched on firefox 3.6?
(in Eclipse using GWT plugin or using build.xml for ant)
MeasureText wasn't there until gecko 1.9.1.
The workaround is to run tests with runStyle=Manual:1
This gives me link that I can paste into the browser that I want tests to be run in.
-Dgwt.args="-runStyle Manual:1"