Exemple #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 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
    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)
Exemple #5
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()
Exemple #6
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)
Exemple #7
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()
class Test_Homepage(BaseTest):
    def test_maquinaria_search_visible(self):
        self.homePage = HomePage(self.driver)
        flag = self.homePage.is_buscar_maquinaria_existe()
        assert flag

    def test_home_page_title(self):
        self.homePage = HomePage(self.driver)
        title = self.homePage.get_title(testData.WEBSITE_TITLE)
        assert title == testData.WEBSITE_TITLE
Exemple #9
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
Exemple #10
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")
    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()
Exemple #12
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")
Exemple #13
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
Exemple #14
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)
Exemple #15
0
    def test_removeSelectedProducts(self):
        """checks the possibility to remove selected products from the basket"""
        product_list = [
            "dsgdsgsgdfg",
            "Frontend developer. Kurs video. HTML i CSS. Poziom średnio zaawansowany",
            "Tysiąc szklanek herbaty. Spotkania na Jedwabnym Szlaku",
            "English 4 IT. Praktyczny kurs języka angielskiego dla specjalistów IT i nie tylko"
        ]
        product_to_remove = [
            "Tysiąc szklanek herbaty. Spotkania na Jedwabnym Szlaku",
            "English 4 IT. Praktyczny kurs języka angielskiego dla specjalistów IT i nie tylko"
        ]
        product_left = [
            "Frontend developer. Kurs video. HTML i CSS. Poziom średnio zaawansowany"
        ]

        hp = HomePage(self.driver)
        sp = SearchPage(self.driver)
        pp = ProductPage(self.driver)
        bp = BasketPage(self.driver)

        for product in product_list:
            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()
        hp.go_to_basket()
        for product in product_to_remove:
            bp.select_checkbox(product)

        bp.click_remove_selected()
        remove_results = bp.remove_results()
        self.assertEqual(remove_results, product_left,
                         "Selected product was not removed")
Exemple #16
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()
Exemple #17
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)
    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
Exemple #19
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")
    def test_grid_view(self):
        """
        Verify grid view works as expected.
        """
        driver = self.driver

        home_page = HomePage(driver)
        home_page.click_dresses_tab()
        dresses_page = DressesPage(driver)
        dresses_page.click_grid_view()

        view_local_storage = driver.execute_script(
            "return localStorage.getItem('display')")

        self.assertEqual(json.loads(view_local_storage), "grid")
Exemple #21
0
 def test_03_searching_by_title(self, product):
     """checks the possibility to search product by its title"""
     hp = HomePage(self.driver)
     hp.enter_searched_product(product)
     sp = SearchPage(self.driver)
     results = sp.search_results_is_not_empty()
     self.assertTrue(results, "There is no product on a list")
     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")
Exemple #22
0
    def test_registerUsingInorrectEmailFormat(self):
        """checks the possibility to register account if email field is filled with the incorrect data and required regulations are selected"""

        errors = ["Podanie poprawnego emaila jest konieczne do dokończenia procesu rejestracji"]
        password = '******'
        hp = HomePage(self.driver)
        hp.go_to_register_page()
        rp = RegisterPage(self.driver)
        rp.fill_password(password)
        rp.repeat_password(password)
        rp.check_regulation()
        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")
Exemple #23
0
    def test_02_valid_login(self):
        driver = self.driver
        home = HomePage(driver)
        login = LogInPage(driver)
        my_account = MyAccountPage(driver)

        home.click_login_link_from_home()
        WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, "CustomerEmail")))
        login.enter_customer_email(settings.CUSTOMER_EMAIL)
        login.enter_customer_password(settings.CUSTOMER_PASSWORD)
        login.click_sign_in_button()
        my_account.check_my_account_page_header()
        my_account.check_account_details_is_shown()
        my_account.click_log_out()
Exemple #24
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
Exemple #25
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)
Exemple #26
0
    def test_sign_out(self):
        """
        Verify user is signed out when clicking sign out.
        """
        driver = self.driver

        # Sign in using valid credentials
        home = HomePage(driver)
        home.click_sign_in()
        authentication = AuthenticationPage(driver)
        authentication.enter_emailAdress(TestData.VALID_USERNAME)
        authentication.enter_password(TestData.VALID_PASSWORD)
        authentication.click_signIn()
        
        # Sign out and verify sign in button appears
        accountPage = AccountPage(driver)
        accountPage.click_signOut()

        self.assertTrue(accountPage.check_sign_in_exists())
Exemple #27
0
 def test_addSelectedBookQuantity(self):
     """checks the possibility to add selected quantity of the same book"""
     product = "Python dla każdego. Podstawy programowania. Wydanie III"
     quantity = 4
     hp = HomePage(self.driver)
     hp.enter_searched_product(product)
     sp = SearchPage(self.driver)
     results = sp.search_results_is_not_empty()
     if results is True:
         sp.choose_product_from_list(0)
     pp = ProductPage(self.driver)
     title = pp.product_title()
     self.assertIn(product, title, "incorrect title")
     pp.enter_book_quantity(quantity)
     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")
     amount = bp.check_quantity_of_selected_product(product)
     self.assertEqual(quantity, amount, "incorrect amount of added product")
    def test_01_valid_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 constructor of HomePage
        login = LoginPage(
            driver
        )  # A variable for login, driver instance passed because this argument added to constructor of LoginPage
        my_account = MyaccountPage(
            driver
        )  # A variable for my account, driver instance passed because this argument added to constructor of MyaccountPage

        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
        self.assertEqual(
            my_account.get_section_header_text(),
            "My Account")  # Verify header of the page is My Account
        my_account.click_on_logout(
        )  # Need to sign out after this test for the next one
Exemple #29
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
Exemple #30
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
Exemple #31
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