|
@@ -4,18 +4,18 @@ from selenium import webdriver
|
|
|
from selenium.webdriver.common.by import By
|
|
|
from selenium.webdriver.firefox.options import Options
|
|
|
import time
|
|
|
-
|
|
|
+from selenium.webdriver.support.ui import Select
|
|
|
#@pytest.mark.skip("je veux pas le faire")
|
|
|
@pytest.mark.skip("je veux pas le faire")
|
|
|
def element_visible_actif(element):
|
|
|
assert element.is_displayed()
|
|
|
assert element.is_enabled()
|
|
|
|
|
|
-#def writeInInput(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 writeInInput(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)
|
|
|
|
|
|
@pytest.mark.skip("je veux pas le faire")
|
|
|
def test_loginOK():
|
|
@@ -90,7 +90,7 @@ def test_login_KO_saucedemo():
|
|
|
time.sleep(3)
|
|
|
driver.quit()
|
|
|
|
|
|
-@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
def test_login_OK_logout_saucedemo():
|
|
|
|
|
|
#driver = webdriver.Chrome()
|
|
@@ -135,4 +135,116 @@ def test_login_OK_logout_saucedemo():
|
|
|
assert driver.current_url==url_sauce_demo, "L'url de la page ouverte ("+ driver.current_url+") n'est pas égal à "+url_sauce_demo
|
|
|
|
|
|
time.sleep(5)
|
|
|
- driver.quit()
|
|
|
+ driver.quit()
|
|
|
+
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+def test_Filtrer_par_Name_acendant():
|
|
|
+ driver = webdriver.Chrome()
|
|
|
+ driver.get("https://www.saucedemo.com/")
|
|
|
+
|
|
|
+ #log.info("Test du Login avec succès")
|
|
|
+ #options = webdriver.FirefoxOptions()
|
|
|
+ #options.add_argument('--headless')
|
|
|
+ #driver = webdriver.Firefox(options=options)
|
|
|
+
|
|
|
+ username = driver.find_element(By.ID,"user-name")
|
|
|
+ password = driver.find_element(By.ID,"password")
|
|
|
+ login = driver.find_element(By.ID, "login-button")
|
|
|
+
|
|
|
+ writeInInput(inputElement=username, text="standard_user")
|
|
|
+ writeInInput(password, text="secret_sauce")
|
|
|
+ login.click()
|
|
|
+
|
|
|
+ # button_login = driver.find_element(By.CLASS_NAME, "product_sort_container")
|
|
|
+
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ Filter_List = Select(driver.find_element(By.CLASS_NAME, "product_sort_container"))
|
|
|
+ Filter_List.select_by_value("az")
|
|
|
+ driver.quit()
|
|
|
+
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+def test_Filtrer_par_Name_decendant():
|
|
|
+ driver = webdriver.Chrome()
|
|
|
+ driver.get("https://www.saucedemo.com/")
|
|
|
+
|
|
|
+ #log.info("Test du Login avec succès")
|
|
|
+ #options = webdriver.FirefoxOptions()
|
|
|
+ #options.add_argument('--headless')
|
|
|
+ #driver = webdriver.Firefox(options=options)
|
|
|
+
|
|
|
+ username = driver.find_element(By.ID,"user-name")
|
|
|
+ password = driver.find_element(By.ID,"password")
|
|
|
+ login = driver.find_element(By.ID, "login-button")
|
|
|
+
|
|
|
+ writeInInput(inputElement=username, text="standard_user")
|
|
|
+ writeInInput(password, text="secret_sauce")
|
|
|
+ login.click()
|
|
|
+
|
|
|
+ # button_login = driver.find_element(By.CLASS_NAME, "product_sort_container")
|
|
|
+
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ Filter_List = Select(driver.find_element(By.CLASS_NAME, "product_sort_container"))
|
|
|
+ Filter_List.select_by_value("za")
|
|
|
+ driver.quit()
|
|
|
+
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+def test_Filtrer_par_Price_high_to_low():
|
|
|
+ driver = webdriver.Chrome()
|
|
|
+ driver.get("https://www.saucedemo.com/")
|
|
|
+
|
|
|
+ #log.info("Test du Login avec succès")
|
|
|
+ #options = webdriver.FirefoxOptions()
|
|
|
+ #options.add_argument('--headless')
|
|
|
+ #driver = webdriver.Firefox(options=options)
|
|
|
+
|
|
|
+ username = driver.find_element(By.ID,"user-name")
|
|
|
+ password = driver.find_element(By.ID,"password")
|
|
|
+ login = driver.find_element(By.ID, "login-button")
|
|
|
+
|
|
|
+ writeInInput(inputElement=username, text="standard_user")
|
|
|
+ writeInInput(password, text="secret_sauce")
|
|
|
+ login.click()
|
|
|
+
|
|
|
+ # button_login = driver.find_element(By.CLASS_NAME, "product_sort_container")
|
|
|
+
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ Filter_List = Select(driver.find_element(By.CLASS_NAME, "product_sort_container"))
|
|
|
+ time.sleep(5)
|
|
|
+ Filter_List.select_by_value("hilo")
|
|
|
+ time.sleep(10)
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ driver.quit()
|
|
|
+
|
|
|
+#@pytest.mark.skip("JE VEUX PAS LE FAIRE")
|
|
|
+def test_Filtrer_par_Price_low_to_high():
|
|
|
+ driver = webdriver.Chrome()
|
|
|
+ driver.get("https://www.saucedemo.com/")
|
|
|
+
|
|
|
+ #log.info("Test du Login avec succès")
|
|
|
+ #options = webdriver.FirefoxOptions()
|
|
|
+ #options.add_argument('--headless')
|
|
|
+ #driver = webdriver.Firefox(options=options)
|
|
|
+
|
|
|
+ username = driver.find_element(By.ID,"user-name")
|
|
|
+ password = driver.find_element(By.ID,"password")
|
|
|
+ login = driver.find_element(By.ID, "login-button")
|
|
|
+
|
|
|
+ writeInInput(inputElement=username, text="standard_user")
|
|
|
+ writeInInput(password, text="secret_sauce")
|
|
|
+ login.click()
|
|
|
+
|
|
|
+ # button_login = driver.find_element(By.CLASS_NAME, "product_sort_container")
|
|
|
+
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ Filter_List = Select(driver.find_element(By.CLASS_NAME, "product_sort_container"))
|
|
|
+ time.sleep(5)
|
|
|
+ Filter_List.select_by_value("lohi")
|
|
|
+ time.sleep(10)
|
|
|
+ #log.info(button_login.get_attribute('value'))
|
|
|
+
|
|
|
+ driver.quit()
|