|
@@ -14,17 +14,14 @@ from test_saucedemo import writeInInput
|
|
|
import os
|
|
|
|
|
|
|
|
|
-
|
|
|
-class TestSauceDemo():
|
|
|
-
|
|
|
-
|
|
|
+class TestSauceDemo:
|
|
|
def is_windows(self):
|
|
|
- #oups
|
|
|
+ # oups
|
|
|
res = False
|
|
|
- if os.name == 'nt':
|
|
|
+ if os.name == "nt":
|
|
|
res == True
|
|
|
return res
|
|
|
-
|
|
|
+
|
|
|
def writeInInput(self, inputElement, text):
|
|
|
assert inputElement.is_displayed(), "Le champ texte n'est pas affiché"
|
|
|
assert inputElement.is_enabled(), "Le champ texte n'est pas activé"
|
|
@@ -32,7 +29,7 @@ class TestSauceDemo():
|
|
|
inputElement.send_keys(text)
|
|
|
|
|
|
def setup_method(self, method):
|
|
|
- log.info("Methode de SETUP AVANT CHAQUE TEST")
|
|
|
+ log.info("Methode de SETUP AVANT CHAQUE TEST")
|
|
|
|
|
|
if self.is_windows():
|
|
|
self.driver = webdriver.Firefox()
|
|
@@ -42,7 +39,9 @@ class TestSauceDemo():
|
|
|
self.driver = webdriver.Firefox(options=options)
|
|
|
|
|
|
self.driver.get("http://www.saucedemo.com")
|
|
|
- assert (self.driver.current_url == "https://www.saucedemo.com/"), "Nous ne somme pas sur la bonne page"
|
|
|
+ assert (
|
|
|
+ self.driver.current_url == "https://www.saucedemo.com/"
|
|
|
+ ), "Nous ne somme pas sur la bonne page"
|
|
|
|
|
|
def teardown_method(self, method):
|
|
|
log.info("Methode de TEARDOWN APRES CHAQUE TEST")
|
|
@@ -63,47 +62,39 @@ class TestSauceDemo():
|
|
|
logout = self.driver.find_element(By.ID, "logout_sidebar_link")
|
|
|
logout.click()
|
|
|
|
|
|
-
|
|
|
@pytest.mark.skip("")
|
|
|
def test_saucedemo_boutenbout(self):
|
|
|
self.login()
|
|
|
self.logout()
|
|
|
|
|
|
+ ##### MATTHIEU
|
|
|
|
|
|
-##### MANEL
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-##### MATTHIEU
|
|
|
-
|
|
|
def go_to_checkout(self):
|
|
|
checkout = self.driver.find_element(By.CSS_SELECTOR, "#checkout")
|
|
|
checkout.click()
|
|
|
|
|
|
- #@pytest.mark.skip("")
|
|
|
+ # @pytest.mark.skip("")
|
|
|
def test_affichage_Checkout(self):
|
|
|
log.info("Test de la redirection sur la page de Checkout")
|
|
|
|
|
|
- #connexion Swag Labs
|
|
|
+ # connexion Swag Labs
|
|
|
self.login()
|
|
|
-
|
|
|
|
|
|
- #ajout "Sauce Labs Bike Light" au panier -- A changer si Tiff implémente une fonction pour le faire
|
|
|
+ # ajout "Sauce Labs Bike Light" au panier -- A changer si Tiff implémente une fonction pour le faire
|
|
|
item_lamp = self.driver.find_element(By.ID, "add-to-cart-sauce-labs-bike-light")
|
|
|
item_lamp.click()
|
|
|
|
|
|
- #affichage panier -- A changer si Tiff implémente une fonction pour le faire
|
|
|
- panier_btn= self.driver.find_element(By.ID, "shopping_cart_container")
|
|
|
+ # affichage panier -- A changer si Tiff implémente une fonction pour le faire
|
|
|
+ panier_btn = self.driver.find_element(By.ID, "shopping_cart_container")
|
|
|
panier_btn.click()
|
|
|
|
|
|
- #redirection vers la page de checkout
|
|
|
+ # redirection vers la page de checkout
|
|
|
self.go_to_checkout()
|
|
|
-
|
|
|
+
|
|
|
assert (
|
|
|
- self.driver.current_url == "https://www.saucedemo.com/checkout-step-one.html"
|
|
|
- ), "Nous ne somme pas sur la bonne page"
|
|
|
-
|
|
|
+ self.driver.current_url
|
|
|
+ == "https://www.saucedemo.com/checkout-step-one.html"
|
|
|
+ ), "Nous ne somme pas sur la bonne page"
|
|
|
+
|
|
|
|
|
|
##### TIFF
|
|
|
-
|