Ejemplo n.º 1
0
    def test_Check_Specials(self):
        main_page = MainPage(self.driver, self.action)

        specials = main_page.go_to_women().go_to_specials()

        assert specials.check_discounts(), "Something went wrong. Check 'Specials' on web-site.\n" \
                                           "*(Maybe one or more products are displayed without a discount.)"
Ejemplo n.º 2
0
class Application:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.main_page = MainPage(self.driver)
        self.cart_page = CartPage(self.driver)
        self.product_page = ProductPage(self.driver)

    def quit(self):
        self.driver.quit()

    def add_products_to_cart(self, number: int):
        for i in range(number):
            self.add_product_to_cart()

    def add_product_to_cart(self):
        self.main_page.open()
        self.product_page.open(self.main_page.get_first_product_link())
        self.product_page.product_to_cart()

    def delete_all_products_from_cart(self):
        self.cart_page.open()
        self.cart_page.delete_all_products()

    def is_any_product_in_cart(self):
        assert not self.cart_page.is_any_product_in_cart()
Ejemplo n.º 3
0
class TestHomePage(TestBasePage):
    """BROKEN SEARCH PAGE - INSIDE HOME PAGE"""
    """last page navigation is broken in Docker website"""
    """This scenario enters a keyword into the search bar and clicks on the last page of search results."""
    """The functionality is broken at this point of time"""
    """1. Nothing is displayed on the page - This scenario is tested here. I have asserted that search results should 
    be present, hence the assertion fails in this case. """
    """2. If the same search is performed again, by clicking enter, search results appear but no pages/pagination"""
    def test_navigate_to_last_page(self):
        self.main_page = MainPage(self.driver)
        signin_page = self.main_page.click_signin_button()
        home_page = signin_page.do_login(TestData.DOCKER_ID, TestData.PASSWORD)
        home_page.search_with_keyword(TestData.SEARCH_CRITERIA_1)
        broken_page = home_page.check_last_page_validity()
        assert broken_page is False, "EXPECTED: Search page functionality should not be broken, ACTUAL: search " \
                                     "functionality is broken "

    """NEGATIVE TEST CASE"""
    """Testing for session management once the user is logged out by clicking the back button on browser"""
    """Asserting the value of docker_id if present on the page after logout"""

    def test_back_button_after_logout(self):
        self.main_page = MainPage(self.driver)
        signin_page = self.main_page.click_signin_button()
        home_page = signin_page.do_login(TestData.DOCKER_ID, TestData.PASSWORD)
        home_page.click_fingerprint_image()
        home_page.click_logout()
        check = home_page.check_back_button()
        assert check
Ejemplo n.º 4
0
 def test_user_cant_see_product_in_basket_opened_from_product_page(self, browser, link):
     # link = "http://selenium1py.pythonanywhere.com/en-gb/catalogue/the-city-and-the-stars_95/"
     page = MainPage(browser, link)
     page.open()
     page.open_basket_page()
     page.check_the_basket_message()
     page.check_basket_price()
 def test_search_from_icon_click(self):
     self.main_page = MainPage(self.driver)
     self.main_page.click_search_image()
     search_page = self.main_page.click_search_text(
         TestData.SEARCH_CRITERIA_2)
     value = search_page.check_search_results_search_image_click()
     assert value == TestData.SEARCH_CRITERIA_2, "EXPECTED: Testing, ACTUAL: undefined"
Ejemplo n.º 6
0
def Setup():

    driver = BrowserFunctions.BrowserLoad()
    mp = MainPage()
    mp.Redirect(driver)

    yield driver
    driver.close()
Ejemplo n.º 7
0
 def test_navigate_to_last_page(self):
     self.main_page = MainPage(self.driver)
     signin_page = self.main_page.click_signin_button()
     home_page = signin_page.do_login(TestData.DOCKER_ID, TestData.PASSWORD)
     home_page.search_with_keyword(TestData.SEARCH_CRITERIA_1)
     broken_page = home_page.check_last_page_validity()
     assert broken_page is False, "EXPECTED: Search page functionality should not be broken, ACTUAL: search " \
                                  "functionality is broken "
Ejemplo n.º 8
0
 def test2(self):
     self.driver.get('https://opensource-demo.orangehrmlive.com/')
     login = Login(driver=self.driver)
     main_page = MainPage(driver=self.driver)
     login.enter_username('Admin')
     login.enter_password('admin1234')
     login.click_on_login_button()
     main_page.check_main_page()
