예제 #1
0
파일: TestLogin.py 프로젝트: flavia-c/emag
    def test_missing_email(self, setup):
        home_page = HomePage(setup)
        login_step = home_page.click_account()
        login_step.login_email_step('', False)
        error_text = login_step.get_login_error_text()

        assert self.__MISSING_EMAIL == error_text
예제 #2
0
    def test_logout(self):
        try:
            driver = self.driver
            Home = HomePage(driver)
            Home.click_logout()
            a = driver.title
            print(a)
            assert 'a' == 'f'

        except AssertionError as error:
            print("Assertion error occurred.")
            print(error)

            time = moment.now().strftime("%m-%d-%Y_%H-%M-%S")
            functionName = utils.whoIam()
            ScreenshotName = functionName + "_" + time
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=ScreenshotName,
                          attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file(
                "C:/Users/A05/PycharmProjects/AutomationFramework/screenshots/"
                + ScreenshotName + ".png")
            raise
        except:
            print("There was an exception")
            raise

        else:
            print("No Exception occurred")

        finally:
            print("I am gonna execute every time")
예제 #3
0
파일: TestLogin.py 프로젝트: flavia-c/emag
    def test_invalid_email(self, setup):
        home_page = HomePage(setup)
        login_step = home_page.click_account()
        login_step.login_email_step('asdf', False)
        error_text = login_step.get_login_error_text()

        assert self.__INVALID_EMAIL_TEXT == error_text
 def test_02_login_page_load(self):
     print("\n" + str(test_cases(1)))
     driver = self.driver
     page = HomePage(driver)
     page.clickLoginButton()
     assert "/giris" in driver.current_url
     self.assertTrue(page.isLoginPageVisible())
