Example #1
0
    def test_mainpage_17(self):
        wait = WebDriverWait(self.driver, 10)
        main = MainPage(self.driver)
        main.click_close_x_icon()
        # Mouseover "SHOP" dropdown box
        # Click on "MAKEUP" link box
        shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
        makeup = self.driver.find_element_by_xpath(MainPage.makeup_link)
        actions = action_chains.ActionChains(self.driver)
        actions.move_to_element(shop).perform()
        actions.move_to_element(makeup).perform()
        makeup.click()
#        actions.move_to_element(shop).move_to_element(makeup).click().perform()
        # Verify if the right page was opened
        assert self.driver.title == "Makeup | Sephora", "ERROR. Makeup page wasn't opened."
        # Go back to the main page
        main.click_main_page()
        # Mouseover "SHOP" dropdown box
        # Click "SKINCARE" link box
        shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
        skincare = self.driver.find_element_by_xpath(MainPage.skincare_link)
        actions = action_chains.ActionChains(self.driver)
        actions.move_to_element(shop).perform()
        actions.move_to_element(skincare).perform()
        skincare.click()
        # Verify if the right page was opened
        assert self.driver.title == "Skincare Products | Sephora", "ERROR. Skincare page wasn't opened."
Example #2
0
 def test_mainpage_28(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "shaving" and hit enter
     main.set_site_search(self.search_item)
     products_nr = self.driver.find_element_by_xpath(
         MainPage.number_of_products)
     a = products_nr.text
     number = a.replace(" Product results", "")
     # Scroll down the page
     main.scroll_bottom_page()
     # In the bottom of the page select page 2
     element1 = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.verify_skincare_2)))
     first_page_products = len(element1)
     page_2 = self.driver.find_element_by_xpath(MainPage.click_page_2)
     page_2.click()
     # Scroll to the bottom of the page
     main.scroll_bottom_page()
     # Check if the number next to "Product results: 'shaving'" matches to the number of products displayed on the both pages
     element2 = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.verify_skincare_2)))
     second_page_products = len(element2)
     all_products = first_page_products + second_page_products
     assert int(
         number
     ) == all_products, "ERROR. The number next to 'Product results: shaving' doesn't match to the number of products displayed."
Example #3
0
 def test_mainpage_14(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on facebook icon (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.facebook_icon)))
     element.click()
     # Check if the Sefora's facebook page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_facebook)))
     assert element.is_displayed(
     ), "ERROR. Sephora's Facebook page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on twitter icon (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.twitter_icon)))
     element.click()
     # Check if the Sefora's twitter page opened
     wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_twitter)))
     assert self.driver.title == "Sephora (@Sephora) | Twitter", "ERROR. Sephoria's Twitter page wasn't opened."
Example #4
0
 def test_mainpage_20(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "SHOP" dropdown box
     # Click on "GIFTS" link box
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     actions = action_chains.ActionChains(self.driver)
     actions.move_to_element(shop).perform()
     gifts_link = self.driver.find_element_by_xpath(MainPage.gifts_link)
     actions.move_to_element(gifts_link).perform()
     gifts_link.click()
     # Verify if the right page was opened
     assert self.driver.title == "Best Beauty Gifts in 2019 | Sephora", "ERROR. Best Beauty Gifts page wasn't opened."
     # Go to the main page
     main.click_main_page()
     # Mouseover "SHOP" dropdown box
     # Click "SALE" link box
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     sale_link = self.driver.find_element_by_xpath(MainPage.sale_link)
     actions = action_chains.ActionChains(self.driver)
     actions.move_to_element(shop).perform()
     actions.move_to_element(sale_link).perform()
     sale_link.click()
     # Verify if the right page was opened
     assert self.driver.title == "Makeup Sale | Beauty Sale | Sephora", "ERROR. Makeup Sale | Beauty Sale page wasn't opened."
Example #5
0
 def test_mainpage_13(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on "Sephora Global Sites" link (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable(
             (By.XPATH, MainPage.sephora_global_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_sephora_global)))
     assert element.is_displayed(
     ), "ERROR. 'Sephora Global Sites' page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on "Sephoria" link (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.sephoria_link)))
     element.click()
     time.sleep(1)
     # Go to next windows, and verify if the right page was opened
     window_after = self.driver.window_handles[1]
     self.driver.switch_to.window(window_after)
     assert self.driver.title == "Sephoria House of Beauty | Buy Your Tickets Here!", "ERROR. 'Sephoria' page wasn't opened."
Example #6
0
 def test_mainpage_15(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on instagram icon (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.instagram_icon)))
     element.click()
     # Check if the Sefora's instagram page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_instagram)))
     assert element.is_displayed(
     ), "ERROR. Sephora's Instagram page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on youtube icon (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.youtube_icon)))
     element.click()
     # Check if the Sefora's youtube page was opened
     wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_youtube)))
     assert self.driver.title == "Sephora - YouTube", "ERROR. Sephoria's Youtube page wasn't opened."
Example #7
0
 def test_mainpage_09(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Check if there are 4 elements under "Spot it. Shop it.", if no => ERROR
     element = wait.until(EC.presence_of_all_elements_located((By.XPATH, MainPage.spot_shop_items)))
     assert len(element) == 4, "ERROR. There are more/less than 4 products under 'Spot it. Shop it.'."
Example #8
0
 def test_mainpage_19(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "SHOP" dropdown box
     # Click on "FRAGRANCE" link box
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     actions = action_chains.ActionChains(self.driver)
     actions.move_to_element(shop).perform()
     fragrance = self.driver.find_element_by_xpath(MainPage.fragrance_link)
     actions.move_to_element(fragrance).perform()
     fragrance.click()
     # Verify if the right page opened
     assert self.driver.title == "Fragrance | Sephora", "ERROR. Fragrance page wasn't opened."
     # Go back to the main page
     main.click_main_page()
     # Mouseover "SHOP" dropdown box
     # Click "BATH & BODY" link box
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     bath_body = self.driver.find_element_by_xpath(MainPage.bath_body_link)
     actions = action_chains.ActionChains(self.driver)
     actions.move_to_element(shop).perform()
     actions.move_to_element(bath_body).perform()
     bath_body.click()
     # Verify if the right page opened
     assert self.driver.title == "Bath Products & Body Products | Sephora", "ERROR. Bath Products & Body Products page wasn't opened."
Example #9
0
 def test_mainpage_18(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "SHOP" dropdown box
     # Click on "HAIR" link box
     actions = action_chains.ActionChains(self.driver)
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     actions.move_to_element(shop).perform()
     hair = self.driver.find_element_by_xpath(MainPage.hair_link)
     actions.move_to_element(hair).perform()
     hair.click()
     # Verify if the right page was opened
     assert self.driver.title == "Hair Care Products | Sephora", "ERROR. Hair Care Products page wasn't opened."
     # Go back to the main page
     main.click_main_page()
     # Mouseover "SHOP" dropdown box
     # Click "TOOLS & BRUSHES" link box
     actions = action_chains.ActionChains(self.driver)
     shop = self.driver.find_element_by_xpath(MainPage.mouseover_shop)
     actions.move_to_element(shop).perform()
     tools_brushes = self.driver.find_element_by_xpath(
         MainPage.tools_brushes_link)
     actions.move_to_element(tools_brushes).perform()
     tools_brushes.click()
     # Verify if the right page was opened
     assert self.driver.title == "Makeup Tools, Beauty Tools & Makeup Accessories | Sephora", "ERROR. Makeup Tools, Beauty Tools & Makeup Accessories page wasn't opened."
 def __init__(self, browser):
     self.browser = browser
     self.main_page = MainPage(browser=browser)
     self.user1 = None
     self.user2 = None
     self.magic_number1 = None
     self.discussion_title = None
Example #11
0
 def test_mainpage_05(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Check if there are 18 products under "Just Arrived", if no => ERROR
     element = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.just_arrived_items)))
     assert len(
         element
     ) == 18, "ERROR. There are more/less than 18 products under 'Just Arrived'."
 def test_main(self, setup):
     self.driver = setup
     self.driver.get(self.baseURL)
     self.mp = MainPage(self.driver)
     self.mp.clickMain()
     self.mp.createAccount()
     self.mp.setFirstname(self.firstname)
     self.mp.setLastname(self.lastname)
     self.mp.setEmail(self.email)
     self.mp.setPassword(self.password)
     self.mp.clickbox()
Example #13
0
def start_watcher():
    base_page = BasePage()
    browser = base_page.browser

    login_page = LoginPage(browser)

    if login_page.check_if_is_not_logged_in():
        login_page.login({'phone_country': 55, 'phone_number': 31975325480})

    main_page = MainPage(browser)
    main_page.watch_channel('testedotelegra')
Example #14
0
 def test_mainpage_10(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on "We Belong to Something Beautiful" element
     main.click_something_beautiful()
     # Verify if the right page opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_smth_beautiful)))
     assert element.is_displayed(), "ERROR. The right page wasn't opened."
Example #15
0
 def test_mainpage_06(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Check if there are 18 products under "Editor's Picks", if no => ERROR
     element = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.editors_picks_items)))
     assert len(
         element
     ) == 18, "ERROR. There are more/less than 18 products under 'Editors' Picks'."