Ejemplo n.º 9
0
 def test_back_button_after_logout(self):
     self.main_page = MainPage(self.driver)
     signin_page = self.main_page.click_signin_button()
     home_page = signin_page.do_login(TestData.DOCKER_ID, TestData.PASSWORD)
     home_page.click_fingerprint_image()
     home_page.click_logout()
     check = home_page.check_back_button()
     assert check
Ejemplo n.º 10
0
def Setup():

    driver = BrowserFunctions.BrowserLoad()
    mp = MainPage()
    mp.Redirect(driver)
    mp.GetLoginFormButton(driver).click()
    yield driver
    driver.close()
Ejemplo n.º 11
0
 def __init__(self):
     MainPage.__init__(self)
     self.url='/user/'
     self.overviewed='//a[@href="/user/"]'
     self.posts='//a[@href="/user/posts"]'
     self.comments='//a[@href="/user/comments"]'
     self.saved='//a[@href="/user/saved"]'
     self.hidden='//a[@href="/user/hidden"]'
     self.profilename='//div[@class="stuff"]'
Ejemplo n.º 12
0
 def __init__(self):
     MainPage.__init__(self)
     self.url = '/CreatePost/'
     self.subredditfield = '//input[@id="threadPageSubredditNameField"]'
     self.titlefield = '//textarea[@id="threadPageTitleField"]'
     self.bodyfield = '//textarea[@id="threadPageBodyField"]'
     self.createbutton = '//button[@class="threadPageCreateButton"]'
     self.spoilercheckbox = '//input[@name="Spoiler"]'
     self.photobutton = '//label[@class="threadPageCreateButton"]'
    def test_search(self):
        search_sentence = "Addidas campus"
        mp = MainPage(self.driver)
        mp.searchbox_input_fill(search_sentence, True)

        sp = SearchPage(self.driver)
        search_result = sp.h1_page_title_text_get()
        self.UtilsSelenium.takeScreenshot(self.testName)
        assert 'Wyniki wyszukiwania dla Addidas campus' in search_result, self.logger.error(
            f'Searching test fail for: {search_sentence}!')
Ejemplo n.º 14
0
    def test_LogIn_positive(self):
        mp = MainPage(self.driver)
        mp.login_button_click()

        lp = LoginPage(self.driver)
        lp.email_input_fill("*****@*****.**")
        lp.password_input_fill("SupaZupa")
        lp.submit_button_click()

        ap = AccountPage(self.driver)
        self.assertEqual(ap.h1_page_title_get(), 'Witaj, Imie!', "Account was not corretly created!")
        sleep(5)
Ejemplo n.º 15
0
 def __init__(self):
     MainPage.__init__(self)
     self.url = '/create-subreddit/'
     self.subredditnamefield = '//input[@id="srSubredditName"]'
     self.subredditrulefields = [
         '//textarea[@id="srSubredditRule1"]',
         '//textarea[@id="srSubredditRule2"]',
         '//textarea[@id="srSubredditRule3"]'
     ]
     self.subredditbio = '//textarea[@id="srSubredditBio"]'
     self.subredditmoderator = '//textarea[@id="srSubredditModerator"]'
     self.subredditcoverbutton = '//label[@class="srSubredditPageCreateButton"]'
     self.createbutton = '//button[@class="srSubredditPageCreateButton"]'
Ejemplo n.º 16
0
    def test_no_statement(self):
        mp = MainPage(self.driver)
        mp.signin_button_click()

        sip = SignInPage(self.driver)
        sip.name_fill("Name")
        sip.last_name_fill("LastName")
        sip.email_fill("*****@*****.**")
        sip.password_fill("SupaZupa")
        sip.password_confirmation_fill("SupaZupa")
        sip.newsletter_checkbox_click()
        sip.create_accout_button_click()
        assert self.UtilsSelenium.get_webpage_title(
        ) == "Utwórz nowe konto klienta | eobuwie.pl", f"Error: Page should be still on create account page and the title should be: Utwórz nowe konto klienta | eobuwie.pl, but it is {self.UtilsSelenium.get_webpage_title()} instead"
