예제 #1
0
    def testName(self):
        # Define PageObjects
        wp = WaitForPageLoad(self.browser)
        lg = LoginPage(self.browser)
        oc = OnlineCoursesPage(self.browser)
        wbd = WebDevelopmentPage(self.browser)
        se = SeleniumPage(self.browser)

        lg.login(self.browser, self.EMAIL, self.PASSWORD)
        wp.old_page_loaded_()
        wp.wait_for_page_redirect()
        oc.selectwebdevelopmentfromcategories(self.browser)
        wp.wait_for_page_redirect()
        # WebDevelopment Search Selenium Courses
        wbd.seleniumsearch(self.browser)
        wp.wait_for_page_redirect()
        free_courses = se.search4freecourses(self.browser)
        assert free_courses > 2 and free_courses < 10
        # Verify Selenium word in courses and all are Free
        [selenium_list, free_list] = se.selenium_free_list(self.browser)
        for i in range(0, len(free_list)):
            if free_list[i] != self.FREE:
                assert False
        name_list_splitted = " ".join(selenium_list).split()
        keyword_list = [self.SELENIUM]
        if any(word in name_list_splitted for word in keyword_list):
            assert True
        else:
            assert False
        pass
예제 #2
0
 def setup_method(self):
     self.driver = webdriver.Chrome(
         executable_path=ChromeDriverManager().install())
     self.login_page = LoginPage(self.driver)
     self.issue_page = IssuePage(self.driver)
     self.login_page.open(my_issues)
     self.login_page.login_to_jira(creds, creds)
예제 #3
0
 def test_login(self):
     login_page = LoginPage(self.driver)
     login_page.login('18410078814','123456')
     time.sleep(5)
     try:
         assert 'home' in login_page.get_page_url()
         logger.info('login sucess.')
     except Exception as e:
         logger.error('login Fail.%s', format(e))
예제 #4
0
class TestLoginDDT_001:

    baseURL=ReadConfig.get_base_URL()
    logger=LogGen.log_gen()
    Datapath="./testdata/TestDataManagerLogin.xlsx"

    def test_login_ddt(self,setup):
        self.logger.info("****** TestLoginDDT_001 started ******")
        self.logger.info("****** verifying login ddt test ******")
        self.driver=setup
        self.driver.get(self.baseURL)

        self.lp=LoginPage(self.driver)
        self.rows=XLUties.get_row_count(self.Datapath,"Sheet1")
        print("Number of rows in Excel Data ",self.rows)

        lst_status=[]
        for r in range(2,self.rows+1):
            self.username=XLUties.read_data(self.Datapath,"Sheet1",r,1)
            self.password=XLUties.read_data(self.Datapath,"Sheet1",r,2)
            self.exp=XLUties.read_data(self.Datapath, "Sheet1",r,3)

            self.lp.set_user_id(self.username)
            self.lp.set_password(self.password)
            self.lp.click_on_login()
            actual_title=self.driver.title
            expected_title="Guru99 Bank Manager HomePage"
            if actual_title==expected_title:
                if self.exp=="Pass":
                    self.logger.info("------Passed------")
                    self.lp.click_on_logout()
                    self.driver.switch_to.alert.accept()
                    lst_status.append("Pass")
                elif self.exp=="Fail":
                    self.logger.info("------Failed------")
                    self.lp.click_on_logout()
                    time.sleep(5)
                    self.driver.switch_to.alertaccept()
                    lst_status.append("Fail")
            elif actual_title!=expected_title:
                if self.exp=="Pass":
                    self.logger.info("------Failed------")
                    lst_status.append("Fail")
                elif self.exp=="Fail":
                    self.logger.info("------Passed------")
                    lst_status.append("Pass")
        if "Fail" not in lst_status:
            self.logger.info("****** TestLoginDDT_001 Passed ******")
            self.driver.close()
            assert True
        else:
            self.logger.info("****** TestLoginDDT_001 Failed ******")
            self.driver.close()
            assert False
        self.logger.info("****** End of login DDT test ******")
        self.logger.info("**************** complete test login DDT ********************")
