public bool CreateCifPo(List <QuoteDetail> listOfQuoteDetail, string testEnvironment, bool removeInternalVendorNumber = false) { B2BHomePage.SelectEnvironment(RunEnvironment.ToString()); var orderId = OrderIdBase + DateTime.Today.ToString("yyMMdd") + DateTime.Now.ToString("HHmmss"); string poXml; poXml = PoXmlGenerator.GeneratePoCblForAsn(PoXmlFormat, orderId, IdentityName, listOfQuoteDetail, removeInternalVendorNumber); var parentWindow = webDriver.CurrentWindowHandle; B2BHomePage.ClickQaTools3(); if (!poOperations.SubmitXmlForPoCreation(poXml, RunEnvironment.ToString(), TargetUrl, testEnvironment, out poNumber)) { return(false); } if (!webDriver.CurrentWindowHandle.Equals(parentWindow)) { webDriver.Close(); } webDriver.SwitchTo().Window(parentWindow); return(true); }
public bool CreateDomsPo(List <QuoteDetail> listOfQuoteDetail, string testEnvironment) { B2BHomePage.SelectEnvironment(RunEnvironment.ToString()); var orderId = OrderIdBase + DateTime.Today.ToString("yyMMdd") + DateTime.Now.ToString("HHmmss"); crtId = listOfQuoteDetail.FirstOrDefault().CrtId; price = listOfQuoteDetail.FirstOrDefault().Price; string poXml; if (Workflow == Workflow.Eudc) { poXml = PoXmlGenerator.GeneratePoCxmlCblForEudc( PoXmlFormat, IdentityName, DeploymentMode, orderId, price, listOfQuoteDetail.FirstOrDefault().SupplierPartId, crtId); } else { poXml = PoXmlGenerator.GeneratePoCblForAsn(PoXmlFormat, orderId, IdentityName, listOfQuoteDetail); } var parentWindow = webDriver.CurrentWindowHandle; B2BHomePage.ClickQaTools3(); if (!poOperations.SubmitXmlForPoCreation(poXml, RunEnvironment.ToString(), TargetUrl, testEnvironment, out poNumber)) { return(false); } if (!webDriver.CurrentWindowHandle.Equals(parentWindow)) { webDriver.Close(); } webDriver.SwitchTo().Window(parentWindow); return(true); }
/* How to create 'E-Quote' or 'OrQuote' * Call CompleteEQuoteGeneration() with 5 arguments - * i) quoteType(equote/OrQuote) <-- Note pass only "equote" for E-Quote and "OrQuote" for OR-Quote * ii) environment - "Preview" or "Prod" * iii) profileId - In String * iv) name - any name <- will be used in equote * v) email - any email <- will be used in equote */ public bool CompleteQuoteGeneration( string profileId, string name, string email, RunEnvironment environment, Workflow workflow, PoXmlFormat format, string deploymentMode, string orderIdBase, string poTargetUrl, string configFilterVal, string testEnvironment, List <QuoteDetail> listOfQuoteDetail, out string poNumber, out List <QuoteDetail> quoteDetail) { string responseCode = "0"; var parentWindow = webDriver.CurrentWindowHandle; B2BHomePage.SelectEnvironment(environment.ToString()); // Quote Details are not available - Quote creation steps will be Executed else directly executes PO submission if (listOfQuoteDetail == null || !listOfQuoteDetail.Any() || string.IsNullOrEmpty(listOfQuoteDetail.FirstOrDefault().SupplierPartId)) { B2BHomePage.ClickQaTools3(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); webDriver.SwitchTo().Window(webDriver.WindowHandles.Last()); var QaToolsWindow = webDriver.CurrentWindowHandle; B2BQaToolsPage.SelectLocationAndEnvironment(environment.ToString(), testEnvironment); B2BQaToolsPage.ClickPunchoutCreate(); B2BQaToolsPage.ClickCxml(); B2BQaToolsPage.ClickCxmlMainCreate(); B2BQaToolsPage.IdentityForProfileCorrelator(profileId); B2BQaToolsPage.IdentityForUserId(profileId); B2BQaToolsPage.ClickApplyParameter(); B2BQaToolsPage.ClickSubmitMessage(); responseCode = B2BQaToolsPage.GetSubmissionResult(); Console.WriteLine("Response Code is :- " + responseCode); if (responseCode.Contains("200")) { string temp = B2BQaToolsPage.GetStoreLinkText(); Console.WriteLine("Link value is " + temp); B2BQaToolsPage.ClickStoreLink(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); webDriver.Close(); string newwindow = webDriver.WindowHandles.LastOrDefault(); webDriver.SwitchTo().Window(newwindow); //webDriver.SwitchTo().Window(webDriver.WindowHandles.Last()); var premierWindow = webDriver.CurrentWindowHandle; webDriver.Manage().Window.Maximize(); B2BPremierDashboardPage.WaitForTitle(); B2BPremierDashboardPage.OpenShop(); B2BPremierDashboardPage.ClickStandardConfiguration(); if (workflow == Workflow.Asn) { B2BStandardConfigurationPage.SelectSpecificConfiguration(configFilterVal, listOfQuoteDetail.FirstOrDefault().ItemDescription); } else { B2BStandardConfigurationPage.SelectFirstConfiguration(); } webDriver.WaitForPageLoad(new TimeSpan(0, 0, 20)); B2BStandardConfigurationPage.ClickAddSelectedToCartButton(); Console.WriteLine("Shoping Cart Page Title is :- " + ShopingCartPage.ReturnShopingCartTitle()); ShopingCartPage.ClickSaveQuote(listOfQuoteDetail.FirstOrDefault().QuoteType); // Starting EQuote Generation if (listOfQuoteDetail.FirstOrDefault().QuoteType == QuoteType.EQuote) { Console.WriteLine("EQuote Page Details Page Title is :-" + eQuoteDetailsPage.ReturnTitle()); eQuoteDetailsPage.EquoteNameSetting(name); eQuoteDetailsPage.SavedBySetting(email); eQuoteDetailsPage.ClickContinueButton(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); eQuoteSummaryPage.ClickContinueButton(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); finalEquoteSummaryPage.ClickSaveButton(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); listOfQuoteDetail.FirstOrDefault().SupplierPartId = "EQ:" + eQuoteGenerationPage.ReturnNumber(); listOfQuoteDetail.FirstOrDefault().Price = eQuoteGenerationPage.ReturnPrice().Replace("$", ""); Console.WriteLine("Your Equote Number is :- " + listOfQuoteDetail.FirstOrDefault().SupplierPartId); Console.WriteLine("Price is :- " + listOfQuoteDetail.FirstOrDefault().Price); webDriver.SwitchTo().Window(parentWindow); } // Starting OrQuote Generation else if (listOfQuoteDetail.FirstOrDefault().QuoteType == QuoteType.OrQuote) { B2BSecureCheckoutPage.EnterContactAndBillingInfo(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); listOfQuoteDetail.FirstOrDefault().Price = B2BTermsOfSalesPage.FindPrice().Replace("$", ""); B2BTermsOfSalesPage.ClickSubmitButton(); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); Console.WriteLine("Price is :- " + listOfQuoteDetail.FirstOrDefault().Price); listOfQuoteDetail.FirstOrDefault().SupplierPartId = B2BOrQuoteGenerationPage.FindOrQuote(); webDriver.SwitchTo().Window(parentWindow); } else { Console.WriteLine("Quote Type is not Specified"); poNumber = string.Empty; quoteDetail = listOfQuoteDetail; return(false); } } } // Generates PO Template var orderId = orderIdBase + DateTime.Today.ToString("yyMMdd") + DateTime.Now.ToString("HHmmss"); string poXml; if (workflow == Workflow.Eudc) { poXml = PoXmlGenerator.GeneratePoCxmlCblForEudc( format, profileId, deploymentMode, orderId, listOfQuoteDetail.FirstOrDefault().Price, listOfQuoteDetail.FirstOrDefault().SupplierPartId, listOfQuoteDetail.FirstOrDefault().CrtId); } else { poXml = PoXmlGenerator.GeneratePoCblForAsn(format, orderId, profileId, listOfQuoteDetail); } // Submits PO B2BHomePage.ClickQaTools3(); if (!poOperations.SubmitXmlForPoCreation(poXml, environment.ToString(), poTargetUrl, testEnvironment, out poNumber)) { quoteDetail = listOfQuoteDetail; return(false); } // verifies all validation after submiting PO webDriver.Close(); webDriver.SwitchTo().Window(parentWindow); webDriver.WaitForPageLoad(TimeSpan.FromSeconds(40)); quoteDetail = listOfQuoteDetail; return(true); }