I am struggling to see how can a use a variable inside a fixture that will be set inside a test. Let me show you with “code” what I mean:
Here is the fixture I want to use with useridentifier
and userpassword
my variables in the conftest.py file :
@pytest.fixture(scope="session")
def role_user(set_up,useridentifier,userpassword):
page = set_up
page.get_by_test_id("identifier").fill(useridentifier)
page.get_by_test_id("password").fill(userpassword)
page.get_by_test_id("submit").click()
yield page
and here the test function in my test_login.py file:
def test_login(role_user,"username","password") -> None:
page = role_user
expect(page.get_by_role("cell", name="Identifier")).to_be_visible()
How can I use identifier and password as variable?
New contributor
Nawel Mele is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1