This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A Django template tag to enable testhook attributes on HTML elements.

About django-testhook

The django-testhook provides a template tag to generate data-testhook-id for HTML templates.

This can be useful for automated testing (for eg: Webdriver.IO) to maintain a fixed entry point, rather than having a automated test that breaks by just renaming a CSS class or an element which can require you to re-evaluate an XPath-selector.

Requirements

Django 1.8.x or greater, Python 2.7 or greater.

Installation

Install django-testhook with pip:

$ pip install django-testhook

Configuration

Configuring django-testhook

Add the following to your settings file:

INSTALLED_APPS += (
    'testhook',
)

Available settings

By default the rendering of testhook data attributes is enabled. If you are in the scenario you want to disable it for a certain environment just configure it to False.

TESTHOOK_ENABLED = False

Usage

Basic usage

Within your HTML template you must load the testhook tag in order to use it. The testhook tag only requires a single argument in order to return a result.

{% load testhook %}

<div class="my-elem" {% testhook "test-elem" %}>
    I want to test this
</div>

This will output to the following:

<div class="my-elem" data-testhook-id="test-elem">
    I want to test this
</div>

Object Usage

For dynamic elements there is also the option to pass arguments. For eg: given I have a product in a shopping basket with a primary key and a slug I could use it like this:

<div class="item" {% testhook "basket" product.id product.slug %}>
    {{ product.title }}
</div>

It will output to:

<div class="item" data-testhook-id="basket-1-product-slug">
    A product title
</div>
Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-testhook-1.0.1.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Aug 16, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting