Pytest-dependency between test scripts files

78 views Asked by At

Seen others saying it's impossible to use pytest-dependency between test scripts. But I tried an alternative to import and initialise other classes from different script files (Page_1 & Page_2) so I can use there methods as dependency for tests in this class. But does not seem to work for me. I get an error as indicated below. And this does not appear if I exclude the use of dependency fixtures:


import pytest
from pages_1 import Page_1
from pages_2 import Page_2
from pages_3 import Page_3

@pytest.mark.usefixtures("setup")
class TestPage3:

    @pytest.mark.dependency()
    def test_GetDependency(self):
        self.p1 = Page_1(self.driver)
        self.p2= Page_2(self.driver)

        self.p1.clickXButton()
    self.p2.scroll_down()
        self.p2.click_Y_Button()


    @pytest.mark.dependency(depends=["TestPage3::test_GetDependency"])
    def test_BuildCV_page(self):
        self.p3 = Page_3(self.driver)

        self.p3.click_Z_Button()
        self.p3.click_ZA_template2()

I get the error:

>       raise TimeoutException(message, screen, stacktrace)
E       selenium.common.exceptions.TimeoutException: Message: 
E       Stacktrace:

Trying to delete the __init__.py, as suggested by some, still does not work

0

There are 0 answers