@@ -24,12 +24,18 @@ def test_coffee_promo_with_preview(self):
2424 self .click ('div[data-test="Americano"]' )
2525 self .click ('div[data-test="Cafe_Latte"]' )
2626 self .assert_exact_text ("cart (3)" , 'a[aria-label="Cart page"]' )
27- self .assert_text ("Get an extra cup of Mocha for $4." , "div.promo" )
28- self .click ("div.promo button.yes" )
29- self .assert_exact_text ("cart (4)" , 'a[aria-label="Cart page"]' )
27+ promo = False
28+ total_string = "Total: $33.00"
29+ if self .is_element_visible ("div.promo" ):
30+ self .assert_text ("Get an extra cup of Mocha for $4." , "div.promo" )
31+ self .click ("div.promo button.yes" )
32+ self .assert_exact_text ("cart (4)" , 'a[aria-label="Cart page"]' )
33+ promo = True
34+ total_string = "Total: $37.00"
3035 self .hover ('button[data-test="checkout"]' )
31- self .assert_text ("(Discounted) Mocha" , "ul.cart-preview" )
32- self .assert_exact_text ("Total: $37.00" , 'button[data-test="checkout"]' )
36+ if promo :
37+ self .assert_text ("(Discounted) Mocha" , "ul.cart-preview" )
38+ self .assert_exact_text (total_string , 'button[data-test="checkout"]' )
3339 self .click ('button[data-test="checkout"]' )
3440 self .type ("input#name" , "Selenium Coffee" )
3541 self .type ("input#email" , "test@test.test" )
0 commit comments