def test_log_in(self): find_and_click(self.driver, ".inner___1T3DW > a:nth-child(12)") input_text(self.driver, "#login-email", "*****@*****.**") input_text(self.driver, "#login-password", "change1313") find_and_click( self.driver, "div.gl-vspace-bpall-small:nth-child(6) > button:nth-child(1)")
def test_check_order(self): # click "check the order" find_and_click(self.driver, ".inner___1T3DW > a:nth-child(6)") # input data input_text(self.driver, "div.field___22seD:nth-child(2) > input:nth-child(1)", "AD012345678") input_text(self.driver, "div.field___22seD:nth-child(3) > input:nth-child(1)", "*****@*****.**") # find order find_and_click(self.driver, "button.gl-cta:nth-child(4)")
def test_yahoo_logIn(self): find_and_click(self.driver, ".inner___1T3DW > a:nth-child(12)") yahoo_button = self.driver.find_element_by_css_selector( "button.gl-cta:nth-child(3)") if yahoo_button.is_enabled(): yahoo_button.click() else: print("Button not found")
def test_facebook_logIn(self): find_and_click(self.driver, ".inner___1T3DW > a:nth-child(12)") facebook_button = self.driver.find_element_by_css_selector( "button.gl-cta--secondary:nth-child(1)") if facebook_button.is_enabled(): facebook_button.click() else: print("button not found")
def test_login_scenario(self): for scenario in scenarios: find_and_click(self.driver, ".inner___1T3DW > a:nth-child(12)") email = self.driver.find_element_by_css_selector("#login-email").clear() input_text(self.driver, "#login-email", scenario['login']) password = self.driver.find_element_by_css_selector('#login-password').clear() input_text(self.driver, "#login-password", scenario['password']) find_and_click(self.driver, "div.gl-vspace-bpall-small:nth-child(6) > button:nth-child(1)") self.assertIn(scenario['error_message'], self.driver.page_source)
def test_add_product(self): # add text into search box input_and_click_enter(self.driver, ".searchinput___zXLAR", "short") # open product link open_link = self.driver.find_element_by_css_selector("div.grid-item___3rAkS:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)") open_link.send_keys(Keys.ENTER) # close alert find_and_click(self.driver, ".gl-modal__close > svg:nth-child(1)") # choose size find_and_click(self.driver, "button.size___TqqSo:nth-child(1)") # click add to card find_and_click(self.driver, ".add-to-bag___3wgQk > button:nth-child(1)") # check the product cart and verify that product are added find_and_click(self.driver, "a.gl-cta:nth-child(7)")
def test_forgot_password(self): find_and_click(self.driver, ".inner___1T3DW > a:nth-child(12)") find_and_click( self.driver, "div.col-l-10:nth-child(1) > form:nth-child(2) > a:nth-child(1)") input_text(self.driver, ".field__input___3eT4b", "*****@*****.**") find_and_click( self.driver, "div.gl-vspace-bpall-medium:nth-child(1) > button:nth-child(1)")
def test_join_club(self): find_and_click( self.driver, ".inner___1T3DW > div:nth-child(8) > em:nth-child(1) > a:nth-child(1)" ) input_text(self.driver, "#registration-email-field", "*****@*****.**") input_text(self.driver, "#registration-password-field", "change1313") find_and_click(self.driver, ".gl-form-item--inline") find_and_click(self.driver, "button.gl-cta:nth-child(8)")
def test_change_location(self): find_and_click(self.driver, ".country_selector_text___yovMX") find_and_click(self.driver, "#europe") # change location to Poland find_and_click( self.driver, "div.country-group:nth-child(4) > ul:nth-child(3) > li:nth-child(3) > a:nth-child(1)" ) self.driver.implicitly_wait(10) # seconds self.assertIn("POBIERZ", self.driver.page_source)
def test_set_remainder(self): # click the release date button find_and_click(self.driver, "div.glass-navigation-flyout-white___20EjX:nth-child(8) > a:nth-child(1)") # close alert find_and_click(self.driver, ".gl-modal__close > svg:nth-child(1)") # choose the product to set the remainder find_and_click(self.driver, "div.plc-product-card___1kN_6:nth-child(2) > div:nth-child(1) > a:nth-child(1)") # set a remainder find_and_click(self.driver, ".ctaButtonContainer___3a_3R > button:nth-child(1)") # add to calendar and choose the date find_and_click(self.driver, ".gl-cta--secondary") find_and_click(self.driver, "a.gl-cta--secondary:nth-child(1)")