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);
        }
Exemple #2
0
 public void UploadCrtFile(
     RunEnvironment environment,
     string crossReferenceType,
     string filePath,
     string description)
 {
     B2BHomePage.SelectEnvironment(environment.ToString());
     B2BHomePage.ClickCrossReferenceListLink();
     B2BCrossReferenceListPage.ClickNewCrossReference();
     ////selects CRT Type
     B2BCrossReferenceMaintenencePage.SelectCrossReferenceType(crossReferenceType);
     ////Sets the path for File Upload
     B2BCrossReferenceMaintenencePage.SetUploadFilePath(filePath);
     B2BCrossReferenceMaintenencePage.SetDescription(description);
     B2BCrossReferenceMaintenencePage.ClickSave();
 }
Exemple #3
0
        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);
        }
Exemple #5
0
 /// <summary>
 /// Select the Enviornment
 /// </summary>
 /// <param name="environment"></param>
 public void SelectEnviornment(RunEnvironment environment)
 {
     B2BHomePage.SelectEnvironment(environment.ToString());
 }
 private static bool IsEnv(RunEnvironment env)
 {
     return(GetValue("ENVIRONMENT").IndexOf(env.ToString(), StringComparison.InvariantCultureIgnoreCase) > -1);
 }
        /// <summary>
        /// Creates Buyer Catalog and processes PO
        /// </summary>
        public void CreateBhcPo()
        {
            B2BHomePage.SelectEnvironment(RunEnvironment.ToString());
            if (ListOfQuoteDetail == null || !ListOfQuoteDetail.Any() ||
                string.IsNullOrEmpty(ListOfQuoteDetail.FirstOrDefault().SupplierPartId))
            {
                const int NumberOfRetries = 10;
                B2BHomePage.ClickOnBuyerCatalogLink();
                var threadId = B2BCreateBuyerCatalogPage.GenerateCatalog(
                    Workflow,
                    ProfileName,
                    IdentityName,
                    ValidityEnd,
                    NotificationEmail,
                    ConfigurationType);
                B2BCreateBuyerCatalogPage.GoToBuyerCatalogListPage();
                B2BBuyerCatalogListPage.SearchForBuyerCatalog(ProfileName);
                if (!B2BBuyerCatalogListPage.CheckCatalogAvailabilityAndAct(threadId))
                {
                    Console.WriteLine("The catalog status is not = 'Available'. Retrying....");
                    for (var i = 0; i < NumberOfRetries; i++)
                    {
                        System.Threading.Thread.Sleep(20000);
                        Console.WriteLine("Retry No. {0}", i + 1);
                        B2BBuyerCatalogListPage.SearchForBuyerCatalog(ProfileName);
                        if (B2BBuyerCatalogListPage.CheckCatalogAvailabilityAndAct(threadId))
                        {
                            break;
                        }

                        if (i != (NumberOfRetries - 1))
                        {
                            continue;
                        }

                        Console.WriteLine("The catalog status is still not 'Available'. No. of retries {0}", i + 1);
                        return;
                    }
                }

                if (Workflow == Workflow.Eudc)
                {
                    ListOfQuoteDetail = B2BCatalogViewer.GetQuoteDetails(CrtId, Quantity, QuoteType);
                }
                else
                {
                    ListOfQuoteDetail = B2BCatalogViewer.GetQuoteDetails(CrtId, Quantity, QuoteType, ConfigTitles);
                }
            }

            var orderId = OrderIdBase + DateTime.Today.ToString("yyMMdd") + DateTime.Now.ToString("HHmmss");

            string poXml;

            if (Workflow == Workflow.Eudc)
            {
                poXml = PoXmlGenerator.GeneratePoCxmlCblForEudc(
                    PoXmlFormat,
                    IdentityName,
                    DeploymentMode,
                    orderId,
                    ListOfQuoteDetail.FirstOrDefault().Price,
                    ListOfQuoteDetail.FirstOrDefault().SupplierPartId,
                    ListOfQuoteDetail.FirstOrDefault().CrtId);
            }
            else
            {
                poXml = PoXmlGenerator.GeneratePoCblForAsn(PoXmlFormat, orderId, IdentityName, ListOfQuoteDetail);
            }

            var parentWindow = webDriver.CurrentWindowHandle;

            B2BCatalogViewer.ClickQaTools3();

            if (!poOperations.SubmitXmlForPoCreation(poXml, RunEnvironment.ToString(), TargetUrl, TestEnvironment, out poNumber))
            {
                return;
            }

            if (!webDriver.CurrentWindowHandle.Equals(parentWindow))
            {
                webDriver.Close();
            }

            webDriver.SwitchTo().Window(parentWindow);
            B2BCatalogViewer.GoToHomePage();
        }