Beispiel #1
0
        // [Test]

        public void TC27_SIT_Library_Materials()
        {
            try
            {
                GeneralMethods sGMethods = new GeneralMethods();
                Thread.Sleep(10000);
                xCellFileHelper = new ExcelHelper(datafilePath, 1);
                string username = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "PDQAUSER"); //"admtempjavas";
                string password = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "PDQAPWD");  //"admtempjavas";
                string season   = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "Season");   // "7-2018";
                string office   = "CNSH";
                Thread.Sleep(1000);
                // GeneralMethods sGMethods = new GeneralMethods();
                driver.Manage().Window.Maximize();
                Thread.Sleep(1000);
                driver.Navigate().GoToUrl(ConfigUtils.Read("URL_Castor"));
                Thread.Sleep(1000);
                List <string> lswins = driver.WindowHandles.ToList();
                sGMethods.GetLatestWindow(driver);
                Castorpages castorobjs = new Castorpages(driver);
                //castorobjs.CastorLogin(
                //xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "librarianUser"),
                //xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "librarianPassword"));
                castorobjs.CastorLogin(username, password);
                Reporter.ReportEvent("Login to Application with user : "******"Login Pass", HP.LFT.Report.Status.Passed);

                Thread.Sleep(20000);

                //*******************************************************************************************
                libraryUi.Materials();
                Reporter.ReportEvent("Launch Materials", "Launch Materials Pass", HP.LFT.Report.Status.Passed);

                libraryUi.traverseContentFrame();
                libraryUi.tabFrame();
                libraryUi.get_MaterialTab("Denim").Click();
                Reporter.ReportEvent("Launch Materials Denim", "Launch Materials Denim Pass", HP.LFT.Report.Status.Passed);

                libraryUi.traverseContentFrame();
                libraryUi.tabFrame();
                // libraryUi.tabFrame();
                libraryUi.traverseToContentBodyFrameTableSettings();
                libraryUi.get_ActionLinkForDropDown().Click();
                libraryUi.get_CreateCreateFancyForDropDown().Click();
                Reporter.ReportEvent("Create new Materials", "Create new Materials Pass", HP.LFT.Report.Status.Passed);

                string libraryWindow = libraryUi.get_libraryWindow();
                libraryUi.get_NewLaunchedWindow();
                Thread.Sleep(20000);
                if (libraryUi.get_MaterialText().Displayed)
                {
                    System.Diagnostics.Debug.WriteLine("******* PASS");
                }
                sGMethods.SelectDropDownByValue(libraryUi.get_FabricTypeDropDown(), "Comfort Stretch Denim");
                libraryUi.get_txtDescriptionTextBox().Click();
                libraryUi.get_txtDescriptionTextBox().SendKeys("Automation Test");
                sGMethods.SelectDropDownByValue(libraryUi.get_OfficeIdDropDown(), office);
                sGMethods.SelectDropDownByValue(libraryUi.get_SeasonIdDropDown(), season);
                libraryUi.get_DoneButton().Click();
                Thread.Sleep(30000);
                driver.SwitchTo().Window(libraryWindow);
                Thread.Sleep(4000);
                libraryUi.traverseContentFrame();
                driver.SwitchTo().Frame("detailsDisplay");
                Reporter.ReportEvent("Create new Materials in new popup", "Create new Materials in new popup Failed", HP.LFT.Report.Status.Passed);

                libraryUi.get_EditButton().Click();
                Reporter.ReportEvent("Edit created Materials", "Edit created Materials Failed", HP.LFT.Report.Status.Passed);
                Thread.Sleep(1000);
                libraryUi.get_btnSupplier().Click();
                Thread.Sleep(1000);
                libraryWindow = libraryUi.get_libraryWindow();
                libraryUi.get_NewLaunchedWindow();
                Thread.Sleep(5000);
                driver.SwitchTo().DefaultContent();
                driver.SwitchTo().Frame("searchPane");
                sGMethods.SelectDropDownByValue(libraryUi.get_OfficeIdDropDown(), office);
                Thread.Sleep(5000);
                driver.SwitchTo().DefaultContent();
                libraryUi.get_FindButton().Click();
                Thread.Sleep(5000);
                IAlert alert = driver.SwitchTo().Alert();
                alert.Accept();
                driver.SwitchTo().Frame("listDisplay");
                Thread.Sleep(2000);
                libraryUi.get_btnSupplierCheckBox().Click();
                Thread.Sleep(2000);
                driver.SwitchTo().DefaultContent();
                Reporter.ReportEvent("Selected supplier for new Materials", "Selected supplier for new Materials Failed",
                                     HP.LFT.Report.Status.Passed);
                libraryUi.get_SubmitButton().Click();
                Thread.Sleep(2000);
                driver.SwitchTo().Window(libraryWindow);
                System.Diagnostics.Debug.WriteLine(driver.Title);
                Thread.Sleep(3000);
                libraryUi.traverseContentFrame();
                driver.SwitchTo().Frame("detailsDisplay");
                if (libraryUi.get_btnFiberContent().Displayed)
                {
                    Thread.Sleep(3000);
                }
                libraryUi.get_btnFiberContent().Click();
                Reporter.ReportEvent("Selected FiberContent for new Materials", "Selected FiberContent for new Materials Failed",
                                     HP.LFT.Report.Status.Passed);
                libraryWindow = libraryUi.get_libraryWindow();
                libraryUi.get_NewLaunchedWindow();
                driver.SwitchTo().Frame("fabricContentTable");
                driver.SwitchTo().Frame("tableContentFrame");
                driver.SwitchTo().Frame("tableBodyRight");
                libraryUi.get_materialCompositionType()[2].Click();
                libraryUi.get_materialCompositionType()[2].Clear();
                libraryUi.get_materialCompositionType()[2].SendKeys("100");
                driver.SwitchTo().DefaultContent();
                libraryUi.get_DoneButtonPopUp().Click();
                driver.SwitchTo().Window(libraryWindow);
                libraryUi.traverseContentFrame();
                driver.SwitchTo().Frame("detailsDisplay");
                libraryUi.get_btnPurchaseCost().Clear();
                libraryUi.get_btnPurchaseCost().SendKeys("4");
                sGMethods.SelectDropDownByValue(libraryUi.get_btnCurrencyId(), "EUR");
                sGMethods.SelectDropDownByValue(libraryUi.get_btnPurchaseUOMId(), "cm");
                Thread.Sleep(10000);
                libraryUi.traverseContentFrame();
                driver.SwitchTo().Frame("detailsDisplay");
                libraryUi.get_DoneButtonCastor().Click();
                libraryUi.get_Initiatedlink().Click();
                libraryWindow = libraryUi.get_libraryWindow();
                libraryUi.get_NewLaunchedWindow();
                Thread.Sleep(5000);
                driver.SwitchTo().DefaultContent();
                driver.SwitchTo().Frame("pagecontent");
                if (libraryUi.get_stateNameHighlight("Initiated").Displayed)
                {
                    System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS");
                }
                Reporter.ReportEvent("Status is Initiated", "Status is Initiated Pass", HP.LFT.Report.Status.Passed);
                Thread.Sleep(5000);
                driver.SwitchTo().DefaultContent();
                libraryUi.get_StatePromote().Click();
                Thread.Sleep(3000);
                driver.SwitchTo().Frame("pagecontent");
                if (libraryUi.get_stateNameHighlight("Review").Displayed)
                {
                    System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS");
                }
                Reporter.ReportEvent("Status is Review", "Status is Review Pass", HP.LFT.Report.Status.Passed);
                Thread.Sleep(5000);
                driver.SwitchTo().DefaultContent();
                libraryUi.get_StatePromote().Click();
                Thread.Sleep(3000);
                driver.SwitchTo().Frame("pagecontent");
                if (libraryUi.get_stateNameHighlight("Released").Displayed)
                {
                    System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS");
                }
                Reporter.ReportEvent("Status is Released", "Status is Released Pass", HP.LFT.Report.Status.Passed);

                driver.Close();
                driver.SwitchTo().Window(libraryWindow);

                iccPortal.LaunchICCWindow();

                try
                {
                    iccPortal.SelectValueFromApplicationDropDown("MaterialBooking_Castor");
                    iccPortal.VerifySearchResult("MaterialBooking_Castor");
                    iccPortal.VerifyPortInSearchResult("MaterialBooking.RM");
                    Reporter.ReportEvent("ICC portal 'MaterialBooking_Castor' Processed for MaterialBooking.RM",
                                         "ICC portal  'MaterialBooking_Castor' Processed for MaterialBooking.RM",
                                         HP.LFT.Report.Status.Passed);
                }
                catch
                {
                    Reporter.ReportEvent("ICC portal 'MaterialBooking_Castor' Processed for MaterialBooking.RM",
                                         "ICC portal  'MaterialBooking_Castor' Processed for MaterialBooking.RM",
                                         HP.LFT.Report.Status.Failed);
                }
            }
            catch (Exception ex)
            {
                string     stimestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss").ToString();
                string     ESSpath    = System.Environment.GetEnvironmentVariable("ProjectWorkingDirectory") + "ImagesPath\\" + stimestamp + ".Png";
                Screenshot sc         = ((ITakesScreenshot)driver).GetScreenshot();
                sc.SaveAsFile(ESSpath, ImageFormat.Png);
                System.Diagnostics.Debug.WriteLine("Message*********************" + ex.Message);
                System.Diagnostics.Debug.WriteLine("StackTrace*********************" + ex.StackTrace);
                Reporter.ReportEvent("TC27_SIT_Library_Materials script fail",
                                     "TC27_SIT_Library_Materials Script fail",
                                     HP.LFT.Report.Status.Failed, ESSpath);
            }
        }