|
@@ -152,11 +152,18 @@ class TestSauceDemo:
|
|
|
@pytest.mark.skip("")
|
|
|
def test_add_item(self):
|
|
|
self.login()
|
|
|
- sauce_labs_item = self.add_item("backpack")
|
|
|
- shopping_container = self.driver.find_element(By.ID, "shopping_cart_container")
|
|
|
+ backpack_item = "backpack"
|
|
|
+ add_to_cart_button = self.driver.find_element(
|
|
|
+ By.ID, f"add-to-cart-sauce-labs-{backpack_item}"
|
|
|
+ )
|
|
|
+ sauce_labs_item = self.add_item(backpack_item)
|
|
|
+ log.info(f"Le bouton : {add_to_cart_button} est cliqué")
|
|
|
+ post_add_item_click = self.driver.find_element(
|
|
|
+ By.ID, f"remove-sauce-labs-{backpack_item}"
|
|
|
+ )
|
|
|
assert (
|
|
|
- sauce_labs_item != shopping_container.text
|
|
|
- ), f"L'item {sauce_labs_item} ne correspond pas à l'item {shopping_container.text} présent dans le panier."
|
|
|
+ add_to_cart_button == post_add_item_click
|
|
|
+ ), f"Le bouton {add_to_cart_button} ne correspond pas au résultat attendu qui est : {post_add_item_click}"
|
|
|
log.info(
|
|
|
- f"L'item : {shopping_container.text} a été ajouté et l'item : {sauce_labs_item} était attendu"
|
|
|
+ f"Avant d'ajouter l'item le bouton proposé est : {add_to_cart_button} et le bouton est : {post_add_item_click} après ajout de l'item"
|
|
|
)
|