예제 #1
0
    def test_01_header_text_present(self):
        driver = self.driver
        driver.get(settings.BASE_URL)
        header = HomePage(driver)

        header.check_header_text()
        time.sleep(2)
    def test_sign_in_scenarios(self):
        """
        1. Verify empty email and empty password displays correct error.
        2. Verify valid email and empty password displays correct error.
        3. Verify invalid email and valid password displays correct error.
        4. Verify unregistered email and valid password displays correct error.
        5. Verify valid email and invalid password displays correct error.
        6. Verify valid email and valid password displays welcome message.
        """
        driver = self.driver

        home = HomePage(driver)
        home.click_sign_in()

        workbook = xlrd.open_workbook(TestData.DATA_LOCATION)
        sheet = workbook.sheet_by_name(TestData.SHEET_NAME)

        authentication = AuthenticationPage(driver) 
        rowCount = sheet.nrows

        # Run all cases for sign in
        for row in range(2, rowCount): 
            username = sheet.cell_value(row, 1)
            password = sheet.cell_value(row, 2)
            expectedResult = sheet.cell_value(row, 3)
            authentication.enter_emailAdress(username)
            authentication.enter_password(password)

            authentication.click_signIn()

            pageSource = driver.page_source
            search_text = re.search(expectedResult, pageSource)
            self.assertNotEqual(search_text, None)