예제 #5
0
 def test_login(self):
     login_page = LoginPage(self.driver)
     login_page.type_login_name('superadmin')
     login_page.type_password('123456')
     login_page.click_login_btn()
     try:
         assert '待办事项' in login_page.get_page_title()  # 调用页面对象继承基类中的获取页面标题方法
         print ('Test Pass.')
     except Exception as e:
         print ('Test Fail.', format(e))
예제 #6
0
 def test_login_success(self):
     LoginPage(self.driver).login('18684720553', 'python')
     # 判断登陆页面的一个元素存在
     WebDriverWait(self.driver, 30).until(
         EC.visibility_of_element_located(
             (By.XPATH, '//*[contains(text(),"我的帐户")]')))
     #判断页面的url发生跳转
     self.assertEqual(self.driver.current_url,
                      'http://120.78.128.25:8765/Index/index')
예제 #7
0
 def setUp(self):
     do_log.info("开始执行发送邮件的用例".center(100, "#"))
     self.driver = webdriver.Chrome()
     self.driver.maximize_window()
     self.driver.get(do_config.get_value("project_url", "url"))
     LoginPage(self.driver).login_in(login_data["username"], login_data["password"])
     self.sm = SendMailPage(self.driver)
     self.hp = HomePage(self.driver)
     self.rmp = ReceiveMailPage(self.driver)
예제 #8
0
    def test_login_ddt(self,setup, user, pwd, expected):
        self.logger.info("**************" + Test002LoginTestDDT.__name__ + "*************")
        self.logger.info("************** Verify Home Page title *************")
        self.login_page = LoginPage(setup)

        self.logger.info(f"Username : {user}")
        self.logger.info(f"password : {pwd}")
        self.logger.info(f"expected : {expected}")
        status_list = list()
        self.login_page.set_username(user)
        self.login_page.set_password(pwd)
        self.login_page.click_login()
        time.sleep(5)
        title = self.login_page.get_login_page_title()
        exp_title = "Dashboard / nopCommerce administration"
        if title == exp_title:
            if expected == 'pass':
                self.logger.info("*********passed***********")
                self.login_page.click_logout()
                status_list.append("pass")
            elif expected == 'fail':
                self.logger.info("*******failed*********")
                self.login_page.click_logout()
                status_list.append("fail")
        elif title != exp_title:
            if expected == 'fail':
                self.logger.info("*********passed***********")
                status_list.append("pass")
            elif expected == 'pass':
                self.logger.info("*********failed***********")
                status_list.append("fail")
        if 'fail' not in status_list:
            self.logger.info("********* Login DDT is passed***********")
            assert True
        else:
            self.logger.info("********* Login DDT is failed***********")
            assert False

        self.logger.info("************** Completed " + Test002LoginTestDDT.__name__ + "*************")
def test_get_user_name(web_driver, designed_caps, is_sauce_labs):
    is_mobile = designed_caps['isMobile']
    driver = web_driver(is_sauce_labs, designed_caps['isMobile'],
                        designed_caps['platformName'],
                        designed_caps['browserName'],
                        designed_caps['deviceName'])
    user = USERS['tuyen']
    # 1. Login
    login_page = LoginPage(driver)
    login_page.navigate_login_page()
    login_page.input_user_email(user['email'])
    login_page.input_user_password(user['password'])
    login_page.click_login_button()
    # 2. Navigate to view profile page
    home_page = HomePage(driver)
    home_page.click_on_menu_list(is_mobile=is_mobile)
    home_page.click_view_profile_option(is_mobile=is_mobile)
    # 3. Get user name
    profile_page = ProfilePage(driver)
    actual_user_name = profile_page.get_user_full_name()
    assert_that(actual_user_name, equal_to('Tuyen Nguyen'),
                'Verify the user name')
