Beispiel #1
0
def test_verify_login_with_valid_details(browser):
    login = LoginPage(browser)

    login.load()
    login.click_signIn_link()
    login.enter_email(utils.email)
    login.enter_password(utils.password)
    login.click_signIn_button()
    def test_login(self):
        try:
            driver = self.driver

            home = HomePage(driver)
            home.click_myacc_btn()
            home.click_login()

            login = LoginPage(driver)
            login.enter_email(utils.LogEMAIL)
            login.enter_pwd(utils.PWD)
            driver.implicitly_wait(10)
            login.click_login()
            driver.implicitly_wait(10)

            assert "My Account" in driver.title
            print("Login successful")
            account = AccountPage(driver)
            account.click_logout()

        except AssertionError as error:
            print("There was an exception error\n")
            print(error)

            currTime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testName = utils.whoami()

            screenshotName = testName + "_" + currTime

            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshotName,
                          attachment_type=allure.attachment_type.PNG)

            driver.get_screenshot_as_file(
                "/Users/sharathsarangmath/Desktop/Test_Automation_Projects/New_Automation/screenshots/"
                + screenshotName + ".png")
            raise

        except:
            print("Some exception occured")
        else:
            print("No exception occured")
        finally:
            print("Final block")