percy / percy-selenium-python Goto Github PK
View Code? Open in Web Editor NEWPercy visual testing for Python Selenium
License: MIT License
Percy visual testing for Python Selenium
License: MIT License
just a heads up -- not a big deal but we stubbed our toe
percySnapshot
I guess is being kept for backwards compatibility
you might want to also have a signature transformation
def percySnapshot(browser, *a, **kw):
return percy_snapshot(driver=browser, *a, **kw)
or not... we just went straight to percy_snapshot(driver=...)
but might save someone else from hitting this if they are passing browser as a kwarg
Hi. Similar to GH-41, we observed a few problems, maybe also related to the package transition from percy
to percy-selenium
, and reported about them at earthobservations/wetterdienst#1017 (comment) ff.
We are observing this error 1, through dash.testing.composite
:
if self._percy_run:
> self.percy_runner = percy.Runner(
loader=percy.ResourceLoader(
webdriver=self.driver,
base_url="/assets",
root_dir=percy_assets_root,
)
)
E AttributeError: module 'percy' has no attribute 'Runner'
We have been able to mitigate it by installing percy
manually, after the regular package installation process, as a sort of a workaround, like outlined in earthobservations/wetterdienst@37a2424.
Did you ever see that kind of error on your end?
I decided to migrate from the deprecated package (percy=2.0.2
):
https://github.com/percy/python-percy-client
I installed percy-selenium~=1.1.0
.
First of all, it's not clear if the "percy" command should be installed by this package:
% percy config:migrate
zsh: command not found: percy
Second, it will be nice to have some explanations in docs on how to migrate from the older Python SDK.
For example, I would like to know how we can initialize and finalize builds inside our Django tests:
def test_regression(self):
root_static_dir = os.path.join(BASE_DIR, 'frontend/static/v2')
loader = percy.ResourceLoader(
root_dir=root_static_dir,
base_url='/static/v2',
webdriver=self.driver,
)
percy_config = percy.Config(default_widths=[1280, 320])
self.percy_runner = percy.Runner(loader=loader, config=percy_config)
self.percy_runner.initialize_build()
for url in self.urls:
self.driver.get(self.live_server_url + url)
time.sleep(1)
percy_snapshot(driver=self.driver, name=name, widths=[1280, 320])
self.percy_runner.finalize_build()
I don't see something similar to the older APIs: percy.ResourceLoader
, .initialize_build()
and .finalize_build()
.
meta-data in setup.py says compatible with python 3.6, 3.7, 3.8, 3.9
however, you added a dependency on functools.cache here: 2934f12
this makes import break in anything before python 3.9
recommend either:
1- update meta-data to accurately say compatible only with 3.9+
2- use functools.lru_cache (this is probably better anyway because .cache is unbounded)
also, you might want to consider adding tox to your CI https://tox.readthedocs.io/en/latest/ so build are validated against multiple versions of python
Right now there's not really a way to know that a call to percySnapshot
succeeds in the test run.
I think that a default behaviour of failing when the connection fails would make things easier to debug in general
Hey,
after following the steps to setup, I get the following error when trying to run the test:
ImportError: cannot import name 'percySnapshot' from 'percy' (/Users/***/PycharmProjects/test3/lib/python3.7/site-packages/percy/init.py)
Tried to run it with command:
npx percy exec -- python mytest.py
Any idea how to solve it?
Thanks for your help.
In the envInfo
function it assumes that a browserVersion
key
is available on the webdriver.capabilities
dict. When using the Chrome webdriver browserVersion
is not available.
While the code does use dict.get
to, I assume, avoid a KeyError exception. It does not properly handle the case in which dict.get
does not find the requested key and returns the default None
. What ends up happening when using Chrome is you get a vague error from the code trying to concatenate None
to a string. Would have been better to just use the standard dict get item method (dict[key]
) and get the key error.
It would be nice if you could fix this specific issue, but to help find/avoid other issues it would be good if you could test against the chrome webdriver in addition to firefox.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.