Giter Site home page Giter Site logo

percy-selenium-python's Issues

percySnapshot(browser=...) changed to percySnapshot(driver=...)

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

AttributeError: module 'percy' has no attribute 'Runner'

About

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.

Details

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?

Footnotes

  1. https://github.com/earthobservations/wetterdienst/actions/runs/6354438040/job/17260902996?pr=1017#step:8:875 โ†ฉ

Migration process from the deprecated "percy" python package is not clear

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().

functools.cache is only available on python 3.9

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

percySnapshot fails silently

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

ImportError: cannot import name 'percySnapshot' from 'percy'

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.

Broken support for Selenium Chrome Webdriver

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.