Ejemplo n.º 17
0
    def test_signin_negative_wrong_email(self):
        mp = MainPage(self.driver)
        mp.signin_button_click()

        sip = SignInPage(self.driver)
        sip.name_fill("Imie")
        sip.last_name_fill("LastName")
        sip.email_fill("test")
        sip.password_fill("SupaZupa")
        sip.password_confirmation_fill("SupaZupa")
        sip.statement_checkbox_click()
        sip.create_accout_button_click()
        assert sip.get_email_error(
        ) == "Wprowadzono niepoprawny adres e-mail", "There is no email error!"
Ejemplo n.º 18
0
    def test_Products_Comparison(self):
        main_page = MainPage(self.driver, self.action)

        dresses = main_page.go_to_dresses()
        dresses.add_products_to_compare()

        compare = dresses.go_to_compare()

        products_before_remove = compare.check_products()
        compare.remove_product()
        products_after_remove = compare.check_products()
        assert len(products_before_remove) - len(
            products_after_remove) == 1, "Problems with COMPARE function."
        print("Product comparison works correctly.")
Ejemplo n.º 19
0
    def test_Add_to_Cart(self):
        item_name = 'Blouse'

        main_page = MainPage(self.driver, self.action)
        search_result = main_page.search(item_name)
        assert search_result.check_search(
        ), f"{search_result.search_request} not found."
        assert search_result.check_stock(
        ), f"No items with name '{search_result.search_request}'."
        search_result.add_to_cart()

        cart = search_result.go_to_cart()

        assert cart.check_product_in_cart(item_name), "Cart is empty."
Ejemplo n.º 20
0
class TestSearchPage(TestBasePage):
    """BROKEN SEARCH ICON FUNCTIONALITY"""
    """This test validates the search text from main page of the screen."""
    """The user clicks the search icon, enters the keyword and clicks the icon again"""
    """User is redirected to search page but with 'undefined' keyword instead of user's keyword"""
    """This assertion fails since I am asserting user entered keyword with the one on the search page after click on 
    search image """
    def test_search_from_icon_click(self):
        self.main_page = MainPage(self.driver)
        self.main_page.click_search_image()
        search_page = self.main_page.click_search_text(
            TestData.SEARCH_CRITERIA_2)
        value = search_page.check_search_results_search_image_click()
        assert value == TestData.SEARCH_CRITERIA_2, "EXPECTED: Testing, ACTUAL: undefined"
    def test_product_card(self):
        search_sentence = "Addidas campus"
        product = "Campus W DB3277"
        mp = MainPage(self.driver)
        mp.searchbox_input_fill(search_sentence, True)

        sp = SearchPage(self.driver)
        self.logger.info(f"Found product {sp.search_count_get()}")
        sp.search_page_product_by_second_name_click(product)

        pp = ProductPage(self.driver)
        data = pp.product_information_get('Model:')
        print(f"Data to search: {data}")
        assert product in data, self.logger.error(
            f"Wrong product selected! Should be {product} is: {data}")
        self.UtilsSelenium.takeScreenshot(self.testName)
Ejemplo n.º 22
0
    def test_AllVitalElementsDisplayed(self, Setup):
        mp = MainPage()
        try:
            mp.GetCreatePostButton(Setup)
            mp.GetLogoButton(Setup)
            mp.GetCommunityButton(Setup)
            mp.GetNotificationsButton(Setup)
            mp.GetPmButton(Setup)
            mp.GetSearchBar(Setup)
            mp.GetTotoPanchor(Setup)
        except:
            assert False

        assert True
Ejemplo n.º 23
0
    def test_diff_passwords(self):
        mp = MainPage(self.driver)
        mp.signin_button_click()

        sip = SignInPage(self.driver)
        sip.name_fill("Name")
        sip.last_name_fill("LastName")
        sip.email_fill("*****@*****.**")
        sip.password_fill("SupaZupa")
        sip.password_confirmation_fill("ZupaSupa")
        sip.statement_checkbox_click()
        #sip.createAccoutButton_click()
        assert sip.is_visible_password_missmatch_error(), self.logger.error(
            "Error: error is not visible!")
        assert sip.get_diff_password_error(
        ) == "Prosimy upewnić się, że hasła pasują do siebie.", self.logger.error(
            "Error: There should be mismatch password error!")
        self.UtilsSelenium.takeScreenshot(self.testName)