예제 #10
0
    def test_login(self, setup):
        self.log.info("------ verifyin login test ------")
        self.driver = setup
        self.driver.get(self.base_url)
        self.log.info("--- application launched...")
        self.lp = LoginPage(self.driver)
        self.lp.set_user_id(self.user_name)
        self.log.info("--- user id Entered : " + self.user_name)
        self.lp.set_password(self.password)
        self.log.info("--- password Entered : " + self.password)
        self.lp.click_on_login()
        self.log.info("--- clicked on login")
        self.msg = self.driver.find_element_by_xpath("//body").text

        #if self.msg == "Manger Id : mngr285385":
        if "Manger Id :" + " " + self.user_name in self.msg:
            assert True
            self.log.info("------ login test is passed ------")
            self.driver.close()
        else:
            self.driver.save_screenshot(".\\screenshots\\" + "test_login.png")
            self.driver.close()
            self.log.error("------ login test is failed")
            assert False
예제 #11
0
class TestLogin(unittest.TestCase):
    """
    测试登录
    """
    def setUp(self):
        do_log.info("开始执行登录的用例".center(40, "#"))
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.driver.get(do_config.get_value("project_url", "url"))
        self.lg = LoginPage(self.driver)

    def tearDown(self):
        self.driver.close()
        do_log.info("结束执行登录的用例".center(40, "#"))

    def test_01_login_success(self):
        self.lg.login_in(login_data["username"], login_data["password"])
        self.assertTrue(self.lg.verify_login_whether_success(), msg="用例执行失败")

    @data(*ld.login_exception_data)
    def test_02_login_failed(self, data):
        self.lg.login_in(data["username"], data["password"])
        text = self.lg.get_except_msg()
        self.assertIn(data["verify_msg"], str(text), msg="用例执行失败")
예제 #12
0
    def test_mainland_login(self):
        # 登陆
        loginpage = LoginPage(self.driver)
        loginpage.click_login_btn()
        loginpage.login(username, password)
        logger.info('登陆成功')

        # 信息编辑
        infofill = InfoFill(self.driver)
        infofill.message_edit('测试', '测试', username)

        # 搜索筛选
        searchfilter = SearchFilter(self.driver)
        searchfilter.search('葡萄酒')
        searchfilter.filter()

        # 现货购买流程
        goodsprompt = GoodsPrompt(self.driver)
        goodsprompt.navbox_buy()

        # 期酒购买流程
        primeur = Primeur(self.driver)
        primeur.primeur_buy('*****@*****.**')
        primeur.primeur_search('葡萄')
 def test_login_2_incorrect_account(self):
     logger.info(u'Test login with incorrect account.')
     login_page = LoginPage(self.driver)
     login_page.sleep(2)
     login_page.input_email('*****@*****.**')
     login_page.sleep(2)
     login_page.input_pwd('kiwi888zx')
     login_page.sleep(2)
     login_page.sign_in()
     login_page.sleep(2)
     try:
         self.assertEqual(u'该账号不存在,请注册', login_page.get_tips_info())
         logger.info('账号未曾注册')
     except Exception as e:
         logger.error(u'错误提示不正确, 请检查页面是否更新:%s' % format(e))
예제 #14
0
class TestLogin:
    def setup_method(self):
        self.driver = webdriver.Chrome(
            executable_path=ChromeDriverManager().install())
        self.login_page = LoginPage(self.driver)

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Check title")
    def test_check_title(self):
        self.login_page.open(auth_url)
        assert self.login_page.get_title() == login_title

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Login with wrong password")
    def test_login_with_wrong_password(self):
        self.login_page.open(auth_url)
        self.login_page.login_to_jira(creds, fake_creds)
        assert self.login_page.get_title() == login_title

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Login with wrong username")
    def test_login_with_wrong_username(self):
        self.login_page.open(auth_url)
        self.login_page.login_to_jira(creds, fake_creds)
        assert self.login_page.get_title() == login_title

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Login with correct credentials")
    def test_login_with_correct_credentials(self):
        self.login_page.open(auth_url)
        self.login_page.login_to_jira(creds, creds)
        assert self.login_page.on_page() is True

    def teardown_method(self):
        self.driver.close()
예제 #15
0
 def setup_method(self):
     self.driver = webdriver.Chrome(
         executable_path=ChromeDriverManager().install())
     self.login_page = LoginPage(self.driver)
