Jelajahi Sumber

reorganisation fichier

Gogs 1 tahun lalu
induk
melakukan
4f18953f97
1 mengubah file dengan 46 tambahan dan 31 penghapusan
  1. 46 31
      test_sauce_demo_class.py

+ 46 - 31
test_sauce_demo_class.py

@@ -15,18 +15,9 @@ import os
 
 
 class TestSauceDemo:
-    def is_windows(self):
-        # oups
-        res = False
-        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é"
-        inputElement.clear()
-        inputElement.send_keys(text)
+##### METHODES PYTEST
+
 
     def setup_method(self, method):
         log.info("Methode de SETUP AVANT CHAQUE TEST")
@@ -47,6 +38,22 @@ class TestSauceDemo:
         log.info("Methode de TEARDOWN APRES CHAQUE TEST")
         self.driver.quit()
 
+
+
+##### METHODES DIVERS
+    def is_windows(self):
+        # oups
+        res = False
+        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é"
+        inputElement.clear()
+        inputElement.send_keys(text)
+
     def login(self):
         username = self.driver.find_element(By.ID, "user-name")
         password = self.driver.find_element(By.ID, "password")
@@ -55,6 +62,15 @@ class TestSauceDemo:
         writeInInput(inputElement=username, text="standard_user")
         writeInInput(password, text="secret_sauce")
         login.click()
+    
+    def login_custum(self, user, pwd):
+        username = self.driver.find_element(By.ID, "user-name")
+        password = self.driver.find_element(By.ID, "password")
+        login = self.driver.find_element(By.ID, "login-button")
+
+        writeInInput(inputElement=username, text=user)
+        writeInInput(password, text=pwd)
+        login.click()
 
     def logout(self):
         burger = self.driver.find_element(By.ID, "react-burger-menu-btn")
@@ -62,28 +78,28 @@ 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()
+
 
     def add_item(self, item):
         self.driver.find_element(By.ID, f"add-to-cart-sauce-labs-{item}").click()
         return item
 
-    ##### MATTHIEU
+    def go_to_checkout(self):
+        checkout = self.driver.find_element(By.CSS_SELECTOR, "#checkout")
+        checkout.click()
 
-    ##### MANEL
+    ##### TEST ABBAS
+    
+    @pytest.mark.skip("")
+    def test_saucedemo_boutenbout(self):
+        self.login()
+        self.logout()
+
+    ##### TEST MANEL
 
-    def login_custum(self, user, pwd):
-        username = self.driver.find_element(By.ID, "user-name")
-        password = self.driver.find_element(By.ID, "password")
-        login = self.driver.find_element(By.ID, "login-button")
 
-        writeInInput(inputElement=username, text=user)
-        writeInInput(password, text=pwd)
-        login.click()
 
+    @pytest.mark.skip("")
     def test_login_bad_username(self):
         self.login_custum("test", "secret_sauce")
 
@@ -95,6 +111,7 @@ class TestSauceDemo:
             == "Epic sadface: Username and password do not match any user in this service"
         ), "le message est erroné"
 
+    @pytest.mark.skip("")
     def test_login_bad_passwrd(self):
         self.login_custum("standard_user", "test")
 
@@ -106,13 +123,9 @@ class TestSauceDemo:
             == "Epic sadface: Username and password do not match any user in this service"
         ), "le message est erroné"
 
-    ##### MATTHIEU
+    ##### TEST 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")
 
@@ -135,7 +148,9 @@ class TestSauceDemo:
             == "https://www.saucedemo.com/checkout-step-one.html"
         ), "Nous ne somme pas sur la bonne page"
 
-    ##### TIFF
+    ##### TEST TIFF
+    
+    @pytest.mark.skip("")
     def test_add_item(self):
         self.login()
         sauce_labs_item = self.add_item("backpack")