Skip to main content

Framework to build UI test automation in Page Transactions pattern

Project description

Guará

PyPI Downloads

Photo by Mateus Campos Felipe on Unsplash


What is Guará?

Guará is a Python framework designed to simplify UI test automation. Inspired by design patterns like Page Objects, App Actions, and Screenplay, Guará focuses on Page Transactions—encapsulating user interactions (transactions) on web pages, such as Login, Logout, or Form Submissions. It’s not just a tool; it’s a programming pattern that can be adapted to any web driver, not just Selenium.

Why Guará?

  • Simplicity: Reduces repetitive code by encapsulating web interactions into reusable transactions.
  • Flexibility: Works with any web driver, not limited to Selenium.
  • Clarity: Makes test scripts more readable and maintainable.

Quick Start

Installation

Guará requires Python 3.8+. Install it via pip:

pip install guara

Syntax

Application.at(apage.DoSomething [,with_parameter=value, ...]).asserts(it.Matches, a_condition)

Example in Action

from selenium import webdriver
from pages import home, contact, info, setup
from guara.transaction import Application
from guara import it

def test_sample_web_page():
    # Initialize the Application with a driver
    app = Application(webdriver.Chrome())
    
    # Open the web application
    app.at(setup.OpenApp, url="https://anyhost.com/")
    
    # Change language to Portuguese and assert content
    app.at(home.ChangeToPortuguese).asserts(it.IsEqualTo, content_in_portuguese)

    # Navigate to Info page and assert text presence
    app.at(info.NavigateTo).asserts(it.Contains, "This project was born")

    # Close the web application
    app.at(setup.CloseApp)

Behind the Scenes

The repetitive web driver code is encapsulated in a transaction class:

class ChangeToPortuguese(AbstractTransaction):
    def do(self, **kwargs):
        self._driver.find_element(By.CSS_SELECTOR, ".btn:nth-child(3) > button:nth-child(1) > img").click()
        self._driver.find_element(By.CSS_SELECTOR, ".col-md-10").click()
        return self._driver.find_element(By.CSS_SELECTOR, "label:nth-child(1)").text

Key Features

1. Page Transactions

  • Encapsulates user actions into reusable transactions.
  • Reduces boilerplate code and improves readability.

2. Flexible Assertions

  • Use built-in assertions like it.IsEqualTo, it.Contains, and more to validate outcomes.

3. Cross-Driver Compatibility

  • Works with Selenium and can be adapted to other web drivers.

4. Asynchronous Execution

  • Supports asynchronous operations for modern web applications.

5. ChatGPT Assistance

  • Leverage AI to generate or debug transactions.

Documentation

Tutorial

Get started with a step-by-step guide to build your first automation.

Demonstration

Watch the video

Examples

Explore practical examples in the examples folder.

Advanced Topics


Contributing

How You Can Help

  • Star this project on GitHub.
  • Share it with your network.
  • Write a blog post or tutorial about Guará.
  • Contribute code: Check out the good first issues and submit a pull request.

Guidelines


Why the Name "Guará"?

Guará is the Tupi–Guarani name for the Scarlet Ibis, a vibrant bird native to South America. Just like the bird, Guará stands out for its simplicity and elegance in solving complex UI automation challenges.


Used by

Ready to Dive In?

Start automating with Guará today! Check out the tutorial and explore the examples to see how Guará can simplify your UI testing workflow.


Guará: Simplifying UI automation, one transaction at a time. 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guara-0.0.12.tar.gz (846.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guara-0.0.12-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file guara-0.0.12.tar.gz.

File metadata

  • Download URL: guara-0.0.12.tar.gz
  • Upload date:
  • Size: 846.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for guara-0.0.12.tar.gz
Algorithm Hash digest
SHA256 d862ea4b13efbdb27fa964660a96c3bfa0c26cf99b489ffc6f50086409b1e36d
MD5 7c9acd9656a081c4cc46831684325bb0
BLAKE2b-256 456607e7672420713ff244d72c0e4ba8853fd6e4e7aa76d216f743347fc129f0

See more details on using hashes here.

File details

Details for the file guara-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: guara-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for guara-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 70a51281e2d71bb33e4bd18d2a66577e2ce76d34daa709cfc61890206c43f5d6
MD5 e313a3f8e15fb9cd42e8c58b97cf13b1
BLAKE2b-256 24c1e41206b53fd6761e99bb041189a1d04d0da50e56b707daf76127f7bd1a0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page