예제 #16
0
 def test_login_success(self):
     LoginPage(self.driver).login(login_success_data['user'],login_success_data['password'])
     self.assertEqual(login_success_data['check'],self.driver.current_url)
예제 #17
0
 def test_login_failed_with_unrigister_mobile(self):
     LoginPage(self.driver).login("18392628362",'python1')
     self.assertEqual("此账号没有经过授权,请联系管理员!",LoginPage(self.driver).get_middlepage_area_error_message())
예제 #18
0
 def test_login_fail_form_error(self,data):
     LoginPage(self.driver).login(data["user"],data["password"])
     self.assertEqual(data["check"],LoginPage(self.driver).get_form_area_error_message())
예제 #19
0
 def test_login_fail_middle_error(self,user,password,check):
     LoginPage(self.driver).login(user,password)
     self.assertEqual(check,LoginPage(self.driver).get_middlepage_area_error_message())
예제 #20
0
class TestCreateIssue:
    def setup_method(self):
        self.driver = webdriver.Chrome(
            executable_path=ChromeDriverManager().install())
        self.login_page = LoginPage(self.driver)
        self.issue_page = IssuePage(self.driver)
        self.login_page.open(my_issues)
        self.login_page.login_to_jira(creds, creds)

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Create issue")
    def test_create_issue(self):
        assert self.issue_page.create_issue("OA_new_issue", "Blocker",
                                            "OlegAverkin") is True

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Verify created issue")
    def test_verify_created_issue(self):
        self.issue_page.open_issue_in_list("OA_new_issue")
        assert self.issue_page.get_issue_fields() == [
            "OA_new_issue", "Blocker"
        ]

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Create issue with long summary")
    def test_create_issue_with_long_summary(self):
        assert self.issue_page.create_issue("x" * 256, "Blocker",
                                            "OlegAverkin") is False

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Vreate issue with empty summary")
    def test_create_issue_with_empty_summary(self):
        assert self.issue_page.create_issue("", "Blocker", "OlegAverkin",
                                            True) is False

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Search issue")
    def test_search_issue(self):
        assert self.issue_page.search_issues("OA_new_issue") == 1

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Search nonexistent issue")
    def test_search_nonexistent_issue(self):
        assert self.issue_page.search_nonexistent_issues("somethingwrong") == 0

    @pytest.mark.ui
    @allure.tag('ui')
    @allure.title("Update issue")
    def test_update_issue(self):
        self.issue_page.open_issue_in_list("OA_new_issue")
        assert self.issue_page.update_issue("OA_updated_issue", "Low",
                                            "OlegAverkin") is True

    def teardown_method(self):
        self.driver.close()
예제 #21
0
def step_impl(context):
    context.login_page = LoginPage().go_to()
 def test_login_5_correct_account(self):
     login_page = LoginPage(self.driver)
     login_page.sleep(2)
     login_page.input_email('*****@*****.**')
     login_page.sleep(2)
     login_page.input_pwd('kiwi888zx')
     login_page.sleep(2)
     login_page.sign_in()
     login_page.sleep(5)
     try:
         self.assertIn(u"移动应用安全平台", login_page.get_page_title())
         logger.info('sign in successfully')
     except Exception as e:
         logger.error('sign in failed, %s' % format(e))
