|
@@ -8,7 +8,7 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
|
from selenium.common.exceptions import TimeoutException
|
|
|
|
|
|
-debug = True
|
|
|
+debug = False
|
|
|
|
|
|
def slip(secondes):
|
|
|
if debug:
|
|
@@ -29,7 +29,7 @@ def writeInInput(inputElement, text):
|
|
|
inputElement.send_keys(text)
|
|
|
|
|
|
|
|
|
-@pytest.mark.skip("Je veux pas le faire")
|
|
|
+# @pytest.mark.skip("Je veux pas le faire")
|
|
|
def test_loginOK():
|
|
|
log.info("Test du Login avec succès")
|
|
|
options = webdriver.FirefoxOptions()
|
|
@@ -52,7 +52,7 @@ def test_loginOK():
|
|
|
|
|
|
driver.quit()
|
|
|
|
|
|
-@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+# @pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
def test_login_KO_saucedemo():
|
|
|
|
|
|
options = webdriver.FirefoxOptions()
|
|
@@ -88,7 +88,7 @@ def test_login_KO_saucedemo():
|
|
|
slip(5)
|
|
|
driver.quit()
|
|
|
|
|
|
-@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+# @pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
def test_login_OK_logout_saucedemo():
|
|
|
|
|
|
options = webdriver.FirefoxOptions()
|
|
@@ -142,7 +142,7 @@ def test_login_OK_logout_saucedemo():
|
|
|
slip(2)
|
|
|
driver.quit()
|
|
|
|
|
|
-@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+# @pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
def test_ajout_panier():
|
|
|
|
|
|
options = webdriver.FirefoxOptions()
|
|
@@ -228,7 +228,7 @@ def exists_element_by_id(driver, class_elt):
|
|
|
return False
|
|
|
return True
|
|
|
|
|
|
-@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
def test_click_button_add_to_cart():
|
|
|
log.info('Test sur le bouton "add to cart" change pour "remove" quand on clic dessus + bouton panier s\'incrémente')
|
|
|
options = webdriver.FirefoxOptions()
|
|
@@ -259,6 +259,7 @@ def test_click_button_add_to_cart():
|
|
|
|
|
|
# Vérification clic button "add to cart" change de texte vers "remove"
|
|
|
button_add = driver.find_element(By.ID,"add-to-cart-sauce-labs-backpack")
|
|
|
+ slip(2)
|
|
|
button_add.click()
|
|
|
log.info("click sur 'add to cart' change button and add a badge on icon cart")
|
|
|
badge_panier = driver.find_element(By.CLASS_NAME,"shopping_cart_badge")
|
|
@@ -271,6 +272,7 @@ def test_click_button_add_to_cart():
|
|
|
|
|
|
# Vérification clic button "remove" change de texte vers "add to cart"
|
|
|
button_remove = driver.find_element(By.ID,"remove-sauce-labs-backpack")
|
|
|
+ slip(2)
|
|
|
button_remove.click()
|
|
|
log.info("click sur 'Remove' change button and remove the badge on icon cart")
|
|
|
assert True == exists_element_by_id(driver,"add-to-cart-sauce-labs-backpack")
|
|
@@ -278,6 +280,7 @@ 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")
|
|
|
|
|
|
+
|
|
|
driver.quit()
|
|
|
|
|
|
|
|
@@ -335,4 +338,5 @@ def test_detail_article():
|
|
|
|
|
|
|
|
|
slip(2)
|
|
|
- driver.quit()
|
|
|
+ driver.quit()
|
|
|
+
|