|
@@ -11,11 +11,19 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
|
from selenium.webdriver.support.ui import Select
|
|
|
from selenium.webdriver.firefox.options import Options
|
|
|
from test_saucedemo import writeInInput
|
|
|
+import os
|
|
|
|
|
|
|
|
|
|
|
|
class TestSauceDemo():
|
|
|
|
|
|
+
|
|
|
+ def is_windows():
|
|
|
+ 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é"
|
|
@@ -23,10 +31,17 @@ class TestSauceDemo():
|
|
|
inputElement.send_keys(text)
|
|
|
|
|
|
def setup_method(self, method):
|
|
|
- log.info("Methode de SETUP AVANT CHAQUE TEST")
|
|
|
- self.driver = webdriver.Firefox()
|
|
|
+ log.info("Methode de SETUP AVANT CHAQUE TEST")
|
|
|
+
|
|
|
+ if self.is_windows():
|
|
|
+ self.driver = webdriver.Firefox()
|
|
|
+ else:
|
|
|
+ options = webdriver.FirefoxOptions()
|
|
|
+ options.add_argument("--headless")
|
|
|
+ self.driver = webdriver.Firefox(options=options)
|
|
|
+
|
|
|
self.driver.get("http://www.saucedemo.com")
|
|
|
- #TODO ASSERT
|
|
|
+ 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")
|
|
@@ -47,9 +62,7 @@ class TestSauceDemo():
|
|
|
logout= self.driver.find_element(By.ID, "logout_sidebar_link")
|
|
|
logout.click()
|
|
|
|
|
|
- def go_to_checkout(self):
|
|
|
- checkout = driver.find_element(By.CSS_SELECTOR, "#checkout")
|
|
|
- checkout.click()
|
|
|
+
|
|
|
|
|
|
def test_saucedemo_boutenbout(self):
|
|
|
self.login()
|
|
@@ -61,4 +74,20 @@ class TestSauceDemo():
|
|
|
|
|
|
def test_saucedemo_boutenbout_3(self):
|
|
|
self.login()
|
|
|
- self.logout()
|
|
|
+ self.logout()
|
|
|
+
|
|
|
+
|
|
|
+##### MANEL
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+##### MATTHIEU
|
|
|
+
|
|
|
+ def go_to_checkout(self):
|
|
|
+ checkout = self.driver.find_element(By.CSS_SELECTOR, "#checkout")
|
|
|
+ checkout.click()
|
|
|
+
|
|
|
+
|
|
|
+##### TIFF
|
|
|
+
|