def setUp(self): global driver, data data = GetValue() browser = GetPath(data.getvalue('driver')) driver = webdriver.Chrome(browser.get_filePath()) user = Login(driver) user.login(data.getvalue('address'), data.getvalue('account'), data.getvalue('password'))
def test_userLogin(self): self.login = Login() user = '******' password = '******' self.login.login_as(user, password) welcome_message = self.login.auth_message() self.assertIn("Welcome back", welcome_message.text) self.login.quit()
def login_page(getBrowser, getData): browser = getBrowser browser.get(getData['url']) browser.implicitly_wait(10) homepage = HomePage(browser) home_login = homepage.login() login = Login(home_login) login.login(getData['email'], getData['password']) return browser
def test_loginFail(self): self.login = Login() user = '******' password = '******' self.login.login_as(user, password) message = self.login.auth_message() self.assertIn("Account not found", message.text) sel.login.register_link() header = self.login.get_header() self.assertIn("Create an Account", header.text)
def test_empty_credentials(self, test_setup): """ This method checks invalid credentials when trying to login with empty credentials :param test_setup: Connection between device under test (DUT) and Appium :return: boolean """ home = Home(test_setup) home.goto_login_page() login = Login(test_setup) login.click_login() message = login.get_error_message() assert message == constants.credentials['error_message'], "Unexpected message for wrong credentials"
def test_cancel_button(self, test_setup): """ This method tests if Cancel button returns to previous page :param test_setup: Connection between device under test (DUT) and Appium :return: boolean """ home = Home(test_setup) home.goto_login_page() login = Login(test_setup) login.click_cancel() is_in_screen = login.is_in_login_screen() assert is_in_screen, "Did not cancel login screen"
def setUp(): self.login = Login() self.homepage = HomePage() self.timelinepage = Timelinepage() self.mypage = MyPage() self.personalinfopage = PersonalInformationPage() self.addshippingpage = AddShippingPage() self.shippingaddresspage = ShippingAddresspage()
def test_invalid_credentials(self, test_setup): """ This method tests if it is possible to login using invalid credentials :param test_setup: Connection between device under test (DUT) and Appium :return: boolean """ home = Home(test_setup) home.goto_login_page() login = Login(test_setup) login.insert_username(constants.credentials['invalid_username']) login.insert_password(constants.credentials['invalid_password']) login.click_login() message = login.get_error_message() assert message == constants.credentials['error_message'], "Unexpected message for wrong credentials"
def test_login_logout(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_page() login_page = Login(mozwebqa) Assert.true(login_page.is_the_current_page) login_page.click_login() login_page.login(user='******') Assert.true(home_page.is_the_current_page) Assert.true(home_page.header.is_user_logged_in) Assert.equal(mozwebqa.credentials['default']['email'], home_page.header.user_account) login_page = home_page.header.sing_out() Assert.true(login_page.is_the_current_page) Assert.true(login_page.is_login_visible)
def test_launch_url(self, testcase): """tests login page""" sleep(2.5) obj = Login(self.driver, testcase) # pylint:disable=E1101 # self.driver.implicitly_wait(5) sleep(2.5) obj.enter_username() sleep(2.5) obj.enter_password() sleep(2.5) obj.click_login() sleep(2.5)
def test_valid_login(self, test_setup): """ This method tests a happy happy, trying to login if valid credentials :param test_setup: Connection between device under test (DUT) and Appium :return: boolean """ home = Home(test_setup) home.goto_login_page() login = Login(test_setup) login.insert_username(constants.credentials['valid_username']) login.insert_password(constants.credentials['valid_password_for_valid_username']) login.click_login() is_logged = login.is_logged() if is_logged: assert True else: assert False
def test_create_new_ticket( self, requested_by, configuration_item, affected_user, location, category, subcategory, state, substate, source, business_critical, priority, assignment_group, assigned_to, short_description, description, additional_comment, work_notes, secure_notes, source_ip, destination_ip, other_ioc, malware_url, referrer_url): login_page = Login(self.driver) homepage = login_page.login('admin', 'admin') all_incidents_page = homepage.click_security_incident_all_button() print("Before: " + all_incidents_page.get_total_rows()) new_ticket_page = all_incidents_page.click_new_button() new_ticket_page.set_requested_by(requested_by) new_ticket_page.set_configuration_item(configuration_item) new_ticket_page.set_affected_user(affected_user) new_ticket_page.set_location(location) new_ticket_page.set_category(category) new_ticket_page.set_subcategory(subcategory) new_ticket_page.set_state(state) new_ticket_page.set_substate(substate) new_ticket_page.set_source(source) # new_ticket_page.set_business_critical(business_critical) # new_ticket_page.set_priority(priority) new_ticket_page.set_assignment_group(assignment_group) new_ticket_page.set_assign_to(assigned_to) new_ticket_page.set_short_description(short_description) new_ticket_page.set_description(description) new_ticket_page.set_destination_ip(destination_ip) new_ticket_page.set_other_ioc(other_ioc) new_ticket_page.set_additional_comment(additional_comment) new_ticket_page.set_work_notes(work_notes) new_ticket_page.set_secure_notes(secure_notes) new_ticket_page.set_source_ip(source_ip) new_ticket_page.set_malware_url(malware_url) new_ticket_page.set_referrer_url(referrer_url) new_ticket_page.click_submit_button() print("After: " + all_incidents_page.get_total_rows())
def test_valid_wrong_login(self, set_up): with open('./data/credentials.json', 'r') as json_data: for i in json.load(json_data): self.username = i['username'] self.password = i['wrongPassword'] home = Home(set_up) home.open_login_small_window() login = Login(set_up) login.enter_credentials(self.username, self.password) login.check_wrong_login()
class LoginTestCase(unittest.TestCase): def test_userLogin(self): self.login = Login() user = '******' password = '******' self.login.login_as(user, password) welcome_message = self.login.auth_message() self.assertIn("Welcome back", welcome_message.text) self.login.quit() def test_loginFail(self): self.login = Login() user = '******' password = '******' self.login.login_as(user, password) message = self.login.auth_message() self.assertIn("Account not found", message.text) sel.login.register_link() header = self.login.get_header() self.assertIn("Create an Account", header.text)
def test_creating_a_new_user_logging_in_and_logingout(self, mozwebqa): home_page = Home(mozwebqa) home_page.go_to_page() login_page = Login(mozwebqa) Assert.true(login_page.is_the_current_page) new_user = login_page.create_new_user() login_page.click_login() login_page.login(user=new_user) Assert.true(home_page.is_the_current_page) Assert.true(home_page.header.is_user_logged_in) Assert.equal(new_user['email'], home_page.header.user_account) login_page = home_page.header.sing_out() Assert.true(login_page.is_the_current_page) Assert.true(login_page.is_login_visible)
def setup(self): self.login = Login() self.room_status = Room_Status()
def setup_class(cls): super().setup_class(cls) cls.loginPage = Login(cls.driver).get() cls.loginPage.make_login()
def login_page(base_url, selenium, hostname): """Launch Lockbox.""" selenium.get('moz-extension://{}/firstrun/index.html'.format(hostname)) return Login(selenium, base_url).wait_for_page_to_load()
def step_impl(context): assert Login(context.browser).is_present()
def step_impl(context): email = context.config.AskerAccount.EMAIL password = context.config.AskerAccount.PASSWORD Login(context.browser).login(email, password)
def test_wrong_credentials_msg(self): login = Login(self.driver) login.open() login._validate_page(self.driver) login.username_input('test333') login.password_input('test333') login.submit_form() login.wait_for_wrong_credentials_msg() current_url = self.driver.current_url self.assertTrue( login._login_url == current_url, 'expected current url to be: %s found %s instead' % (Home._home_url, current_url))
def test_login_user(self): login = Login(self.driver) login.open() login._validate_page(self.driver) login.username_input('test') login.password_input('test') login.submit_form() login.wait_for_logout_btn() current_url = self.driver.current_url self.assertTrue( Home._home_url == current_url, 'expected current url to be: %s found %s instead' % (Home._home_url, current_url))
class TestLogin(BaseClass): log = cl.custom_logger() @pytest.fixture(autouse=True) # loading all the objects in the test class def objectsetup(self, setup): self.log.info("Setting up the objects") self.lp = Login(self.driver) self.ts = StatusTest(self.driver) # Checks if the Mandara page has loaded by verifying the availability of the logo. def test_mandara_app_load(self): self.log.info("Verifying if the Mandara App loaded") result = self.lp.verify_mandara_app_load() self.ts.markFinal("Mandara app load verification", result, "Verification of Mandara load with logo appearance") # Verifies the title of the loaded Mandara Page def test_title(self): self.log.info("Checking the title of the Mandara login Page") result1 = self.lp.verify_login_page_title(td.page_title) self.ts.markFinal("Page title", result1, "Verification of the Page Title") # Verifies the copyright info with the current year def test_copyright(self): self.log.info("Checking the copyright presence and year correctness") result = self.lp.copyright() self.ts.markFinal("Copyright Info", result, "Verification of the presence and year correctness for copyright") # Verifies the text in the username field, password field, and the text in the buttons of login page def test_text(self): self.log.info("Verification of the text available in the buttons") result1 = self.lp.verify_username_text() result2 = self.lp.verify_password_text() result3 = self.lp.verify_fgt_pwd_text() result4 = self.lp.verify_login_text() self.ts.mark(result1, "Verifying the text in the username field") self.ts.mark(result2, "Verifying the text in the password field") self.ts.mark(result3, "Verifying the text in the forgot_password button") self.ts.markFinal("Verifying the text in the Login page", result4, "Verification of all text in login button") # Verifies the input alert for username and password when clicked and no data is entered def test_login_input_field_alert(self): self.log.info("Checking the alert messages for the username and password") result1 = self.lp.username_input_alert() result2 = self.lp.password_input_alert() self.ts.mark(result1, "Verifying the username input alert when no text is given") self.ts.markFinal( "Login page alert message check", result2, "Verifying the username input alert when no text is given" ) # Verifies the login button being disabled when no value is entered in both username and password fields def test_login_button_disabled(self): self.log.info("Verifying if the login button is disabled when no value is entered to both login fields") result = self.lp.verify_disabled_login_button() self.ts.markFinal("Login button disable check", result, "Verifying disabled login button on start") # Verifies the invalid log with wrong username def test_invalid_login_user(self): self.log.info("Verifying Invalid login with wrong username") self.lp.login(td.wrongusername, td.password) result2 = self.lp.verify_login_failed() self.ts.markFinal("Invalid Login", result2, "Verification of Invalid Login with wrong username") # Verifies the invalid log with wrong password def test_invalid_login_pass(self): self.log.info("Verifying Invalid login with wrong password") self.lp.login(td.username, td.wrongpassword) result2 = self.lp.verify_login_failed() self.ts.markFinal("Invalid Login", result2, "Verification of Invalid Login with wrong password") # Verifies the forgot password feature def test_forgotpassword(self): result3 = self.lp.verify_enter_valid_email() result4 = self.lp.forgot_password_invalid(td.wrongemail) result5 = self.lp.forgot_password_valid(td.email) self.ts.mark(result3, "Checking valid Email message") self.ts.mark(result4, "Sending wrong Email and verifying the error thrown") self.ts.markFinal("Valid Email check", result5, "Verification of forgot password feature") # Verifies the text for the buttons in the forgot password page. def reset_pwd_page_text(self): result1 = self.lp.verify_back_to_login_text() result2 = self.lp.verify_reset_text() self.ts.mark(result1, "Verification of back_to_login_text") self.ts.markFinal("Verification of text in reset password field", result2, "Verification of reset password text ") # Verifies the presence and functionality of the "back to login" feature def test_back_to_login(self): result1 = self.lp.presence_back_to_login() result2 = self.lp.back_to_login() self.ts.mark(result1, "Verifying the presence of back to login button") self.ts.markFinal("Back to login", result2, "Verification of back to login button") # Verifies the valid login def test_valid_login(self): self.lp.login(td.username, td.password) result3 = self.lp.verify_login_success() self.ts.markFinal("Valid Login", result3, "Verification of Valid Login")
def objectsetup(self, setup): self.log.info("Setting up the objects") self.lp = Login(self.driver) self.ts = StatusTest(self.driver)
def login(): _login = Login(driver=local_driver) return _login.login()
def setup_class(cls): super().setup_class(cls) cls.loginpage = Login(cls.driver).get() cls.loginpage.make_login() cls.classpage = ClassMenu(cls.driver).get()
def test_business_case(self, username = None, password = None): #登录网贷平台 Login(self.web_element_util).login(username, password) #其他业务步骤,待补充+ return False
def sing_out(self): self.selenium.find_element(*self._sing_out_locator).click() from pages.login import Login return Login(self.testsetup)
def setUp(self): self.driver = browser() self.driver.get(config.test_url) self.login = Login(self.driver) #page
def test_login_user(self): login = Login(self.driver) login.open() login._validate_page(self.driver) login.username_input('test') login.password_input('test') login.submit_form() login.wait_for_logout_btn() current_url = self.driver.current_url self.assertTrue(Home._home_url==current_url, 'expected current url to be: %s found %s instead'%(Home._home_url, current_url))
def test_02_login_validation(self): login = Login(self.driver, self.conf, self.locators) login.open_url(login.get_current_url() + 'login') login.wait_page_loaded() login.select_login() el = login.get_validation_error() self.assertEqual(el.text, 'Please enter login name.') login.enter_user_name('user') login.select_login() el = login.get_validation_error() self.assertEqual(el.text, 'Please enter a password.')
def test_wrong_credentials_msg(self): login = Login(self.driver) login.open() login._validate_page(self.driver) login.username_input('test333') login.password_input('test333') login.submit_form() login.wait_for_wrong_credentials_msg() current_url = self.driver.current_url self.assertTrue(login._login_url==current_url, 'expected current url to be: %s found %s instead'%(Home._home_url, current_url))