Giter Site home page Giter Site logo

Comments (3)

mxschmitt avatar mxschmitt commented on June 11, 2024
@pytest.fixture(scope="function")
def setup(page: Page, browser: Browser, browser_channel: Optional[str]):
    page.set_viewport_size({"width": 1920, "height": 1080})

    if browser_channel:
        allure.dynamic.feature(f"{browser_channel} {browser.version}") <- I want to add browser version in this feature
    else:
        allure.dynamic.feature(f"{browser.name} {browser.version}") <- I want to add browser version in this feature
    yield page

Something like that should work. For the viewport options I recommend to move them to our context options fixture: https://playwright.dev/python/docs/test-runners#ignore-https-errors

import pytest

@pytest.fixture(scope="session")
def browser_context_args(browser_context_args):
    return {
        **browser_context_args,
        "viewport": {"width": 1920, "height": 1080}
    }

from playwright-pytest.

win5923 avatar win5923 commented on June 11, 2024

thanks a lot.

from playwright-pytest.

win5923 avatar win5923 commented on June 11, 2024

@mxschmitt When I execute the following command, an error occurs.

pytest -n auto --headed --browser=firefox
    @pytest.fixture(scope="function")
    def setup(page: Page,browser: Browser, browser_channel: Optional[str]):
        page.goto("https://gdms.atmoxpress.com/en-us/home/landing/login")

        if browser_channel:
            allure.dynamic.feature(f"{browser_channel} {browser.version}")
        else:
>           allure.dynamic.feature(f"{browser.name} {browser.version}")
E           AttributeError: 'Browser' object has no attribute 'name'

conftest.py:17: AttributeError

browser.browser_type.name is work! 👍

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.