|
@@ -0,0 +1,34 @@
|
|
|
|
+import logging as log
|
|
|
|
+import pytest
|
|
|
|
+from selenium import webdriver
|
|
|
|
+from selenium.webdriver.common.by import By
|
|
|
|
+from selenium.webdriver.firefox.options import Options
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+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 test_loginOK():
|
|
|
|
+ log.info("Test du Login avec succès")
|
|
|
|
+ options = webdriver.FirefoxOptions()
|
|
|
|
+ options.add_argument('--headless')
|
|
|
|
+
|
|
|
|
+ driver = webdriver.Firefox(options=options)
|
|
|
|
+ driver.get("https://www.saucedemo.com/")
|
|
|
|
+ assert driver.current_url == "https://www.saucedemo.com/", "Nous ne somme pas sur la bonne page"
|
|
|
|
+
|
|
|
|
+ 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()
|
|
|
|
+
|
|
|
|
+ assert driver.current_url == "https://www.saucedemo.com/inventory.html", "Nous ne somme pas sur la bonne page"
|
|
|
|
+
|
|
|
|
+ driver.quit()
|
|
|
|
+
|