Example #16
0
 def test_mainpage_08(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Check if there are 18 products under "Recommended For You", if no => ERROR
     element = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.recommended_items)))
     assert len(
         element
     ) == 18, "ERROR. There are more/less than 18 products under 'Palettes and Value Sets'."
Example #17
0
 def test_mainpage_22(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "shaving" and hit enter
     main.set_site_search(self.search_item)
     # From "Sort by:" select "Price High to Low"
     main.click_dropdown_sort_by()
     main.click_price_high_low()
     # Verify if "Price High to Low" was selected
     element = wait.until(EC.presence_of_element_located((By.XPATH, MainPage.verify_high_low)))
     assert element, "ERROR. Products are not selected from high to low."
Example #18
0
 def test_mainpage_04(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     # Click on "Find a Store" link
     main.click_close_x_icon()
     main.click_find_store_link()
     # Check if page changed to "Find a Sephora", if no => ERROR
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_find_store)))
     assert element.is_displayed(
     ), "ERROR. Page did not changed to 'Find a Sephora'."
Example #19
0
 def test_mainpage_03(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     # Click "Track Order" link
     main.click_close_x_icon()
     main.click_track_order_link()
     # Check if page changed to "ORDER STATUS & HISTORY", if no => ERROR
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_track_order)))
     assert element.is_displayed(
     ), "ERROR. Page did not changed to 'ORDER STATUS & HISTORY'."
Example #20
0
 def test_mainpage_25(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "shaving" and hit enter
     main.set_site_search(self.search_item)
     # From "Sort by:" select "Price Low to High"
     main.click_dropdown_sort_by()
     main.click_price_low_high()
     # Verify if all the prices are listed correctly, from low to high
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_low_high)))
     assert element, "ERROR. Products are not selected from low to high."
Example #21
0
 def test_mainpage_29(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "shaving" and hit enter
     main.set_site_search(self.search_item)
     # Click "Sort by:" and select "Brand Name"
     main.click_dropdown_sort_by()
     main.click_brand_name_link()
     # Verify if all the brands are arranged in alphabetical order
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_brand_name)))
     assert element, "ERROR. Products are not sorted by Brand Name."
Example #22
0
 def test_mainpage_21(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "perfume" than hit enter
     main.set_site_search(self.search_item)
     # Scroll down the page
     main.scroll_down_page()
     # Verify if all the products on the first page of the search result are "perfume"
     element = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.search_result)))
     assert len(
         element
     ) == 60, "ERROR. There are more/less than 60 products on the first page result."
