示例#1
0
    def test_02_invalid_login(self):
        driver = self.driver  # Setup driver variable to self.driver so no need to type self.driver each time
        home = HomePage(
            driver
        )  # A variable for home, driver instance passed because this argument added to construction of LoginPage
        login = LoginPage(
            driver
        )  # A variable for login, driver instance passed because this argument added to construction of LoginPage

        home.click_customer_login_link()  # Click on Login link
        login.enter_email('*****@*****.**')  # Enter the email
        login.enter_password('Tester1234')  # Enter the password
        login.click_on_sign_in_button()  # Click on submit button
        assert 'Incorrect email or password.' in driver.page_source  # Verify error is shown
示例#2
0
    def test_01_valid_login(self):
        driver = self.driver  # Setup driver variable to self.driver so no need to type self.driver each time
        home = HomePage(
            driver
        )  # A variable for home, driver instance passed because this argument added to constructor of HomePage
        login = LoginPage(
            driver
        )  # A variable for login, driver instance passed because this argument added to constructor of LoginPage
        my_account = MyaccountPage(
            driver
        )  # A variable for my account, driver instance passed because this argument added to constructor of MyaccountPage

        home.click_customer_login_link()  # Click on Login link
        login.enter_email('*****@*****.**')  # Enter the email
        login.enter_password('Tester1234')  # Enter the password
        login.click_on_sign_in_button()  # Click on submit button
        self.assertEqual(
            my_account.get_section_header_text(),
            "My Account")  # Verify header of the page is My Account
        my_account.click_on_logout(
        )  # Need to sign out after this test for the next one