Test Automation of CMS based web application - automation

We are using BrightSpot as CMS in one the projects. I am proposing a test automation approach (as below) and would like to know what anyone else is doing along similar lines.
Use Capybara/Selenium-Webdriver to automate the actual publishing of pages or drive the content editing interface of BrightSpot with Capybara DSL.
Once pages are published:
- Do structural tests on the publish page.
- Check the entered content is visible or not visible based on content model defined.
Example,
<div id="asdfg" class="asdfg">
<h1 class="header">Entered Content</h1>
</div>
Expect the published page to have a h1 tag under div#asdfg and the content is "Entered Content".
But prior to automation we will do a manual testing to check cross-browser rendering (compatibility) and responsiveness testing.

There's a host of new tools that can help with web app/page test automation, like PhantomJS, a headless version of WebKit in Node.js and CasperJS, an API and test framework layer on top of PhantomJS. There's a swell webcast presentation that talks about both of these - video here.
The fellow that's presenting in the webcast built a SaaS based version for easily created automated UI tests called Ghost Inspector. The tests can run automatically from the cloud, or you can integrate tests to be run from your build/deploy/CI flow.
With Ghost Inspector, you can build that test in no time, either by using the CSS path or by using a Chrome plug-in that will record your session and construct a test for you (with all of the steps individually laid out) based on your interaction with the CMS web app. You can also run the tests with WebKit (Chrome) or Firefox engines.

Related

Is it possible to use Selenium from within a web app?

I am building a web site in Django that would scrape data from some site, so people could enter the site, set custom data filters and view scraped data in friendly format.
The problem is that requests and beautiful soup modules will not be enough for the scraping purposes, since I will also need some automation to be done (loading javascript or clicking buttons).
Since Selenium requiers a webdriver to be downloaded and put into a path, is it possible to use it from within web app? Like hosting the webdriver somewhere?
I am also open to solutions other than Selenium, if there are any.
I think what you would want is a selenium grid server.
https://www.seleniumhq.org/docs/07_selenium_grid.jsp
Basically you host it on some remote server and then you can connect to it and spin up web drivers remotely and use them in code as needed. It also comes with a handy interface for checking on current browser instances and even taking screenshots or executing scripts from the web ui.

Does Microsoft UI Automation Framework work with Chrome, Python and Java Apps?

