Exemple #1
0
        //  [Test]

        public void TC26_SIT_Library_License_Companies()
        {
            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";
                Thread.Sleep(1000);

                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);
                Thread.Sleep(20000);
                //  ********************************************  License Companies ****************************************************************************
                libraryUi.LaunchLicenseCompanies();
                libraryUi.traverseContentFrame();
                libraryUi.traverseToContentBodyFrame();
                string companyName = null;
                if (libraryUi.get_LicenseCompaniesTableRowRecord().Count > 0)
                {
                    libraryUi.get_Checkbox(Int32.Parse(libraryUi.get_LicenseCompaniesTableRowRecord()[1].GetAttribute("rowIndex"))).Click();
                    companyName = libraryUi.get_LicenseCompaniesTableRowRecordName()[1].Text;
                    libraryUi.traverseContentFrame();
                    libraryUi.traverseToContentBodyFrameTableSettings();
                    libraryUi.get_Activate().Click();
                    libraryUi.traverseContentFrame();
                    libraryUi.traverseToContentBodyFrame();
                    for (int i = 0; i < 20; i++)
                    {
                        if (libraryUi.get_StatusByCompanyName(companyName).Text.Equals("Active"))
                        {
                            break;
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(libraryUi.get_StatusByCompanyName(companyName).Text); Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    // no inactive compnay
                }

                //check export
                string libraryWindow = libraryUi.get_libraryWindow();
                libraryUi.get_NewLaunchedWindow();

                iccPortal.LaunchICCWindow();

                try {
                    iccPortal.SelectValueFromApplicationDropDown("LicenceCompany_Castor");
                    iccPortal.VerifySearchResult("LicenceCompany_Castor");
                    iccPortal.VerifyPortInSearchResult("OFS");
                    iccPortal.VerifyPortInSearchResult("Showroom");
                    iccPortal.VerifyPortInSearchResult("HMOrder");
                    iccPortal.VerifyPortInSearchResult("VPS");
                    Reporter.ReportEvent("ICC portal 'LicenceCompany_Castor' Processed for OFS, Showroom, HMOrder, VPS",
                                         "ICC portal  LicenceCompany_Castor Processed for OFS, Showroom, HMOrder, VPS",
                                         HP.LFT.Report.Status.Passed);
                }
                catch
                {
                    Reporter.ReportEvent("ICC portal 'LicenceCompany_Castor' Processed for OFS, Showroom, HMOrder, VPS",
                                         "ICC portal  LicenceCompany_Castor Processed for OFS, Showroom, HMOrder, VPS",
                                         HP.LFT.Report.Status.Failed);
                }
                driver.SwitchTo().Window(libraryWindow);
                // make it incative
                libraryUi.traverseContentFrame();
                libraryUi.traverseToContentBodyFrame();
                // libraryUi.get_Checkbox(Int32.Parse(libraryUi.get_RowByCompanyName(companyName).GetAttribute("rowIndex")) + 1).Click();
                //companyName = libraryUi.get_LicenseCompaniesTableRowRecordName()[1].Text;
                libraryUi.traverseContentFrame();
                libraryUi.traverseToContentBodyFrameTableSettings();
                libraryUi.get_Drop().Click();
            }
            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("TC26_SIT_Library_License_Companies script fail",
                                     "TC26_SIT_Library_License_Companies script fail- exception message: " + ex.Message,
                                     HP.LFT.Report.Status.Failed);
                Reporter.ReportEvent("TC26_SIT_Library_License_Companies script fail",
                                     "TC26_SIT_Library_License_Companies script fail- exception StackTrace " + ex.StackTrace,
                                     HP.LFT.Report.Status.Failed, ESSpath);
            }
        }