Giter Site home page Giter Site logo

Comments (6)

mxschmitt avatar mxschmitt commented on May 23, 2024 3

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.

mxschmitt avatar mxschmitt commented on May 23, 2024 3

@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.

qupfer avatar qupfer commented on May 23, 2024

Thanks, that helps a lot.

from playwright-pytest.

arjunattam avatar arjunattam commented on May 23, 2024

Thanks! I'll re-frame this to update the docs with this example

from playwright-pytest.

algot avatar algot commented on May 23, 2024

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.

algot avatar algot commented on May 23, 2024

@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)

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.