I am working on an automation project, in which I need to capture the activities [ application launched, data entered, input type etc.] user performs on a desktop. I came across Microsoft UI Automation framework which so far works well for native windows based applications like MS Office, .NET apps etc. However I did not find any useful information / samples of capturing the information from different web browsers [Chrome is a must], Python apps, Java Apps etc. Can someone please confirm whether MS UI Automation Framework supports such apps. Any working example to extract user activities from these apps would be highly appreciated. Thanks.
Chrome only supports UI Automation for toolbars, tabs, menu, buttons around the web page. Everything that's rendered as a web page is not seen by UIA.
For the web page content, the easiest way is to use Selenium (driven by the ChromeDriver), which is kind of a de facto standard for browsers, and has nothing to do with UIA.
To test if an app supports UIA, and how far it does, it's very easy, just run UIA's Inspect tool and check the UI tree over that application.
Some additions to Simon's answer...
Chrome page content can be seen by UIA if you run chrome --force-renderer-accessibility. Only for existing Chrome process it won't work. Though user can create a new tab chrome://accessibility manually and enable UIA for all or some chosen pages. This method also works for AT-SPI accessibility technology on Linux. Of course, Selenium WebDriver is an industry standard here. But another way exists. Both Mozilla and IE support UIA by default.
Inspect.exe can be simply downloaded from this GitHub repo.
Regarding Java apps it depends on the app type. Your chances is about 50/50.
WxPython or PyQt5 are good for UIA. TkInter or Kivy apps are not.
P.S. There is an example how to drag a file from explorer.exe and drop to Google Drive in Chrome using Python library pywinauto.
I'm a bit late to the party..
But Chromes accessibility features are only activated once something tries to access it's accessibility.
If you call AccessibleObjectFromWindow ([DllImport("oleacc.dll")]) with the window handle an existing chrome window will have its accessibility activated (and you'll see the actual web page content in UIA!).
If the chrome window is opened after your app is running - Chrome pings open processes for any open accessibility apps... for that you use AccessibleObjectFromEvent and the event you're responding to comes from the windows pipeline: EVENT_SYSTEM_ALERT = 0x0002 .
The bottom line is - you have to tell chrome that there's something installed that wants to access it's web page content.
Oh! and your application has to be signed!! Unsigned apps won't be able to access web content - I think that's the same in firefox too.
I hope this helps someone in the future.
See:
https://www.chromium.org/developers/design-documents/accessibility

Automation testing between desktop and web application?

I am working on a retail based project. We have two UI. One is web portal where different types of vouchers can be created. These vouchers can be issued and redeemed from desktop application. The issued and redeemed voucher update details will be uploaded to web portal. I am using sikuli to automate desktop application. Can i do GUI testing between desktop and web using sikuli?
Thanks in advance.
As far as my investigation goes, testing end-to-end scenarios that involve both, we and desktop applications, Sikuli is the only option.
When making the decision there few limitation to keep in mind though:
Sikuli tests will only work on the same resolution screen as the one the tests were been created on.
You will need to have a physical computer switched on with a screen attached to it to work.
As it was mentioned in other post here, long scenarios with Sikuli can become brittle. So if you have an option to split your end-to-end scenarios into multiple standalone pieces, while using Selenium for the web part and Sikuli for the desktop app, that probably will be the best solution. Perhaps do some data preparation in one app and save data in a file, then run the other part and assert everything has worked as expected based on that text file.
Base of sikuli is to search the UI controls on screen, based on screenshot.
Also it provides Sikuli API for Java with which you can do a programming around the AUT.
To answer your question,
As long as it is GUI and it's expected screenshot can be taken, then Yes, you can use Sikuli to test Desktop UI & UI for the site opened in Browser.
But testing Web UI with sikuli is quite hectic process as you may need to take screenshots of every testable controls. It will be more cumbersome if site is heavily loaded with images and input controls.
We have selenium IDE/selenium webdriver to perform such testing.
You can use Sikuli on the desktop side where autoIT may become heavy job and the UI is quite static.

Automated browsing of complicated web pages

I have a project that will involve heavy automation of complicated web pages.
I realize there are Mechanize and Beautiful Soup, but don't these break when dealing with large amounts of DOM scripting and other weird stuff you find on complicated web pages?
I think I want essentially a barebones running instance of WebKit that allows me to either do "GUI scripting" or access the DOM. Ideas?
Try Sahi with PhantomJS. Sahi is a browser automation tool, and PhantomJS is a headless Webkit browser. You can find set-up instructions here: http://sahi.co.in/w/sahi-headless-execution-with-phantomjs
Disclaimer: We created the Sahi product.
What platform are you working on? And what language do you intend to use?
Adobe Air let's you embed a webkit inside an Air application and interact with the page JavaScript (there is two-way communication between the page JS and the AIR runtime).
Otherwise, if you are not bound to webkit you could take Mozilla Chromeless for a spin.
My apologies if none of this does what you need to do, I can't quite figure what exactly you are trying to do (page scraping? submitting forms?).
For testing/scraping i would try:
Selenium
EnvJS
Windmill
Watir
Sahi
WebTest

Automated Web Testing Tools in Java

I want to test a Ajax based web application. I want to write the test scripts in Java and simulate the web browser.
Simulation of a web browser is very important since Iam using very advanced Ajax library like jQuery in the web Application.
Any ideas on how I should proceed?
I think you might want to give Selenium a look.
Kindness,
Dan
Doing "simulation" of a browser will probably not work that well if your application relies on Javascript a lot : there are some crawlers that you can use to test your application, but they don't like JS that much.
The best solution in your case might be to use a real browser to do your testing.
The Selenium tool-suite is quite nice for that : it allows your testing programm to pilot a browser (a real one : firefox, internet explorer, ...) ; which mean having you JS code executed exactly the same way that it would be with a "real" user.
For instance, you can have your testing programm tell a browser to open a page, click on a link, check some content in the page, ... And if there was some JS event plugged onto the link, it will have been executed : there will have been a real "click" on the link.
Using a tool like selenium has some drawbacks, though ; some of them are :
you need a machine with a graphic environnement, to launch the browsers (command line is not enough)
tests with selenium take time : browsing and using the application means loading all the CSS/JS/Images/ads/whatever, for each page ; like in a real browser -- because you are using a real browser
But these tests are quite nice, and usefull to test the application as a whole -- ie, more "functionnal tests" than "unit-test".