-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Use @percy/cli * 👷 Use GitHub Actions * 📝 Update README * ✨ Minor updates Update environment variables Update log label for debugging Use f-strings rather than string concatenation Use /percy/healthcheck explicitly to check availability Use functools.cache to cache healthcheck and percy/dom results Provide serialization script with passed options Print snapshot errors without debug logs * 🎨 Follow language conventions with snake case A camelCase percySnapshot is still provided for backwards compatibility * 📝 Update README Co-authored-by: Wil Wilsman <wil@wilwilsman.com>
- Loading branch information
Showing
21 changed files
with
421 additions
and
2,306 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '💥 Breaking Changes' | ||
labels: | ||
- breaking | ||
- title: '✨ Enhancements' | ||
labels: | ||
- feature | ||
- enhancement | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- fix | ||
- bugfix | ||
- bug | ||
- title: '🏗 Maintenance' | ||
labels: | ||
- chore | ||
- dependencies | ||
change-title-escapes: '\<*_&#@' | ||
version-resolver: | ||
major: | ||
labels: | ||
- breaking | ||
minor: | ||
labels: | ||
- feature | ||
- enhancement | ||
default: patch | ||
template: '$CHANGES' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Changelog | ||
on: | ||
push: | ||
branches: [master] | ||
jobs: | ||
update_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Lint | ||
on: push | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: v1/${{ runner.os }}/pip/${{ hashFiles('{requirements,development}.txt') }} | ||
restore-keys: v1/${{ runner.os }}/pip/ | ||
- run: make lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: v1/${{ runner.os }}/pip/${{ hashFiles('{requirements,development}.txt') }} | ||
restore-keys: v1/${{ runner.os }}/pip/ | ||
- run: make release | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Test | ||
on: push | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: v1/${{ runner.os }}/pip/${{ hashFiles('{requirements,development}.txt') }} | ||
restore-keys: v1/${{ runner.os }}/pip/ | ||
- run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
node_modules | ||
geckodriver.log | ||
*.pyc | ||
.venv | ||
*.egg-info | ||
dist | ||
build | ||
*.egg-info | ||
*.log | ||
**/__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[MASTER] | ||
fail-under=10.0 | ||
disable= | ||
broad-except, | ||
global-statement, | ||
invalid-name, | ||
missing-class-docstring, | ||
missing-function-docstring, | ||
missing-module-docstring, | ||
multiple-statements, | ||
no-member, | ||
no-value-for-parameter, | ||
redefined-builtin, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
VENV=.venv/bin | ||
REQUIREMENTS=$(wildcard requirements.txt development.txt) | ||
MARKER=.initialized-with-makefile | ||
VENVDEPS=$(REQUIREMENTS setup.py) | ||
|
||
$(VENV): | ||
python -m venv .venv | ||
$(VENV)/python -m pip install --upgrade pip setuptools wheel | ||
|
||
$(VENV)/$(MARKER): $(VENVDEPS) | $(VENV) | ||
$(VENV)/pip install $(foreach path,$(REQUIREMENTS),-r $(path)) | ||
touch $(VENV)/$(MARKER) | ||
|
||
.PHONY: venv lint test clean build release | ||
|
||
venv: $(VENV)/$(MARKER) | ||
|
||
lint: venv | ||
$(VENV)/pylint percy/* tests/* | ||
|
||
test: venv | ||
$(VENV)/python -m unittest tests.test_snapshot | ||
|
||
clean: | ||
rm -rf $$(cat .gitignore) | ||
|
||
build: venv | ||
$(VENV)/python setup.py sdist bdist_wheel | ||
|
||
release: venv | ||
$(VENV)/twine upload dist/* --username __token__ --password ${PYPI_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,75 @@ | ||
# percy-python-selenium | ||
[![CircleCI](https://circleci.com/gh/percy/percy-python-selenium.svg?style=svg)](https://circleci.com/gh/percy/percy-python-selenium) | ||
# percy-selenium-python | ||
![Test](https://github.com/percy/percy-python-selenium/workflows/Test/badge.svg) | ||
|
||
[Percy](https://percy.io) visual testing for Python Selenium. | ||
|
||
## Quick start | ||
## Installation | ||
|
||
npm install `@percy/cli`: | ||
|
||
```sh-session | ||
$ npm install --save-dev @percy/cli | ||
``` | ||
|
||
pip install Percy selenium package: | ||
|
||
```ssh-session | ||
$ pip install percy-selenium | ||
``` | ||
|
||
## Usage | ||
|
||
This is an example test using the `percy_snapshot` function. | ||
|
||
- Install `@percy/agent` from NPM: `npm i -D @percy/agent` | ||
- Install the Python SDK: `pip install percy-python-selenium` | ||
- Import `percySnapshot` in your test file: `from percy import percySnapshot` | ||
- Add a `percySnapshot` call to your test: | ||
``` python | ||
from percy import percySnapshot | ||
from percy import percy_snapshot | ||
|
||
browser = webdriver.Firefox() | ||
browser.get('http://example.com') | ||
| ||
# take a snapshot | ||
percySnapshot(browser=browser, name='Home page') | ||
percy_snapshot(browser=browser, name='Python example') | ||
``` | ||
|
||
Running the test above normally will result in the following log: | ||
|
||
```sh-session | ||
[percy] Percy is not running, disabling snapshots | ||
``` | ||
|
||
When running with [`percy | ||
exec`](https://github.com/percy/cli/tree/master/packages/cli-exec#percy-exec), and your project's | ||
`PERCY_TOKEN`, a new Percy build will be created and snapshots will be uploaded to your project. | ||
|
||
```sh-session | ||
$ 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 instance | ||
- `name` (**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 at | ||
- `minHeight` - The minimum viewport height to take screenshots at | ||
- `percyCSS` - Percy specific CSS only applied in Percy's rendering environment | ||
- `requestHeaders` - Headers that should be used during asset discovery | ||
- `enableJavaScript` - 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`](https://github.com/percy/cli/tree/master/packages/cli-config#percy-configmigrate-filepath-output) command: | ||
|
||
```sh-session | ||
$ percy config:migrate | ||
``` | ||
- Set your `PERCY_TOKEN` in the current env (you can get this in your Percy | ||
project settings) | ||
- Run your tests with `percy exec -- [test command]`: `npx percy exec -- python | ||
./tests.py` (or `yarn percy exec -- python ./tests.py`) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
httpretty==1.* | ||
pylint==2.* | ||
twine |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__author__ = 'Perceptual Inc.' | ||
__email__ = 'team@percy.io' | ||
__version__ = '0.1.3' | ||
|
||
from percy.snapshot import percySnapshot | ||
from percy.snapshot import percy_snapshot | ||
from percy.version import __version__ | ||
# for better backwards compatibility | ||
percySnapshot = percy_snapshot |
Oops, something went wrong.