Python client for visual testing with Percy
Project description
percy-selenium-python
Percy visual testing for Python Selenium.
Installation
npm install @percy/cli
:
$ npm install --save-dev @percy/cli
pip install Percy selenium package:
$ pip install percy-selenium
Usage
This is an example test using the percy_snapshot
function.
from percy import percy_snapshot
browser = webdriver.Firefox()
browser.get('http://example.com')
# take a snapshot
percy_snapshot(browser, 'Python example')
Running the test above normally will result in the following log:
[percy] Percy is not running, disabling snapshots
When running with percy exec
, and your project's
PERCY_TOKEN
, a new Percy build will be created and snapshots will be uploaded to your project.
$ export PERCY_TOKEN=[your-project-token]
$ percy exec -- [python test command]
[percy] Percy has started!
[percy] Created build #1: https://percy.io/[your-project]
[percy] Snapshot taken "Python example"
[percy] Stopping percy...
[percy] Finalized build #1: https://percy.io/[your-project]
[percy] Done!
Configuration
percy_snapshot(driver, name[, **kwargs])
driver
(required) - A selenium-webdriver driver instancename
(required) - The snapshot name; must be unique to each snapshot- Additional snapshot options (overrides any project options) (
**kwargs**
):widths
- An array of widths to take screenshots atmin_height
- The minimum viewport height to take screenshots atpercy_css
- Percy specific CSS only applied in Percy's rendering environmentrequest_headers
- Headers that should be used during asset discoveryenable_javascript
- Enable JavaScript in Percy's rendering environment
Migrating Config
If you have a previous Percy configuration file, migrate it to the newest version with the
config:migrate
command:
$ percy config:migrate
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
Built Distribution
File details
Details for the file percy-python-selenium-1.0.0.tar.gz
.
File metadata
- Download URL: percy-python-selenium-1.0.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d50975cc7d923b7ce470f7f56f8d3ebcb33cb4a2d53f865ccd9c65d207a77252 |
|
MD5 | f93a83eb4403185b25cd16cd9b305715 |
|
BLAKE2b-256 | 0f6f96745634ec04a48801bf49cba166696b39f239a03caab1743c501ccc6131 |
File details
Details for the file percy_python_selenium-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: percy_python_selenium-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4879c6145266aaecce6c5fa14de50bb578bfdff02beb85187e4180d110c6fa4c |
|
MD5 | c8036a800ea99471435256f9ab560473 |
|
BLAKE2b-256 | 3381ea79b5b3c64fcfcea0be2416ce8b5b8c619a53dbd9a3ced587ce2bafb920 |