Making UI Testing easier with Widgetastic - A python library

Yash Ajgaonkar (~yash1)


18

Votes

Description:

Testing UI of applications with selenium comes with a lot of limitations which includes finding locators, importing and setting up web-drivers , handling errors occurred during test runs , maintaining huge test cases.

Widgetastic is a open-sourced Python library designed to abstract out web UI widgets into a nice object-oriented layer. It promotes the use of the Page Object Model, a design pattern for organizing web elements and their actions into reusable components. Widgetastic provides built-in support for POM, making it easier to implement and maintain a structured and modular testing approach. It is primarily used by software developers and quality assurance (QA) professionals who engage in web application testing and automation. It provides a more intuitive and concise API compared to the lower-level API of Selenium. It abstracts away some of the complexities of working with Selenium, making it easier to write and maintain test scripts.

With Widgetastic, you can automate web application testing by writing concise and readable code. It provides a set of user-friendly methods and properties to easily locate, interact with, and validate elements on a web page. It supports various types of web elements such as buttons, input fields, dropdowns, tables, and more. Some key features of Widgetastic include:

  1. Element Locators: Widgetastic provides various methods for locating elements on a web page, including by CSS selectors, XPath expressions, ID, class, name, and more.
  2. Actions and Interactions: You can perform actions on elements such as clicking buttons, entering text, selecting options, and interacting with dropdowns or checkboxes.
  3. Validation and Assertions: Widgetastic allows you to verify the state of web elements, including their text, attributes, visibility, and more. It provides assertion methods to validate expected conditions.
  4. Page Objects: Widgetastic supports the concept of page objects, which are classes that represent specific web pages and encapsulate the interactions with the elements on those pages. This helps in organizing and maintaining test code.
  5. Integration with Testing Frameworks: Widgetastic can be seamlessly integrated with popular testing frameworks like pytest, allowing you to combine web testing with other types of tests in a single test suite.

Widgetastic simplifies the process of writing and maintaining web application tests by providing a clean and intuitive API. It promotes best practices in test automation, making it easier to build robust and reliable tests.

It can be used in conjunction with pytest , Behave , Robot Framework , TestNg.

Widgetastic can also be integrated into CI/CD pipelines as part of the overall testing and automation strategy.

The outline for our talk would be as follows:

  1. Introduction to Widgetastic [3 minutes]
  2. Internal Structure of Widgetastic [5 minutes]
  3. Components [3 minutes]
  4. Getting started and Demo [10 minutes]
  5. Integration with other libraries [4 minutes]
  6. Q/A [5 minutes]

Prerequisites:

This talk requires an understanding of the following:

Python , OOPS (beginner concepts) , Selenium

If you want to get started with UI test automation tool, this talk will interest you!

Speaker Info:

Yash is a Software Engineer currently employed at Red Hat, where he is a valuable member of the Hybrid Cloud Console Team. With a background in SDET/DevOps, he is driven by a strong passion for optimizing product release workflows and ensuring efficient software delivery. Yash's primary areas of expertise lie in Python and Bash scripting.He actively contributes to the open-source community through various events and initiatives.

Subhashree is a Software Engineer who is currently part of the Hybrid Cloud Console Team at Red Hat. With a strong background in software development, she contributes her expertise in Python and Javascript to create innovative and efficient solutions.Aside from her professional pursuits, Subhashree has a deep affection for dogs and is an avid fan of the popular TV show "The Office

Past Talk: Ceph Days India 2023

Section: Developer tools and automation
Type: Talks
Target Audience: Beginner
Last Updated: