Comments (6)
Hi, you can create a conftest.py
in your end-to-end test directory with the following content:
import pytest
@pytest.fixture(scope="session")
def browser_context_args(request):
return {"ignoreHTTPSErrors": True}
In your test then you can have:
def test_invalid_user_login(page):
login(page,username="invaliduser",password="validpassword")
# custom logic
Maybe we should document it how fixtures work in general with the conftest.py
usage.
from playwright-pytest.
@algot that should work:
import pytest
@pytest.fixture(scope="session")
def browser_type_launch_args(browser_type_launch_args):
return {**browser_type_launch_args, "args": ["--start-maximized"]}
from playwright-pytest.
Thanks, that helps a lot.
from playwright-pytest.
Thanks! I'll re-frame this to update the docs with this example
from playwright-pytest.
Maybe we should document it how fixtures work in general with the
conftest.py
usage.
It would be very helpful because it's not clear even if I was familiar with pytest fixtures
Also could you suggest how I could modify the start parameters to start chrome maximized?
In my current project I use chrome_options as parameters for webdriver init
chrome_options.add_argument('--start-maximized')
How can I do the same with playwright+pytest one?
from playwright-pytest.
@mxschmitt It works - browser opens maximized but viewport still have default size.
Is it expected behavior and I have to set viewport explicitly?
UPD. Only first test run opens browser maximized. All following runs open browser not maximized
from playwright-pytest.
Related Issues (20)
- [Feature] UI mode for Python/Pytest HOT 1
- [BUG] Can't run tests with multiple browsers when overriding page fixture
- [QUESTION] How to retrieve the version of a browser with playwright-pytest? HOT 3
- Inside pytest_playwright plugin browser_context_args() fixture is session scoped, but should be function scoped. HOT 4
- Change locale without launching a persistent contex HOT 2
- [BUG] Unable to set timezone_id or locale using pytest.mark fixture HOT 2
- Can't click or find elements on page without a slight pause/time.sleep() first HOT 5
- Rerunning skipped dependent test cases when a parent test fails HOT 1
- [BUG] Playwright fixture hangs on teardown with pytest-flask HOT 1
- Setting locale for a test affects the local for other tests HOT 1
- Coverage support HOT 1
- [BUG] Error when installing in Python 3.12 HOT 2
- Pytest.ini set --screenshot="only-on-failure" --video="retain-on-failure" Screenshots and recorded videos will also be generated after the use case is successfully executed.
- pytest-playwright--parameterization, cases order Not what I expected HOT 8
- playwright._impl._api_types.Error: net::ERR_CONNECTION_TIMED_OUT at https://www.google.com HOT 2
- [FEATURE] Support connecting to remote browsers HOT 1
- Request: `async` support HOT 4
- [FEATURE] Support pytest 8.x HOT 3
- [BUG]The execution sequence is incorrect when use parametrize HOT 1
- Request: extending `browser_type_launch_args` to work with `request`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playwright-pytest.