Ejemplo n.º 24
0
class TestSignUpPage(TestBasePage):
    """NEGATIVE TEST CASE"""
    """Test to verify if copying of password can be performed or not"""
    """In this scenario, I have copied the password from password field and tried pasting into email field and then 
    read the email field and performed an assert """
    """This assertion failed since there is no password copied into the email field."""
    def test_copy_password(self):
        self.main_page = MainPage(self.driver)
        signin_page = self.main_page.click_signin_button()
        signup_page = signin_page.click_signup_link()
        text = signup_page.copy_password_text(TestData.PASS_2)
        assert text == TestData.PASS_2, "EXPECTED: testtest123, ACTUAL: ' '"
Ejemplo n.º 25
0
class TestSignInPage(TestBasePage):

    """POSITIVE TEST CASE"""
    """Testing if a valid user can enter the system, by providing right credentials"""
    """This assertion is passed"""

    def test_login(self):
        self.main_page = MainPage(self.driver)
        signin_page = self.main_page.click_signin_button()
        home_page = signin_page.do_login(TestData.DOCKER_ID, TestData.PASSWORD)
        assert home_page

    """NEGATIVE TEST CASE"""
    """Testing to check if invalid user is prompted with error page/message or not"""
    """This assertion is passed since I am asserting 'Invalid user' message."""

    def test_invalid_password(self):
        self.main_page = MainPage(self.driver)
        signin_page = self.main_page.click_signin_button()
        text = signin_page.do_invalid_login(TestData.INVALID_DOCKER_ID, TestData.INVALID_PASSWORD)
        assert text == TestData.INVALID_USER_MESSAGE
Ejemplo n.º 26
0
def clear_recent_search():
    mp = MainPage(driver)
    mp.test_title()
    U.log("INFO", C.message, C.log_file)
    driver.save_screenshot("image.png")
    mp.clear_recent()
    U.log("INFO", C.message, C.log_file)
Ejemplo n.º 27
0
 def test_main(self):
     # 声明LoginPage类对象
     main_page = MainPage(self.driver, self.url)
     # 调用打开页面组件
     main_page.open()
     main_page.click_controller()
     time.sleep(5)
Ejemplo n.º 28
0
def test_main_page():
    mp = MainPage(driver)
    mp.test_title()
    driver.save_screenshot(C.ScreenShot_Title)
    # To check the result on search of value : drill , 1234 , blank value
    for i in [1, 2, 3]:
        var = ["drill", "cumin", "  ", 1]
        print (var[i - 1])
        mp.search_type(var[i - 1])
        time.sleep(2)
        mp.GoTo_Main_Page()
        message = "TC_1: Executed with search value as  successfully"
        U.log("INFO", C.message, C.log_file)
Ejemplo n.º 29
0
 def test_search_list(self, product):
     search_sentence = product
     mp = MainPage(self.driver)
     mp.searchbox_input_fill(search_sentence, False)
     sleep(5)
     product_list = mp.get_quick_procucts_list()
     product_name = mp.quick_search_list_select_index(2, product_list)
     pp = ProductPage(self.driver)
     name_on_product_card = pp.product_information_get("Model:")
     self.assertIn(name_on_product_card, product_name,
                   f'{product_name} not in {name_on_product_card}')
     sleep(5)
Ejemplo n.º 30
0
    def test_add_multiple_product_to_basket(self, *procuct_list):
        print(procuct_list)
        mp = MainPage(self.driver)
        pp = ProductPage(self.driver)
        product_added_to_basket = []
        for product in procuct_list:
            mp.searchbox_input_fill(product, False)
            sleep(2)
            list = mp.get_quick_procucts_list()
            mp.quick_search_list_select_index(0, list)
            if pp.get_availability():
                if pp.if_size_selector_is_presence():
                    pp.get_sizes()
                pp.add_to_basket()
                selected_product = pp.product_information_get('Model:')
                pp.close_basket_popup_window()
                pp.get_back_to_main_page()
                product_added_to_basket.append(selected_product)
            else:
                print(f"Product {product} is not available. Skipping!")
        mp.button_cart_click()
        cp = CartPage(self.driver)
        product_in_cart = cp.get_products_in_cart()
        check = True
        for product in product_added_to_basket:
            partial_check = False
            for prduct_cart in product_in_cart:
                if product in prduct_cart:
                    partial_check = True
            if not partial_check:
                print(
                    f"Product {product} should be in cart, but it is not! Cart contains: {product_in_cart}"
                )
                check = False

        self.assertEqual(check, True)