public void WhenIFillPaymentForm() { StorefrontData storefront = sharedStorage.GetSharedInfo <StorefrontData>(ContextTag.GetStorefrontData); StorefrontPage storefrontPage = new StorefrontPage(Driver, _appSettings); storefrontPage.SetPaymentDataWithValidations(storefront); }
public void GivenIGetStorefrontDataFromFile(string file) { string data = DataFiles.ReadJsonDataFile(file); StorefrontData storefront = ObjectSerializer.DeserializeToObject <StorefrontData>(data); sharedStorage.SetSharedInfo(ContextTag.GetStorefrontData, storefront); }
internal void SetPaymentDataWithValidations(StorefrontData storefront) { //paymentMethod.ClickButton(); //paymentMethodList.ClickButton(); Browser.SwitchToFrame(iFrame.GetElement()); cardNumber.InputKey(storefront.InvalidCardNumber); Browser.SwitchToDefaultContent(); Assert.AreEqual(ErrorMessages.InvalidCardNum, paymentsError.GetElementValue()); Driver.SwitchTo().Frame(iFrame.GetElement()); cardNumber.InputKey(storefront.ValidCardNumber); Driver.SwitchTo().DefaultContent(); if (DictionaryProperties.Details["ScenarioName"].Contains(_appSettings.ScenarioName.PromoteDesign)) { ElementLocatorExtensions.GetElementXpath(commonButton, "Next").ClickButton(); } else { ElementLocatorExtensions.GetElementXpath(commonButton, "Add Card").ClickButton(); } Assert.AreEqual(ErrorMessages.RequiredExpError, paymentsError.GetElementValue()); Driver.SwitchTo().Frame(iFrame.GetElement()); expires.InputKey(storefront.InvalidExpires); Driver.SwitchTo().DefaultContent(); Assert.AreEqual(ErrorMessages.InvaidExp, paymentsError.GetElementValue()); Driver.SwitchTo().Frame(iFrame.GetElement()); expires.InputKey(storefront.ValidExpires); CVC.InputKey(storefront.InvalidCVC); Driver.SwitchTo().DefaultContent(); if (DictionaryProperties.Details["ScenarioName"].Contains(_appSettings.ScenarioName.PromoteDesign)) { ElementLocatorExtensions.GetElementXpath(commonButton, "Next").ClickButton(); } else { ElementLocatorExtensions.GetElementXpath(commonButton, "Add Card").ClickButton(); } Assert.AreEqual(ErrorMessages.RequiredCVC, paymentsError.GetElementValue()); Driver.SwitchTo().Frame(iFrame.GetElement()); CVC.InputKey(storefront.ValidCVC); Driver.SwitchTo().DefaultContent(); if (DictionaryProperties.Details["ScenarioName"].Contains(_appSettings.ScenarioName.PromoteDesign)) { ElementLocatorExtensions.GetElementXpath(commonButton, "Next").ClickButton(); } else { ElementLocatorExtensions.GetElementXpath(commonButton, "Add Card").ClickButton(); } Assert.AreEqual(ErrorMessages.RequiredPostal, paymentsError.GetElementValue()); }