Skip to main content

Keteparaha is a tool for testing modern JS heavy websites

Project description

[![Join the chat at https://gitter.im/aychedee/keteparaha](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aychedee/keteparaha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![PyPI version](https://badge.fury.io/py/keteparaha.svg)](http://badge.fury.io/py/keteparaha) [![Build Status](https://travis-ci.org/aychedee/keteparaha.svg)](https://travis-ci.org/aychedee/keteparaha) [![Coverage Status](https://coveralls.io/repos/aychedee/keteparaha/badge.svg?branch=master)](https://coveralls.io/r/aychedee/keteparaha?branch=master)

Keteparaha is a collection of tools to help when functional testing

It contains utilities that assist with tasks like running a browser in a headless environment, or checking that emails have been sent, or a file has been uploaded to a server, or common testing flow control like retrying or ignoring certain errors.

copyright:
  1. 2015 by Hansel Dunlop.

license:

GPLv3, see LICENSE for more details

BrowserTestCase

A browser test case for testing web applications. Subclass it and call the start_browser method with the name of the browser you want to test with. Closing the browser is handled automatically. For example:

from test_helpers import BrowserTestCase

class YourTestCase(BrowserTestCase):

def setUp(self):

self.browser = self.start_browser(“Firefox”)

def test_page_loads(self):

self.browser.get(‘127.0.0.1:8080’)

self.assertIn(“Hello, World”, self.body_text)

HeadlessBrowserTestCase

Requires XvFB to be installed (sudo apt-get install xvfb).

Designed for testing web applications on a headless server, probably running as part of continuous integration. Usage is exactly like the BrowserTestCase except that you won’t see a browser window open, everything should be done inside a virtual display.

The example below would run Firefox inside a virtual display with a width of 1200px and height of 900px.

from test_helpers import HeadlessBrowserTestCase

class YourTestCase(HeadlessBrowserTestCase):

def setUp(self):

self.browser = self.start_browser(“Firefox”, size=(1200, 900))

Remaining keyword arguments to start browser will be passed down to the virtual display driver. But the other defaults are generally sensible.

Page

The Page class represents a page in your application and should be subclassed and extended. Pages are given urls. Whenever you click a component of your site and the URL changes the associated page will be returned. Creating an instance of a class will automatically visit that page.

from test_helpers import Page SERVER_URL = ‘http://your-site.com/{}’

class LoginPage(Page):

url = SERVER_URL.format(‘login/’)

def login(self, username, password):

self.click_button(“Login”) self.enter_text(“input[name=username]”, username) self.enter_text(“input[name=password]”, password) return self.click(“input[type=submit]”)

class YourDashboard(Page):

url = SERVER_URL.format(‘dashboard/’)

def assert_logged_in(self):

# Will raise an exception if component not present self.get_component(“.account-details”)

class YourTestCase(BrowserTestCase):

def setUp(self):

self.start_browser()

def test_login_works(self):

login_page = LoginPage(driver=self._driver) dashboard = login_page.login(‘username’, ‘password’)

dashboard.assert_logged_in()

Email

The email module contains a imap client written to interact with gmail. This is especially useful if you use Google Apps and you’re running tests against it.

Flow Control

This module contains three functions that are intended to make flow control in testing situations less painful. They can be used as decorators. They are:

  • retry

  • ignore

  • fallback

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

keteparaha-0.0.24.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

keteparaha-0.0.24-py2-none-any.whl (15.8 kB view details)

Uploaded Python 2

File details

Details for the file keteparaha-0.0.24.tar.gz.

File metadata

  • Download URL: keteparaha-0.0.24.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for keteparaha-0.0.24.tar.gz
Algorithm Hash digest
SHA256 134f5037c3f1efa6b86cc51dc0804f17da66865d7f93cc1d7e2a968150250694
MD5 9fd1aff33a916653ffbae923d395dcc3
BLAKE2b-256 f236f533480c7cafd0fb4b6b102dad90b0e343cef15e5f661b2733d010f47e72

See more details on using hashes here.

File details

Details for the file keteparaha-0.0.24-py2-none-any.whl.

File metadata

File hashes

Hashes for keteparaha-0.0.24-py2-none-any.whl
Algorithm Hash digest
SHA256 a2c484fa2fa86ec02db0441c357adf0f69a2e534cec7b1546c31579134e6f6ad
MD5 1d6820478f03af8e4504254c68a5f92a
BLAKE2b-256 05f07e9473bff17456c878f69690ee9425807afa861401023594eb5718be3f44

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