예제 #5
0
    def test_successful_login(self):
        users = self.get_users()
        login_page = LoginPage(self.driver)
        login_page.login(users[0]["validEmail"], users[0]["validPassword"])

        home_page = HomePage(self.driver)
        assert home_page.is_avatar_displayed()
 def test_incorrect_login(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.matchers.assert_equal(l.error_message, self.bad_password)
예제 #7
0
 def test01(self, data):
     self.driver.get("http://aliyun.32.cn")
     self.driver.maximize_window()
     HomePage(self.driver).home_login_click()
     LoginPage(self.driver).login(data["mobile"], data["password"])
     time.sleep(5)
     result = HomePage(self.driver).is_login_success()
     self.assertTrue(result)
예제 #8
0
def test_top_banner_task1(py, report_generator, width, height, displayType,
                          location, testName):
    homePage = HomePage(py, width, height,
                        py.config.custom['environment']['homeUrl'])
    topBannerImage = homePage.getTopBannerImage()

    # Check that topBannerImage is always visible
    topBannerImage.should().be_visible()
 def test_incorrect_login_with_soft_assert(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.matchers.verify_equal(l.error_message, "Incorrect username or password.")
예제 #10
0
 def incorrect_login_fails(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.assertEqual(l.error_message, "This message is deliberately incorrect to trigger a failed test.")
예제 #11
0
 def incorrect_login(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.assertEqual(l.error_message, "Incorrect username or password.")
예제 #12
0
def test_email_error(page: Page, login, password):
    home_page = HomePage(page)
    home_page.open_main_page()
    page.click(home_page.SIGN_IN_LOCATOR)
    sign_in_page = SignInPage(page)
    sign_in_page.populate_credentials(login, password)
    sign_in_page.click_sign_in_button()

    assert "Invalid email address." in sign_in_page.get_authentication_error_text(), "Wrong email validation message"
예제 #13
0
    def test_search_query(self):

        homepage = HomePage(self.driver)
        query = "Query"

        test = (homepage.type_query(
            query).click_on_search_button().is_query_in_results())

        self.assertTrue(test)
예제 #14
0
 def test_incorrect_login_with_soft_assert(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.matchers.verify_equal(l.error_message,
                                "Incorrect username or password.")
예제 #15
0
 def test_login_validation(self):
     home_page = HomePage(self.chrome)
     home_page.myacc_click()
     login_page = Login(self.chrome)
     login_page.type_email_text_box(email="*****@*****.**")
     login_page.type_pwd_text_box(pwd="Welcome123")
     login_page.click_login_link()
     logout_page = Logout(self.chrome)
     logout_page.click_log_out()
     time.sleep(3)
예제 #16
0
def test_filter_column_task1(py, report_generator, width, height, displayType,
                             location, testName):
    homePage = HomePage(py, width, height,
                        py.config.custom['environment']['homeUrl'])
    filterColumn = homePage.getFilterColumn()

    if displayType == DESKTOP:
        filterColumn.should().be_visible()
    else:
        filterColumn.should().be_hidden()
예제 #17
0
 def test_incorrect_login_fails(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     l.username = "******"
     l.password = "******"
     l.do_login()
     self.matchers.assert_equal(
         l.error_message,
         "This message is deliberately incorrect to trigger a failed test.")
예제 #18
0
    def test_blank_fields(self, setup):
        home_page = HomePage(setup)
        car_page = home_page.select_rental_car()
        car_page.click_submit(False)

        assert car_page.get_pickup_location_error(
        ) == self.__PICKUP_LOCATION_ERROR
        assert car_page.get_pickup_date_error() == self.__PICKUP_DATE_ERROR
        assert car_page.get_dropoff_location_error(
        ) == self.__DROPOFF_LOCATION_ERROR
        assert car_page.get_dropoff_date_error() == self.__DROPOFF_DATE_ERROR
예제 #19
0
 def incorrect_login_with_random_username_and_password(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     
     from saunter.generators.string_data import random_string
     l.username = random_string(5)
     l.password = random_string()
     
     l.do_login()
     self.assertEqual(l.error_message, "Incorrect username or password.")
예제 #20
0
    def test_incorrect_login_with_random_username_and_password(self):
        h = HomePage()
        h.open_default_url()
        l = h.go_to_login_page()

        from saunter.generators.string_data import random_string
        l.username = random_string(5)
        l.password = random_string()

        l.do_login()
        self.matchers.assert_equal(l.error_message,
                                   "Incorrect username or password.")
예제 #21
0
 def incorrect_login_from_csv(self):
     h = HomePage()
     h.open_default_url()
     l = h.go_to_login_page()
     
     from saunter.providers.csv_provider import CSVProvider
     p = CSVProvider('invalid_usernames.csv')
     data = p.randomRow()
     l.username = data['username']
     l.password = data['password']
     
     l.do_login()
     self.assertEqual(l.error_message, "Incorrect username or password.")
예제 #22
0
    def incorrect_login_from_sqlite3(self):
        h = HomePage()
        h.open_default_url()
        l = h.go_to_login_page()

        from saunter.providers.sqlite3_provider import DBProvider
        p = DBProvider()
        data = p.get_random_user()
        l.username = data['username']
        l.password = data['password']

        l.do_login()
        self.assertEqual(l.error_message, "Incorrect username or password.")
예제 #23
0
    def test_incorrect_login_from_sqlite3(self):
        h = HomePage()
        h.open_default_url()
        l = h.go_to_login_page()

        from providers.invalid_usernames import InvalidUsernames
        p = InvalidUsernames()
        data = p.get_random_user()
        l.username = data['username']
        l.password = data['password']

        l.do_login()
        self.assertEqual(l.error_message, "Incorrect username or password.")
예제 #24
0
 def createPage(self, pageName, driver, dic_prop):
     if pageName == "home":
         return HomePage(driver, dic_prop)
     elif pageName == "signin":
         HomePage(driver, dic_prop).clickToSignIn()
         return SignInPage(driver, dic_prop)
     elif pageName == "signup":
         HomePage(driver, dic_prop).clickToSignUp()
         return SignUpPage(driver, dic_prop)
     elif pageName == "profile":
         HomePage(driver, dic_prop).clickToSignIn().signInToUdacity()
         return ProfilePage(driver, dic_prop)
     else:
         raise ValueError("Unknown page")
예제 #25
0
 def test_links_are_visible(self):
     new_title = "Browse Jobs by Company, Location, Skills, Designation & Industry - Naukri.com"
     login_title = "Jobseeker's Login: Search the Best Jobs available in India & Abroad - Naukri.com"
     self.home = HomePage(self.driver)
     self.home.switch_to_tab(1)
     self.home.is_jobs_visible()
     self.home.is_Recruiters_visible()
     self.home.is_companies_visible()
     self.home.is_tools_visible()
     self.home.is_services_visible()
     self.home.is_more_visible()
     self.home.is_login_button_visible()
     current_title = self.home.get_title()
     assert current_title == new_title
예제 #26
0
 def test_sign_in_existing_user_from_home_page(self):
     user_information = PersonalInformation(email="*****@*****.**",
                                            first_name="John",
                                            last_name="Doe",
                                            password="******")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.sign_in()
     authentication = Authentication(self.browser)
     authentication.sign_in(user=user_information)
     account = MyAccount(self.browser)
     name_surname = user_information.first_name + ' ' + user_information.last_name
     self.assertTrue(account.is_user_logged(name_surname))
예제 #27
0
 def test_search_existing_product_sign_in_existing_user_not_tos(self):
     product = "dress"
     user_information = PersonalInformation(email="*****@*****.**",
                                            first_name="John",
                                            last_name="Doe",
                                            password="******")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.sign_in()
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
     search_results.select_list_view()
     search_results.add_to_cart_first_product_found()
     cart = ShoppingCartPopupPage(self.browser)
     cart.proceed_to_checkout()
     cart_summary = ShoppingCartSummary(self.browser)
     cart_summary.proceed_to_checkout()
     authentication = Authentication(self.browser)
     authentication.sign_in(user=user_information)
     addresses = Addresses(self.browser)
     addresses.proceed_to_checkout()
     shipping = Shipping(self.browser)
     shipping.proceed_to_checkout()
     self.assertTrue(shipping.tos_not_selected())
예제 #28
0
    def test_incorrect_login_from_csv(self):
        h = HomePage()
        h.open_default_url()
        l = h.go_to_login_page()

        from saunter.providers.csv_provider import CSVProvider
        p = CSVProvider('invalid_usernames.csv')
        data = p.randomRow()
        l.username = data['username']
        l.password = data['password']

        l.do_login()
        self.take_numbered_screenshot()
        self.matchers.assert_equal(l.error_message,
                                   "Incorrect username or password.")
예제 #29
0
    def test01_valid_login(self):
        driver = self.driver
        driver.get("https://wwwqa.designmilktravels.com")

        login = LoginPage(driver)

        login.mailchimp_popup_close()
        login.sing_in()
        login.enter_username("*****@*****.**")
        login.enter_password("pass@12345678")
        login.click_login()

        homepage = HomePage(driver)

        homepage.click_accountsetting()
예제 #30
0
 def setUpClass(cls):
     # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
     cls.driver = webdriver.Chrome(executable_path=chromedriver)
     cls.driver.implicitly_wait(5)  # 隐式等待
     cls.url = test_url
     cls.username = username
     cls.password = "******"
     cls.public_page = PublicMethod(cls.driver, cls.url,
                                    u"合纵易购收藏界面")  # 声明PublicMethod类对象
     cls.home_page = HomePage(cls.driver, cls.url,
                              u"合纵易购收藏界面")  # 声明homePage类对象
     cls.cart_page = CartPage(cls.driver, cls.url,
                              u"合纵易购收藏界面")  # 声明cartPage类对象
     cls.categories_page = CategoriesPage(
         cls.driver, cls.url, u"合纵易购收藏界面")  # 声明categoriesPage类对象
     cls.puyao_page = PuYaoPage(cls.driver, cls.url,
                                u"合纵易购收藏界面")  # 声明puyaoPage类对象
     cls.settle_page = SettlePage(cls.driver, cls.url,
                                  u"合纵易购收藏界面")  # 声明settlePage类对象
     cls.goodsdetail_page = GoodsDetailPage(
         cls.driver, cls.url, u"合纵易购收藏界面")  # 声明goodsDetailPage类对象
     cls.collection_page = CollectionPage(
         cls.driver, cls.url, u"合纵易购收藏界面")  # 声明collectionPage类对象
     cls.zhongyao_page = ZhongYaoPage(cls.driver, cls.url,
                                      u"合纵易购收藏界面")  # 声明ZhongYaoPage类对象
     cls.public_page.get_url(cls.url)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
     cls.public_page.login(cls.username, cls.password)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
예제 #31
0
 def setUpClass(cls):
     # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
     cls.driver = webdriver.Chrome(executable_path=chromedriver)
     cls.url = test_url
     cls.public_page = PublicMethod(cls.driver, cls.url,
                                    u"合纵药易购商品分类界面")  # 声明publicMethod类对象
     cls.categories_page = CategoriesPage(
         cls.driver, cls.url, u"合纵药易购结算界面")  # 声明categoriesPage类对象
     cls.home_page = HomePage(cls.driver, cls.url,
                              u"合纵药易购结算界面")  # 声明homepage类对象
     cls.puyao_page = PuYaoPage(cls.driver, cls.url,
                                u"合纵药易购结算界面")  # 声明puyaopage类对象
     cls.settle_page = SettlePage(cls.driver, cls.url,
                                  u"合纵药易购结算界面")  # 声明settlepage类对象
     cls.cart_page = CartPage(cls.driver, cls.url,
                              u"合纵药易购结算界面")  # 声明cartpage类对象
     cls.order_page = OrderPage(cls.driver, cls.url,
                                u"合纵药易购结算界面")  # 声明orderpage类对象
     cls.driver.implicitly_wait(5)
     cls.username = username
     cls.password = "******"
     cls.ddbz = "订单备注"
     cls.public_page.get_url(cls.url)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
     cls.public_page.login(cls.username, cls.password)
     cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
예제 #32
0
    def setUpClass(cls):
        # chromedriver = "C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chromedriver.exe"
        cls.driver = webdriver.Chrome(executable_path=chromedriver)
        cls.driver.implicitly_wait(5)  # 隐式等待
        cls.url = test_url
        cls.username = username
        cls.password = "******"
        cls.public_page = PublicMethod(cls.driver, cls.url,
                                       u"合纵易购积分商城界面")  # 声明PublicMethod类对象
        cls.categories_page = CategoriesPage(cls.driver, cls.url,
                                             u"合纵易购积分商城界面")  # 声明categories类对象
        cls.home_page = HomePage(cls.driver, cls.url, u"合纵易购积分商城界面")
        cls.jfsc_page = JiFenShangChengPage(
            cls.driver, cls.url, u"合纵易购积分商城界面")  # 声明jifenshangchengPage类对象
        cls.jfscqd_page = JiFenShangCheng_qiandaoPage(
            cls.driver, cls.url, u"合纵易购积分商城界面"
        )  # 声明JiFenShangChennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnng_qiandaoPage类对象
        cls.jfscgrzx_page = JiFenShangCheng_gerenzhongxinPage(
            cls.driver, cls.url,
            u"合纵易购积分商城界面")  # 声明JiFenShangCheng_grzxPage类对象
        cls.jfscddxq_page = JiFenShangCheng_ddxqPage(
            cls.driver, cls.url,
            u"合纵易购积分商城界面")  # 声明JiFenShangCheng_ddxqPage类对象
        cls.jfsclpc_page = JiFenShangCheng_lipinchePage(
            cls.driver, cls.url,
            u"合纵易购积分商城界面")  # 声明JiFenShangCheng_lipinchePage类对象

        cls.public_page.get_url(cls.url)
        cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
        cls.public_page.login(cls.username, cls.password)
        cls.public_page.is_element_exist()  # 判断广告页是否弹出,弹出自动关闭
예제 #33
0
    def testCreatePost(self):
        print 'testCreatePost'

        #登陆
        theLoginPage = LoginPage(self.driver,self.loginPageUrl)
        theLoginPage.login(self.username,self.passwd)

        # title 由当前时间组成,以免输入固定字符Sam、Test Content
        title = 'Sam'+time.strftime("%Y-%m-%d %H:%M:%S")

        #创建 新文章
        createPostPage = PostFormPage(self.driver)
        createPostPage.createPost(title)

        #进入首页,进行断言
        theHomePage = HomePage(self.driver)
        self.assertEqual(title,theHomePage.getfirstPostLink().text)
예제 #34
0
def test_confirmation(page: Page):
    home_page = HomePage(page)
    home_page.open_main_page()
    home_page.add_thing_to_cart_by_name("Blouse")
    text = home_page.get_confirmation_text()

    assert "Product successfully added to your shopping cart" in text, "Wrong confirmation message"
예제 #35
0
    def test_incorrect_login_from_sqlite3(self):
        h = HomePage()
        h.open_default_url()
        l = h.go_to_login_page()

        from providers.invalid_usernames import InvalidUsernames
        p = InvalidUsernames()
        data = p.get_random_user()
        l.username = data['username']
        l.password = data['password']

        l.do_login()

        self.take_numbered_screenshot()
        self.take_named_screenshot('foo')

        self.matchers.assert_equal(l.error_message,
                                   "Incorrect username or password.")
예제 #36
0
    def login(self,mobile="18270720030",password="******"):
        loginpage = LoginPage(self.getDriver())
        loginpage.waitForPreLoad()
        loginpage.typeMobileInputBox(mobile)
        loginpage.typeLoginPasswordInputBox(password)
        loginpage.typeClickOnLoginButton()
        loginpage.isElementPresent(loginpage.profile,30)
        assert True == loginpage.isProfilePresent()

        return HomePage(self.getDriver())
예제 #37
0
 def test_search_existing_product_and_register_user(self):
     product = "dress"
     user_information = PersonalInformation(email="*****@*****.**",
                                            first_name="John",
                                            last_name="Doe",
                                            password="******")
     user_address = Address(address="4374  Traders Alley",
                            city="Kansas City",
                            state="Missouri",
                            postal_code="64106",
                            phone_mobile="8164465964")
     self.browser.get('http://automationpractice.com/index.php')
     self.assertIn('My Store', self.browser.title)
     home_page = HomePage(self.browser)
     home_page.search_product(product)
     home_page.search_button()
     search_results = SearchPage(self.browser)
     res = search_results.product_found()
     self.assertTrue(res)
     search_results.select_list_view()
     search_results.add_to_cart_first_product_found()
     cart = ShoppingCartPopupPage(self.browser)
     cart.proceed_to_checkout()
     cart_summary = ShoppingCartSummary(self.browser)
     cart_summary.proceed_to_checkout()
     authentication = Authentication(self.browser)
     authentication.create_an_account(user_information.email)
     c = CreateAccount(self.browser)
     c.register(user_information=user_information, address=user_address)
    def test_logout(self):
        try:
            driver = self.driver
            # def test_logout(self, test_setup):
            time.sleep(5)
            # driver.find_element_by_xpath("//a[@id='welcome']").click()
            homepage = HomePage(driver)
            homepage.click_welcome_link()
            time.sleep(1)
            # driver.find_element_by_xpath("//a[contains(text(),'Logout')]").click()
            homepage.click_logout_link()
            x = driver.title
            assert x=="OrangeHRM1"

        except AssertionError as error:
            print("Assertion error occurred")
            print(error)
            currenttime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testname = utils._get_function_name()
            screenshotname = testname+"_"+ currenttime
            allure.attach(self.driver.get_screenshot_as_png(), name=screenshotname, attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file("C:/Users/kamalakararao.ganadi/PycharmProjects/AutomationFrameWork_1/screenshots/"+screenshotname+".png")
            raise
        except:
            print("Some exception occurred")
            currenttime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testname = utils._get_function_name()
            screenshotname = testname + "_" + currenttime
            allure.attach(self.driver.get_screenshot_as_png(), name=screenshotname,attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file("C:/Users/kamalakararao.ganadi/PycharmProjects/AutomationFrameWork_1/screenshots/" + screenshotname + ".png")

        else:
            print("No exceptions occurred")
        finally:
            print("This block will always execute | Close DB")
예제 #39
0
 def test_home_item(self):
     self.driver.execute_script(
         "window.scrollBy(0,document.body.scrollHeight)")
     print("\n" + str(test_cases(1)))
     page = HomePage(self.driver)
     element = self.driver.find_element_by_xpath(
         "//div[contains(text(),'Copyright © Saltside Technologies')]")
     assert element.text == 'Copyright © Saltside Technologies'
     print(element.text)
     elementpost = self.driver.find_element_by_xpath(
         "//p[contains(text(),'Post your ad on Bikroy.com')]")
     assert elementpost.text == 'Post your ad on Bikroy.com'
     print(elementpost.text)
예제 #40
0
 def test_create_new_experience(self):
     """
     Create a new experience "from scratch", i.e. not from a "me too!" button
     """
     h = HomePage()
     h.open_default_url()