예제 #23
0
class Test_Login_001:

    base_url = ReadConfig.get_base_URL()
    user_name = ReadConfig.get_user_name()
    password = ReadConfig.get_password()
    log = LogGen.log_gen()

    @pytest.mark.smoke
    def test_open_browser(self, setup):
        self.log.info("------Open browser test------")
        self.driver = setup
        self.driver.get(self.base_url)
        actual_url = self.driver.current_url
        if actual_url == "http://demo.guru99.com/V4/":
            assert True
            self.log.info("------ open browser test passed ------")
            self.driver.close()
        else:
            self.driver.save_screenshot("../screenshots/" +
                                        'test_homepage_title.png')
            self.driver.close()
            self.log.error("------ open browser test failed ------")
            assert False

    @pytest.mark.smoke
    def test_home_page_title(self, setup):
        self.log.info("------ test login 001 -------")
        self.log.info("------ verifying homepage title ------")
        self.driver = setup
        self.driver.get(self.base_url)
        time.sleep(5)
        actual_title = self.driver.title
        if actual_title == "Guru99 Bank Home Page":
            assert True
            self.driver.close()
            self.log.info("------ home page title test is passed ------")
        else:
            self.driver.save_screenshot("../screenshots/" +
                                        'test_homepage_title.png')
            self.driver.close()
            self.log.error("------ home page title test is failed ------")
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.log.info("------ verifyin login test ------")
        self.driver = setup
        self.driver.get(self.base_url)
        self.log.info("--- application launched...")
        self.lp = LoginPage(self.driver)
        self.lp.set_user_id(self.user_name)
        self.log.info("--- user id Entered : " + self.user_name)
        self.lp.set_password(self.password)
        self.log.info("--- password Entered : " + self.password)
        self.lp.click_on_login()
        self.log.info("--- clicked on login")
        self.msg = self.driver.find_element_by_xpath("//body").text

        #if self.msg == "Manger Id : mngr285385":
        if "Manger Id :" + " " + self.user_name in self.msg:
            assert True
            self.log.info("------ login test is passed ------")
            self.driver.close()
        else:
            self.driver.save_screenshot(".\\screenshots\\" + "test_login.png")
            self.driver.close()
            self.log.error("------ login test is failed")
            assert False
def click_commit_button(context):
    LoginPage(context.driver).go_to_login_page(constants.LOGIN_PAGE["LOGIN_COMMIT_BUTTON"])
def enter_user_email(context, email):
    LoginPage(context.driver).input_user_email(constants.LOGIN_PAGE["USER_EMAIL"], email)
 def test_login_1_empty_email_pwd(self):
     logger.info("Test login without email and pwd.")
     login_page = LoginPage(self.driver)
     login_page.sleep(2)
     login_page.clear_email()
     login_page.clear_pwd()
     login_page.sleep(2)
     login_page.sign_in()
     try:
         self.assertEqual(u'请输入邮箱或手机号码', login_page.get_email_error())
         logger.info(u'未输入账号')
         self.assertEqual(u'请输入登录密码', login_page.get_pwd_error())
         logger.info(u'未输入密码')
     except Exception as e:
         logger.error(u'错误提示不正确,请检查页面是否更新: %s。' % format(e))
def enter_user_password(context, password):
    LoginPage(context.driver).input_user_password(constants.LOGIN_PAGE["USER_PASSWORD"], password)
 def test_login_3_incorrect_pwd(self):
     logger.info(u'Test login with incorrect password')
     login_page = LoginPage(self.driver)
     login_page.sleep(2)
     login_page.input_email('*****@*****.**')
     login_page.sleep(2)
     login_page.input_pwd('kiwitest')
     login_page.sleep(2)
     login_page.sign_in()
     login_page.sleep(2)
     try:
         self.assertEqual(u'用户名或者密码错误', login_page.get_tips_info())
         logger.info('用户名或者密码不正确')
     except Exception as e:
         logger.error(u'错误提示不正确,请检查页面是否更新:%s' % format(e))
def navigate_login(context):
    LoginPage(context.driver).navigate(constants.LOGIN_PAGE["NAVIGATE_LOGIN"].format(site=EnvSetup.SITE))
 def test_login_4_pwd_length(self):
     logger.info(u'Test login with Insufficient password length')
     login_page = LoginPage(self.driver)
     login_page.sleep(2)
     login_page.input_email('*****@*****.**')
     login_page.sleep(2)
     login_page.input_pwd('ki')
     login_page.sleep(2)
     login_page.sign_in()
     login_page.sleep(2)
     try:
         self.assertEqual(u'密码长度至少为6位', login_page.get_pwd_error())
         logger.info(u"密码长度不够6位")
     except Exception as e:
         logger.error(u'错误提示不正确,请检查页面是否更新:%s' % format(e))