コード例 #1
0
ファイル: sign_in.py プロジェクト: vanillasky59/bza
class BZW_41(BaseTest):
    def test_register_new_user(self):
        global driver
        driver = StartBrowser().start()
        self.open_sign_in_page()
        self.verify_elements()
        self.click_to_website_logo()
        self.close_the_tab()
        self.check_remember_me_checkbox()
        self.uncheck_remember_me_checkbox()

    @step
    def open_sign_in_page(self):
        self.page = SignIn(driver)
        self.page.open()
        eq_(self.page.is_title(), True, "Incorrect title")

    @step
    def verify_elements(self):
        eq_(self.page.is_elem_present(SignIn.logo), True, "BlazeMeter logo is not displayed")
        eq_(self.page.is_elem_present(SignIn.sign_in_google_button), True,
            "'Sing in with Google' button is not displayed")
        eq_(self.page.is_elem_present(SignIn.help_block), True, "Information about using SAML is not displayed")
        eq_(self.page.is_elem_present(SignIn.email), True, "'Email' field is not displayed")
        eq_(self.page.is_elem_present(SignIn.password), True, "'Password' field is not displayed")
        eq_(self.page.is_elem_present(SignIn.sign_in_button), True, "'Sign in' button is not displayed")
        eq_(self.page.is_elem_present(SignIn.remember_me_checkbox), True, "'Remember me' checkbox is not displayed")
        eq_(self.page.is_elem_present(SignIn.forgot_password_link), True,
            "'Forgot your password' link is not displayed")

    @step
    def click_to_website_logo(self):
        self.ws_page = self.page.click_to_logo()
        eq_(self.ws_page.is_title(), True, "Failed to open website page. Incorrect title")

    @step
    def close_the_tab(self):
        self.page = self.ws_page.close_tab()
        eq_(self.page.is_title(), True, "Failed to close tab. Incorrect title")

    @step
    def check_remember_me_checkbox(self):
        eq_(self.page.check_remember_me_checkbox(True), True, "Failed to select 'Remember me' checkbox")

    @step
    def uncheck_remember_me_checkbox(self):
        eq_(self.page.check_remember_me_checkbox(False), True, "Failed to deselect 'Remember me' checkbox")
コード例 #2
0
ファイル: sign_in.py プロジェクト: vanillasky59/bza
class BZW_44(BaseTest):
    def test_login_logout(self):
        self.open_sign_in_page()
        self.type_username()
        self.type_password()
        self.remember_me_uncheck()
        self.click_sign_in()
        self.logout()

    @step
    def open_sign_in_page(self):
        self.page = SignIn(driver)
        self.page.open()
        eq_(self.page.is_title(), True, "Incorrect title")

    @step
    def type_username(self):
        self.page.type(SignIn.email, username)

    @step
    def type_password(self):
        self.page.type(SignIn.password, password)

    @step
    def remember_me_uncheck(self):
        eq_(self.page.check_remember_me_checkbox(False), True, "'Remember me' is checked")

    @step
    def click_sign_in(self):
        self.page = self.page.click_to_sign_in()
        welcome = Welcome(BasePage._driver)
        if self.page.get_url().__eq__(welcome.url_page()):
            eq_(self.page.is_elem_present(welcome.start_test_button), True,
                "Failed to login or 'Welcome' page is not displayed'")
            self.page = self.page.click_to_logo()
        eq_(self.page.is_elem_present(AppMain.profile_icon), True, "Failed to open application, problem with login")

    @step
    def logout(self):
        self.page = self.page.logout()
        eq_(self.page.is_title(), True, "User is not logout")

    def tearDown(self):
        driver.close()