|
@@ -147,7 +147,6 @@ def test_ajout_panier():
|
|
|
|
|
|
options = webdriver.FirefoxOptions()
|
|
|
options.add_argument('--headless')
|
|
|
-
|
|
|
driver = webdriver.Firefox(options=options)
|
|
|
|
|
|
#driver=webdriver.Chrome()
|
|
@@ -159,25 +158,58 @@ def test_ajout_panier():
|
|
|
|
|
|
champ_username = driver.find_element(By.XPATH,'//*[@id="user-name"]')
|
|
|
|
|
|
- log.info(champ_username)
|
|
|
+
|
|
|
champ_username.send_keys("standard_user")
|
|
|
- log.info("texte du champ username"+champ_username.text)
|
|
|
- log.info("L'attribut du champ username est "+ champ_username.get_attribute("placeholder") )
|
|
|
+
|
|
|
assert champ_username.get_attribute("value")=="standard_user"
|
|
|
|
|
|
champ_mdp = driver.find_element(By.CSS_SELECTOR,'#password')
|
|
|
champ_mdp.send_keys("secret_sauce")
|
|
|
# champ_mdp.send_keys(Keys.RETURN)
|
|
|
+
|
|
|
button_login = driver.find_element(By.ID,"login-button")
|
|
|
element_visible_actif(button_login)
|
|
|
button_login.click()
|
|
|
+
|
|
|
+ slip(2)
|
|
|
+
|
|
|
+
|
|
|
assert driver.current_url=="https://www.saucedemo.com/inventory.html", "l'url de la page ouverte ("+ driver.current_url + ") n'est pas égal à https://www.saucedemo.com/inventory.html"
|
|
|
+
|
|
|
button_add=driver.find_element(By.ID,"add-to-cart-sauce-labs-backpack")
|
|
|
+ element_visible_actif(button_add)
|
|
|
button_add.click()
|
|
|
+ slip(2)
|
|
|
+
|
|
|
+ icone_panier=driver.find_element(By.CLASS_NAME,"shopping_cart_badge")
|
|
|
+ assert icone_panier.text=="1", "l'icone du panier nn'affiche pas 1"
|
|
|
+
|
|
|
+ button_add=driver.find_element(By.ID,"add-to-cart-sauce-labs-bolt-t-shirt")
|
|
|
+ element_visible_actif(button_add)
|
|
|
+ button_add.click()
|
|
|
+ slip(2)
|
|
|
+
|
|
|
+ icone_panier=driver.find_element(By.CLASS_NAME,"shopping_cart_badge")
|
|
|
+ assert icone_panier.text=="2", "l'icone du panier n'affiche pas 2"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
button_panier=driver.find_element(By.CLASS_NAME,"shopping_cart_link")
|
|
|
+ element_visible_actif(button_panier)
|
|
|
button_panier.click()
|
|
|
+ assert driver.current_url=="https://www.saucedemo.com/cart.html", "l'url de la page ouverte ("+ driver.current_url + ") n'est pas égal à https://www.saucedemo.com/cart.html"
|
|
|
+
|
|
|
+ nom_article_panier=driver.find_element(By.ID,"item_4_title_link")
|
|
|
+ element_visible_actif(nom_article_panier)
|
|
|
+ assert nom_article_panier.text=="Sauce Labs Backpack"
|
|
|
+
|
|
|
+ nom_article_panier=driver.find_element(By.ID,"item_1_title_link")
|
|
|
+ element_visible_actif(nom_article_panier)
|
|
|
+ assert nom_article_panier.text=="Sauce Labs Bolt T-Shirt"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- slip(2)
|
|
|
driver.quit()
|
|
|
|
|
|
def exists_element_by_classname(driver, class_elt):
|
|
@@ -247,5 +279,6 @@ def test_click_button_add_to_cart():
|
|
|
# Vérification button "cart" a un badge supprimé car 0 articles dans le panier
|
|
|
assert False == exists_element_by_classname(driver,"shopping_cart_badge")
|
|
|
|
|
|
+
|
|
|
slip(2)
|
|
|
driver.quit()
|