Advanced visual testing of Web and Mobile applications with Python

Advanced visual testing of Web and Mobile applications with Python

Who said that Python is not friendly with Front-end?

ITArray released the 1st version of Automotion-Python framework that can be used for visual validation of the web and mobile application.

You can find it by link https://github.com/ITArray/Automotion-Python

If You want to connect the library to Your project with “Tox” – simply add this dependency to Your tox.ini file:
http://github.com/ITArray/Automotion-Python/tarball/master#egg=Automotion

It’s super simply in usage:

from automotion import responsive_ui_validator
ui_validator = responsive_ui_validator.ResponsiveUIValidator(self.driver)
result = ui_validator.init("Open navigation drawer scenario").find_element(self.driver.find_element_by_name("Name"), "Name")\
    .same_size_as(self.driver.find_element_by_id("Id"), "Search Icon")\
    .same_offset_bottom_as(self.driver.find_element_by_id("Id"), "Search Icon")\
    .same_offset_top_as(self.driver.find_element_by_id("Id"), "Search Icon")\
    .not_overlap_with(self.driver.find_element_by_id("Id"), "Search Icon")\
    .inside_of(self.driver.find_element_by_id("Id"), "Toolbar")\
    .width_between(100, 200)\
    .height_between(100, 200)\
    .draw_map()\
    .validate()

ui_validator.generate_report("ReportToolbarIcons")

Leave Your feedback and comments. Also join and contribute into Automotion if You have ideas.
Thanks for reading my blog!

Visual perception of web applications

Visual perception of web applications

Try to ask any QA automation engineer the simple question “How to verify that element is presented on the page?”. The answer will be simple and obvious “It needs to check that element is displayed”.

Let’s try to look on this case from another perspective. How many times we’ve been using the web applications with terrible design? Yes, everything works as expected on the web pages and all the elements are displayed. But the main human’s instrument for perception of external world is the eyes and the brain. We see the world in 3D. But on the background human’s brain try to simplify the perception by dividing all the things into vertical and horizontal. If the things are aligned without these primitive options – then our brain will turn on another validator to catch what is wrong. This fact was proved by scientist few years ago.

So, this is just another validator of external world – and what? Yes, it sounds like nothing serious. Our brain is so powerful that can perform millions of validations per second.

The main problem is the next: once the brain is switching to another processes of the world perception, some of other important activities may be slowed down. What does it mean in the real world? Let’s back to the main topic.

Imagine the situation that user opens some web page of online shop because he/she looks for something not important for him, just for some different discounts and so on. Every day hundreds of thousands of the purchases happen exactly in such way. If the interface is simple with properly aligned UI elements – then customer will be concentrated on the searching of the stuff for buying. But if the elements have not proper alignment – background processes of the brain that are responsible for validation of external world will be working in the way to understand and stabilise the perception of the image that user sees at the moment. And at this moment it appears high possibility that user will forget about the main reason why he/she opened the web page.

If to look at the problem from the point of view of QA automation engineer it’s easy to understand that it is not enough to test that elements are presented on the page. And the main importance switches to the validation of how the elements are presented on the page. Kind of validation of perfect pixel.

Powerful framework Automotion is the best solution for Web and mobile automation testing to perform proper visual validation. It allows to validate the alignments of the elements on the page like how user would like to see it. The most powerful feature are extremely fast validation of the page on the different zoom levels of the browser and different page sizes. Validation for correct central alignment of one element or the group of similar elements. It’s a really smart validation of the page.

I hope that this article will help improve the quality of the applications.

Have a good quality!

Mobile automation of native Android application with WebView container

Mobile automation of native Android application with WebView container

Hello friends!

Most of engineers started to learn mobile automation with Appium. This is the most popular framework for mobile automation testing and I think that everybody agree with this. But sometimes it’s not enough to have only Appium, especially if we want to test native Android application with only WebView container inside. Appium cannot recognise elements in WebView container.

What to do in this case? Some test engineers decided to postpone with automation. But in reality this automation is even much easier than testing of native application with native controls.

How WebView container works? It’s loading mobile version of web site into custom WebView form. It means that we can easy inspect elements with Chrome or Firefox inspector.

But how to say Appium to search for elements exactly in this WebView? Many of You guys heard that need to switch context. But what if You run Appium inspector and You see only 1 context called NATIVE_APP ? In this case You need to switch Appium to Selendroid mode. For UI Appium inspector this is here:

screen-shot-2016-10-27-at-09-12-16
But if we want to run the tests in Selendroid mode, we need to specify capability “automationName”: “Selendroid”.

After this You will see that You have more contexts than only NATIVE_APP, but also 1 or more WEBVIEW contexts. The next step is switching to correct context (for example):

driver.context("WEBVIEW_0").switchTo();

And that’s all. Now You can easy use the same methods like for Selenium WebDriver to navigate and click.
Also, You can use method .get(“url”) to easy navigate to any pages without clicking on UI.

Hope it will help You to solve some issues and start automation of hybrid apps.

Thanks for reading my blog!

Have a good automation!

Automation testing: Selenium + Cucumber – Lesson 6 (Advanced verifications)

Automation testing: Selenium + Cucumber – Lesson 6 (Advanced verifications)

Hello friends!

Welcome to lesson #6!

In the previous lesson You learned how to develop simple verification methods, how to decorate them correctly to receive pretty results in case of failures. Today we will review very interesting and very useful topic regarding advanced verifications and how to implement it with Automotion.

So, we used to have the standard verifications, when we verify only that element is displayed or not. But usually we don’t do any validations that elements are aligned properly on the page. Nowadays we have desktop and mobile web application with responsive design. And correct alignment of elements on the page is super important part of business.

Let’s look this example on www.facey.top:

screen-shot-2016-10-23-at-10-50-33

We want to make sure that tabs “TOP”, “NEWEST” and “MY PHOTOS” have correct order and they are aligned properly. And also we need to validate that footer is placed somewhere under top header.

The second thing that we want to verify – that this home page has correct localisation language and the whole text is really in English. Not latino, but really in English.

You will find everything in attached video. Wish You nice watching!

Amazing!

Now we can cover our test suite that require to have some UI/UX and linguistic skills!

In this lesson You’ve learned very interesting things of how to make verification of proper alignment and orders of elements on the page and how to validate that page has correct localisation. Hope this information will help You in Your automation.

Do not miss the next lesson. We will review the implementation of action classes and some advanced usage of Automotion.

Wish You good luck! Have a nice automation!

 

Automation testing: Selenium + Cucumber – Lesson 5 (Base verifications)

Automation testing: Selenium + Cucumber – Lesson 5 (Base verifications)

Hello dear friends!

Welcome to lesson #5!

Today we will review one of the most important part of automation framework – verifications. Obviously that if our tests verify nothing – they are useless. So, this lesson will give You an understanding of how to create classes for verifications and how to customise them to have nice test results.

Some engineers likes to keep verifications in the body of unit tests, some of them would like to keep it in the same class with page objects. I would prefer to create separate package “verifications” and for each of our page object class create appropriate class for verifications.

Sometimes we need to have base class for verification to keep different methods for base verifications in this class.

Each of our verifications methods will return string with error messages if such were detected during verification.

So, let’s start to implement our first verification class.

Have a nice watching of video lesson!

Well, in this lesson You’ve learned how to create verifications, how to manage the readability of results and tests. It is super important part in creation of the framework for automation testing.

In the next lesson I will show You how to work with advanced verifications, when You want to verify language of the web page, or if elements are aligned correctly, etc. This information You will find in my next video.

Thank You for watching my channel.

Have a good automation!