Example #23
0
 def test_mainpage_33(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on "NEW" dropdown box
     new = self.driver.find_element_by_xpath(MainPage.mouseover_new)
     new.click()
     # A lot of scrolling ;)
     main.scroll_down_page()
     main.scroll_down_page()
     main.scroll_down_page()
     main.scroll_down_page()
     main.scroll_down_page()
     main.scroll_down_page()
     # Check if all displayed products have "NEW" in the top left corner
     element = self.driver.find_element_by_xpath(MainPage.verify_new)
     assert element.text == "NEW", "ERROR. Not all the products are 'New'."
Example #24
0
 def test_mainpage_31(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "GIFTS" dropdown box
     brands = self.driver.find_element_by_xpath(MainPage.mouseover_brands)
     actions = action_chains.ActionChains(self.driver)
     actions.move_to_element(brands).perform()
     # Click on "Brands A-Z"
     brands_az = self.driver.find_element_by_xpath(MainPage.brands_a_z)
     brands_az.click()
     # Click on brand name "Dior"
     dior = self.driver.find_element_by_xpath(MainPage.brand_dior)
     dior.click()
     # Scroll down to the bottom of the page
     main.scroll_bottom_page()
     # Verify if only "Dior" products are displayed
     element = self.driver.find_element_by_xpath(MainPage.verify_dior)
     assert element.text == "DIOR", "ERROR. Not all products are Dior's."
Example #25
0
 def test_mainpage_16(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on "Terms of Use" (bottom of the page)
     element = wait.until(EC.element_to_be_clickable((By.XPATH, MainPage.terms_use_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(EC.presence_of_element_located((By.XPATH, MainPage.verify_terms_use)))
     assert element.is_displayed(), "ERROR. Sephora's Instagram page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on "Privacy Policy" link
     element = wait.until(EC.element_to_be_clickable((By.XPATH, MainPage.privacy_policy_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(EC.presence_of_element_located((By.XPATH, MainPage.verify_privacy_policy)))
     assert element.is_displayed(), "ERROR. Sephoria's Youtube page wasn't opened."
Example #26
0
 def test_mainpage_30(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "GIFTS" dropdown box
     gifts = self.driver.find_element_by_xpath(MainPage.mouseover_gifts)
     gifts.click()
     # Select "$10 and Under"
     ten_and_under = self.driver.find_element_by_xpath(
         MainPage.ten_and_under)
     ten_and_under.click()
     # Verify if all products are under or equal to $10
     prices = self.driver.find_elements_by_xpath(MainPage.prices_under_ten)
     for price in prices:
         x = price.text
         g = x.replace(".50", "")
         y = g.replace(".00", "")
         k = y.replace("$", "")
         print(int(k))
         assert int(k) <= 10, "ERROR. There are prices greater than $10."
Example #27
0
 def test_mainpage_32(self):
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Mouseover "GIFTS" dropdown box
     gifts = self.driver.find_element_by_xpath(MainPage.mouseover_gifts)
     gifts.click()
     # Click on "View All Gifts"
     view_all_gifts = self.driver.find_element_by_xpath(
         MainPage.view_all_gifts)
     view_all_gifts.click()
     # In "Filter by:" select "CLINIQUE" checkbox
     checkbox = self.driver.find_element_by_xpath(
         MainPage.clinique_checkbox)
     ActionChains(self.driver).click(checkbox).perform()
     # Scroll down to the bottom of the page
     main.scroll_bottom_page()
     # Verify if all the products names matches the selected "CLINIQUE" checkbox
     element = self.driver.find_element_by_xpath(MainPage.verify_clinique)
     assert element.text == "CLINIQUE", "ERROR. Not all products are Clinique's."
Example #28
0
 def test_mainpage_26(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # In the search bar type "shaving" and hit enter
     main.set_site_search(self.search_item)
     # Click on any category name, ex. "Skincare (16)"
     element = self.driver.find_element_by_xpath(MainPage.verify_skincare_1)
     x = element.text
     y = x.replace("Skincare (", "")
     z = y.replace(")", "")
     skin_n1 = int(z)
     main.click_skincare_link()
     # Scroll down the page
     main.scroll_down_page_lights()
     # Check to see if the number next to the category matches the number of products displayed (16)
     element = wait.until(
         EC.presence_of_all_elements_located(
             (By.XPATH, MainPage.verify_skincare_2)))
     assert len(
         element
     ) == skin_n1, "ERROR. User can view only that particular category."
Example #29
0
    def test_mainpage_24(self):
        main = MainPage(self.driver)
        main.click_close_x_icon()
        # In the search bar type "shaving" and hit enter
        main.set_site_search(self.search_item)
        # Adjust "Price Range" from $50 to $150
        main.set_sliders()
        # Scroll down the page
        main.scroll_down_page()
        # Verify if user can view only the products with the price between $50 and $150
        prices = self.driver.find_elements_by_xpath(MainPage.prices_50_150)
        for price in prices:
            x = price.text
            y = x.replace(".00", "")
            k = y.replace("$", "")
            q = k.replace("58 - ", "")
            z = q.replace("28 - ", "")
            w = int(z)
            if 50 <= w <= 150:
                print("OK. The products are in range between $50 and $150.")
            else:
                sys.exit("ERROR. The products are not in range between $50 and $150.")
        self.driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.HOME)
        time.sleep(1)
        # Click on "Reset all filters"
        main.click_reset_filters()
        time.sleep(1)
        # Verify if user can view all the products with price between 50-150 and other
        prices = self.driver.find_elements_by_xpath(MainPage.prices_50_150)
        for price in prices:
            x = price.text
#            y = x.replace(".00", "")
            k = x.replace("$", "")
            z = k.replace(" - ", "\n")
            w = float(z)
            if 5.00 <= w <= 160.00:
                print("OK. The products are in range between $5 and $160.")
            else:
                sys.exit("ERROR. The products are not in range between $5 and $160.")
Example #30
0
 def test_mainpage_12(self):
     wait = WebDriverWait(self.driver, 10)
     main = MainPage(self.driver)
     main.click_close_x_icon()
     # Click on "Affiliates" link (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.affiliates_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_affiliates)))
     assert element.is_displayed(
     ), "ERROR. 'Affiliates' page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on "Supply Chain Transparency" link (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.supply_chain_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_supply_chain)))
     assert element.is_displayed(
     ), "ERROR. 'Supply Chain Transparency' page wasn't opened."
     # Click back button on browser
     main.browser_back_button()
     # Click on "Sitemap" link (bottom of the page)
     element = wait.until(
         EC.element_to_be_clickable((By.XPATH, MainPage.sitemap_link)))
     element.click()
     # Verify if the right page was opened
     element = wait.until(
         EC.presence_of_element_located(
             (By.XPATH, MainPage.verify_sitemap)))
     assert element.is_displayed(), "ERROR. 'Sitemap' page wasn't opened."