public static void AddUpliftToCart() { WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30)); NavigationActions.NavigateOurProductsOmegaClick(); UpliftOrderPageObjects uopo = new UpliftOrderPageObjects(); UpliftPageObjects upo = new UpliftPageObjects(); LandingPageObjects lan = new LandingPageObjects(); try { NavigationActions.NavigateOurProductsOmegaClick(); try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e); } lan.CookieAlertAcceptButton.Click(); Task.Delay(500).Wait(1500); upo.ScrollViewport(); var NumOfProducts = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } uopo.IncrementArrowOrder.Click(); var incrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e); } uopo.DecrementArrowOrder.Click(); var decrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } uopo.AddToCartOrder.Click(); NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects(); Thread.Sleep(1000); var NumInCart = nav.CartIconCounter.Text; Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); upo.NavigateToProceedToCheckoutAndClick(); } catch (ArgumentException e) { Console.WriteLine(e); } }
public static void AddUpliftInstallmentPayCapsulePayInFullRecurringToCart() { try { WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30)); NavigationActions.NavigateOurProductsUpliftClick(); UpliftPageObjects upo = new UpliftPageObjects(); try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); // Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e); } LandingPageObjects lan = new LandingPageObjects(); Thread.Sleep(1000); lan.CookieAlertAcceptButton.Click(); Task.Delay(500).Wait(1500); upo.ScrollViewport(); UpliftOrderPageObjects uopo = new UpliftOrderPageObjects(); var NumOfProducts = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } uopo.IncrementArrowOrder.Click(); var incrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e); } uopo.DecrementArrowOrder.Click(); var decrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } uopo.AddToCartOrder.Click(); NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects(); Thread.Sleep(1000); var NumInCart = nav.CartIconCounter.Text; Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); CartPageObjects carp = new CartPageObjects(); carp.PayInInstallments.Click(); NavigationActions.NavigateOurProductsCapsulesClick(); CapsulesPageObjects caps = new CapsulesPageObjects(); try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e);; } caps.ClickVegetablesAndFruitCapsuleShopNow(); CapsulesOrderPageObjects cpo = new CapsulesOrderPageObjects(); try { Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Fruit & Vegetable Blend Capsules")); } catch (Exception e) { Console.WriteLine(e); } caps.ScrollViewport(); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } cpo.IncrementArrowOrderCapsules.Click(); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e);; } cpo.DecrementArrowOrderCapsules.Click(); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } cpo.AddToCartOrderCapsules.Click(); Thread.Sleep(1000); Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } Thread.Sleep(500); nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); carp.NavigateToProceedToCheckoutAndClick(); } catch (ArgumentException e) { Console.WriteLine(e); } }