예제 #3
0
    def test_13_latest_news(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        home.click_latest_news()
        assert 'News' in driver.title
예제 #4
0
    def test_leave(self, setup):
        self.logger.info("************* Test_002_Home ******************")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = LoginPage(self.driver)
        self.lp.setUsername(self.username)
        self.lp.setPassword(self.password)
        self.lp.submit()
        self.logger.info("*********Login successfull *********")

        homePage = HomePage(self.driver)
        homePage.selectLeave()

        homePage.setFromDate()
        homePage.selectFromMonth(ReadConfig.getFromMonth())
        homePage.selectFromYear(ReadConfig.getFromYear())
        homePage.selectFromDate(ReadConfig.getFromDate())

        homePage.setToDate()
        homePage.selectToMonth(ReadConfig.getToMonth())
        homePage.selectToYear(ReadConfig.getToYear())
        homePage.selectToDate(ReadConfig.getToDate())
        homePage.selectRejectedLeaves()
        homePage.selectUnit(ReadConfig.getUnit())
        homePage.search()

        self.driver.quit()
예제 #5
0
    def test_09_recipe_page_redirection(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        home.click_recipe()
        assert 'Recipe' in driver.title
예제 #6
0
    def test_10_about_us_page_redirection(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        home.click_about_us()
        assert 'About Us' in driver.title
예제 #7
0
    def test_08_products_page_redirection(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        home.click_products()
        assert 'Products' in driver.title
    def add_product_in_cart(self, search_category, search_product):
        logger = self.getLogger()

        driver = self.driver
        search_From_Home = HomePage(driver)
        search_From_Home.enter_search_query(search_category)
        search_result_page = search_From_Home.click_search_button()

        products = search_result_page.return_search_products()
        product_name = None
        selected_product = None
        for product in products:
            selected_product = product
            selected_product_name = search_result_page.return_product_name(
                selected_product)
            #print(selected_product_name)
            #print("\n")
            #logger.info(selected_product_name+"\n")
            if search_product in selected_product_name.lower():
                break
        time.sleep(5)

        search_result_page.add_selected_product(selected_product)
        product_name = selected_product_name
        self.added_products.append(product_name)
        return product_name
    def test_a_login(self, get_login_data):
        message = None
        logger = self.getLogger()
        try:

            login_from_home = HomePage(self.driver)
            login_from_home.click_Login()
            logger.info("Login is clicked")
            login_page = login_from_home.click_Gplus()
            print("Gplus is clicked")
            logger.info("Gplus is clicked")

            time.sleep(12)
            childWindow = self.driver.window_handles[1]
            self.driver.switch_to.window(childWindow)
            #login_page=LoginPage(self.driver)
            login_page.enter_email(get_login_data["email"])
            login_page.click_email_next()
            logger.info("email : ")
            logger.info(get_login_data["email"])
            login_page.enter_password(get_login_data["password"])
            login_page.click_password_next()
            logger.info("password : "******"password"])
            self.driver.switch_to.window(self.driver.window_handles[0])
            print(self.driver.title)
            self.driver.refresh()
            message = "Success! to Login"

        except:
            message = "Fail! to Login"

        logger.info(message)
        assert "Success" in message
예제 #10
0
    def test_04_empty_cart(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        home.click_on_cart()
        assert "Your cart is currently empty" in driver.page_source
예제 #11
0
    def test_addMultiplePoducts(self, *products):
        """checks the possibility to add many products(regardless of the type of product) to the basket"""
        hp = HomePage(self.driver)
        sp = SearchPage(self.driver)
        pp = ProductPage(self.driver)
        bp = BasketPage(self.driver)

        for product in products:
            hp.enter_searched_product(product)
            results = sp.search_results_is_not_empty()

            if results is True:
                default_sorting = sp.verify_if_sorting_by_best_match_is_set_as_default(
                )
                self.assertTrue(default_sorting,
                                "Sorting by best match is not set as default")
                sp.choose_product_from_list(0)
                pp = ProductPage(self.driver)
                title = pp.product_title()
                self.assertIn(product, title, "incorrect title")
                pp.add_to_cart()
                bp = BasketPage(self.driver)
                product_name = bp.check_product_name_in_cart()
                self.assertIn(product, product_name,
                              "Selected product not added to basket")
                hp.return_to_home_page()
            else:
                hp.return_to_home_page()
예제 #12
0
 def test_validLogin(self):
     driver = self.driver
     driver.get(Locators.url)
     # calling the HomePage() class from homePage file
     login = HomePage(driver)
     login.setLoginMenu() # calling the setLoginMenu() method from the HomePage() class
     time.sleep(6)
     print(driver.title)
     self.assertIn("Sign In", driver.title)
예제 #13
0
 def test_15_follow_us_from_footer(self):
     driver = self.driver
     home = HomePage(driver)
     home.click_home()
     try:
         home.check_social_links_present()
     except NoSuchElementException:
         return False
     return True
예제 #14
0
    def test_12_all_collections(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        for collection_name in settings.COLLECTIONS:
            home.click_home()
            driver.find_element_by_partial_link_text(collection_name).click()
            assert collection_name in driver.title
예제 #15
0
    def test_login_valid(self):
        driver = self.driver
        driver.get(data.url)
        login = LoginPage(driver)
        login.enter_username(data.username)
        login.enter_password(data.password)
        login.click_login()

        homepage = HomePage(driver)
예제 #16
0
    def test_14_links_from_footer(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()

        for link_text in settings.FOOTER_LINKS:
            home.click_home()
            home.click_links_one_after_another(link_text)
            assert link_text in driver.title
예제 #17
0
 def test_credits(self):
     print(
         time.strftime("Start: " + '%Y-%m-%d %H:%M:%S',
                       time.localtime(time.time())))
     self.driver.get(self.credits_url)
     home_page = HomePage(self.driver)
     f_login = home_page.tap_on_login_with_facebook()
     f_login.type_username_and_password("*****@*****.**", "mozatm2u")
     credits_page = f_login.tap_login_button()
     credits_page.redeem()
 def test_login(self, test_setup):
     driver.get("https://opensource-demo.orangehrmlive.com/")
     time.sleep(10)
     login = LoginPage(driver)
     login.enter_username("Admin")
     login.enter_password("admin123")
     login.click_login()
     home = HomePage(driver)
     home.click_welcome()
     home.click_logout()
예제 #19
0
    def test_03_invalid_login(self):
        driver = self.driver
        home = HomePage(driver)
        login = LogInPage(driver)

        home.click_login_link_from_home()
        login.enter_customer_email(settings.CUSTOMER_INVALID_EMAIL)
        login.enter_customer_password(settings.CUSTOMER_PASSWORD)
        login.click_sign_in_button()
        time.sleep(2)
        assert 'Incorrect email or password.' in driver.page_source
예제 #20
0
    def test_16_subscribe(self):
        driver = self.driver
        home = HomePage(driver)
        home.click_home()

        home.enter_email_subscribe(settings.EMAIL_GENERATOR)
        home.click_subscribe_button()
        if home.success_message_is_shown():
            print("Element exists")
        else:
            print("No such element exist")
예제 #21
0
 def test_searchNonExistingProduct(self):
     """checks the possibility to search non existing product"""
     product = "fdsgdsggd"
     hp = HomePage(self.driver)
     hp.enter_searched_product(product)
     sp = SearchPage(self.driver)
     results = sp.search_results_is_not_empty()
     if self.assertFalse(results, "There is a product on a list"):
         info = sp.display_message_when_search_results_are_empty()
         self.assertEqual(info, "Nie znaleziono szukanej frazy",
                          "Product exist in our database")
예제 #22
0
    def test_login_valid(self):
        driver = self.driver
        driver.get("http://medechat-client.qa.butterfly.com.au/")

        login = LoginPage(driver)
        login.enter_email("*****@*****.**")
        login.enter_password("But3as2flying")
        login.click_login()
        time.sleep(2)

        homepage = HomePage(driver)
        homepage.click_logout()
예제 #23
0
    def test_logout(self):
        try:
            driver = self.driver

            homepage = HomePage(driver)  #objects created
            homepage.click_welcome()
            homepage.click_logout()
            x = driver.title
            assert x == "abc"

        except:
            print("There was an exception")
예제 #24
0
    def test_registerAllfieldsAreEmpty(self):
        """checks the possibility to register account if the required fields are blank
        and required regulations are not selected"""

        errors = ["Podanie poprawnego emaila jest konieczne do dokończenia procesu rejestracji", "Wprowadź hasło (min. 5 znaków)", "Hasła muszą się zgadzać", "Musisz zaakceptować regulamin"]
        hp = HomePage(self.driver)
        hp.go_to_register_page()
        rp = RegisterPage(self.driver)
        rp.click_on_register_btn()
        visible_erros = rp.verify_visible_errors()
        for error in visible_erros:
            self.assertIn(error, errors, "Selected error-info not appeared")
예제 #25
0
    def test_search_results(self):
        """
        Verify all the search results contain the search text.
        """
        driver = self.driver

        home = HomePage(driver)
        search_text = "shirt"
        home.enter_search_text(search_text)
        home.click_search_button()

        result = home.validate_search_results(search_text)
        self.assertTrue(result)
예제 #26
0
    def test_11_contact_us_form_submission(self):
        driver = self.driver
        home = HomePage(driver)
        contact_us = ContactUsPage(driver)

        #home.click_home()
        home.click_contact_us()

        contact_us.enter_contact_form_name(settings.NAME_GENERATOR)
        contact_us.enter_contact_form_email(settings.EMAIL_GENERATOR)
        contact_us.enter_contact_form_message(settings.TEST_MESSAGE)
        contact_us.click_contact_form_send_button()
        assert "Thanks for contacting us. We'll get back to you as soon as possible." in driver.page_source
예제 #27
0
    def test_login_valid(self):
        driver = self.driver

        driver.get("https://opensource-demo.orangehrmlive.com/")

        login = LoginPage(driver)
        login.enter_username("Admin")
        login.enter_password("admin123")
        login.click_login()

        homepage = HomePage(driver)
        time.sleep(5)
        homepage.click_my_info()
        time.sleep(2)
예제 #28
0
    def test_02_invalid_login(self):
        driver = self.driver  # Setup driver variable to self.driver so no need to type self.driver each time
        home = HomePage(
            driver
        )  # A variable for home, driver instance passed because this argument added to construction of LoginPage
        login = LoginPage(
            driver
        )  # A variable for login, driver instance passed because this argument added to construction of LoginPage

        home.click_customer_login_link()  # Click on Login link
        login.enter_email('*****@*****.**')  # Enter the email
        login.enter_password('Tester1234')  # Enter the password
        login.click_on_sign_in_button()  # Click on submit button
        assert 'Incorrect email or password.' in driver.page_source  # Verify error is shown
예제 #29
0
    def test_06_valid_search(self):
        driver = self.driver
        home = HomePage(driver)

        home.click_home()
        search_term = 'Chicken'
        home.enter_search_query(search_term)
        home.press_enter_from_keyboard()
        time.sleep(4)
        try:
            assert search_term in driver.title
            print("Assertion Test Passed")
        except Exception as e:
            print("Assertion Test Failed", format(e))
예제 #30
0
    def test_03_create_account(self):
        driver = self.driver
        home = HomePage(driver)
        create_account = CreateAccountPage(driver)

        home.click_create_account_link_from_home()
        WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.CLASS_NAME, "btn")))
        create_account.enter_first_name(settings.NAME_GENERATOR)
        create_account.enter_last_name(settings.NAME_GENERATOR)
        create_account.enter_email_address(settings.EMAIL_GENERATOR)
        create_account.enter_create_password(settings.PASSWORD_GENERATOR)
        create_account.click_create_button()
        time.sleep(2)