Playframework selenium autotest debugging - selenium

I am developing a play 1 application and testing it with the selenium. In several cases, play auto-test fails when normal testing within a browser (play test) succeeds. This can be due to different behaviour of js/ajax, or development mistakes on my side.
Is there a way to get some more feedback regarding what's going on in the headless browser? For example, assertTitle does give some feedback, as in the test-results HTML the title found is displayed.
Are there ways to get a the whole response at a given point, or any other usable feedback to debug the application and the test cases?

It would be better if you could give some more details about what all things are failing in your tests, give some code examples which u are writing.
Even i had faced lot of issues in running selenium tests in play auto-test, u can refer this link for our issuesPlay Auto-tests issues
The best way to debug the selenium tests is to use echo and see what are the results it is returning.

Related

Test the execution of a Selenium automation

I don't know if this is unusual, but I'm wondering if I should test my automation that uses Selenium (written in Python).
Basically, I have to login and perform some actions in an old web application that doesn't have public APIs, so this is the only way to automate what I need to do. It's an application from my city hall to create tax receipts.
But I couldn't think of a way to test if my code will work. Right now it's working, but I'm refactoring a few things and thought that there could be something I can do to test if things will continue to work as they should. The problem is that it's a critical automation, and it's only used once per month; I don't have access to any kind of sandbox environment. What I usually do if I need to run the automation is to create a tax receipt of my own company, with $1 value, and then I just cancel it, but it's... weird.
One thing that crossed my mind was to perform the automation one time and in every step just save the whole HTML. Then, I could write tests and mock the page clicks / navigation; instead of loading the URL, it would load the HTML file.
I know it wont't be 100%, in production there can be errors that I haven't foreseen. But then I can update my tests to include these corner cases as they happen. Anyone had experience with this type of thing before?

Testing views in express js

I'm trying to figure out an ideal way to test my views, written in Jade. They contain some logic. For example on the home page if a cookie has been set it should show a button to link to the main console and have option to logout versus if no cookie is set it should show login.
Any advice is appreciated.
Have a look at selenium
http://seleniumhq.org/
And of course the node adapter
https://github.com/LearnBoost/soda
I think that are not hard bugs to debug(You should see that in the browser window if it happens). But if you really want to I think you have following options:
Write the tests the way TJ did looking at his tests. He has written tests for almost everything.
Doing headless testing use for example tobi or zombie.js. There is also phantom.js, but this product is not developed in node.js.
selenium(not developed in node.js) with soda like deltanovember pointed out.
You could use js-test-driver to test all your browsers(client-side javascript). You could also use YETI(using YUI test framework) to test all your code in all the browsers.

Taking screenshots of a page while its loading using Selenium WebDrivers

I have started using Selenium WebDrivers to automate some performance testing. I found out that we could take screenshots of a page after the page has completed loading using WebDrivers: http://seleniumhq.org/docs/04_webdriver_advanced.html#taking-a-screenshot. However, I want to be able to take screenshots while the page is loading to analyze its loading time and pattern, much like what webpagetest does (http://www.webpagetest.org/). Is there an API that I could use to accomplish this task using WebDrivers?
I am using the FirefoxWebDriver and the Java client for the same. I appreciate help or tips.
Thanks!
Since, I found out that the RemoteWebDriver's get calls are blocking and even the getScreenshot calls are blocking, I decided to run java.awt.Robot in a separate thread and capture screenshots while the WebDriver loads the page.
The only caveat is that the browser instance opened up by the WebDriver has to be in the front of the screen to take snapshots correctly. I am exploring if Robot can take snapshots on an Xvfb display, which would be just awesome and would work for my purposes.

TestComplete import testscenario from Selenium

Maybe this sounds ridicilous, but still, is there somekind of way to convert/import/hack selenium test scenario to get work on TestComplete?
I ask this, because my boss asked me to find a way, we are using Selenium, but our customer want us to give him TestComplete scripts, so we dont want to buy licence for 1 customer and i havent find any yet and belive there is no... maybe im missing something? Thanks you and have a nice day.
There is no direct ways to convert Selenium tests to TestComplete as these tools use different principles. Selenium works with web pages "from inside" (programmatically) while TestComplete does this "outside" by simulating user actions: it sends mouse clicks and key presses to the browser.
I think that it is possible to invoke Selenium tests from TestComplete, but you will not have any results in TestComplete and you will be unable to modify tests in it.
BTW, you can request a free 30-days trial if a month is enough for you to convert the tests.

What's the simplest/easier way to do a health check/smoke test in an internal web app?

I have an intranet web application and I would like to do a simple health check/smoke that runs once an hour to make sure that everything is how it is supposed to be.
The tests are supposed to do some requests and check response for text and in some cases do one or two POSTs to see if the application in answering like it should.
I thought about using Selenium or Visual Studio's WebTest and schedule the run via CC.NET or another CI application but seems like a big shot for a simple thing.
Any ideas?
Thanks
Selenium is a good option. So is PhantomJS.
I dare to say that SWAT could be a good choice for you. It does exactly what you say - makes various http calls and check data returned, also it is possible to pass the test results to different report systems, using TAP format which swat is compliance with. And finally there is a simple DSL to write such a checks.
Regards, the author.