pytest-selenium icon indicating copy to clipboard operation
pytest-selenium copied to clipboard

Allow Session Scoping?

Open garethmj opened this issue 4 years ago • 0 comments

Hi there.

Driven by a need to perform a large number of regression tests on a legacy app by obtaining a cookie using Selenium and then essentially calling the app's API end-points to run actual tests I wanted to be able to have the Selenium fixture last the whole test session as it is by far the slowest part of any given test.

In order to achieve that I've implemented a CLI flag to make a dynamic scoping decision as allowed in pytest 5.2 or greater that changes the scope of the selenium fixture itself and all it's dependent fixtures that also need to be session scoped in order to avoid a function/session scope conflict.

I wasn't sure whether folks would feel that this is an appropriate change and, as such, didn't want to submit a PR directly to the repo without asking first.

To that end I've put up a PR on my fork of the repo to show what I've done so far: https://github.com/garethmj/pytest-selenium/pull/1

If you'd be happy, in principal, to accept a PR on this subject then I can submit a proper PR against this repo. I've run the tox tests locally and it looks good except Windows related stuff which I'm afraid I can't run at the moment.

Thanks very much in advance.

garethmj avatar Sep 06 '21 13:09 garethmj