Exemplo n.º 1
0
        public void US_41937_Security_JOT_token_expiry()
        {
            PropertiesCollection.test = PropertiesCollection.extent.CreateTest("US_41937_Security: JOT token expiry");
            var sidebarMenu = new FpSideMenus();
            FpCombinedSchedulePage combinedSchedule = new FpCombinedSchedulePage();

            sidebarMenu.LnkCombinedSchedule.Click();
            IWebElement framesource = PropertiesCollection.driver.FindElement(By.XPath("//iframe[@class='iframe-placeholder']"));

            var frameSourceValue = framesource.GetAttribute("src");

            PropertiesCollection.driver.Close();
            PropertiesCollection.driver.Quit();
            System.Threading.Thread.Sleep(20000);

            PropertiesCollection.driver = new ChromeDriver(@ConfigurationManager.AppSettings["ChromeDriverPath"]);
            PropertiesCollection.driver.Navigate().GoToUrl(frameSourceValue);
            PropertiesCollection.driver.Manage().Window.Maximize();

            IWebElement errorCode = PropertiesCollection.driver.FindElement(By.XPath("//*[@id=\"error-information-popup-content\"]/div[2]"));

            try
            {
                Assert.AreEqual("HTTP ERROR 401", errorCode.Text);
                PropertiesCollection.test.Log(Status.Pass, "The web page is not accessible");
            }
            catch
            {
                PropertiesCollection.test.Log(Status.Fail, "The web page is accessible ");
            }
        }
            public void TS01_TC01_ValidateSideMenus()
            {
                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TS01_TC01_ValidateSideMenus");

                /* Validate Summary Page*/

                FpSideMenus SideMenu = new FpSideMenus();

                SideMenu.SummaryClick();
                System.Threading.Thread.Sleep(30000);
                FpSummaryPage Summary = new FpSummaryPage();

                try
                {
                    Assert.AreEqual(Summary.UserName.Text, "testuser2, AT");
                    PropertiesCollection.test.Log(Status.Pass, "Summary Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Summary Page not loaded");
                    throw;
                }

                /* Validate Calendar Page*/

                Actions actions = new Actions(PropertiesCollection.driver);

                actions.MoveToElement(SideMenu.LnkCalendar).Perform();
                System.Threading.Thread.Sleep(30000);

                SideMenu.CalendarClick();
                System.Threading.Thread.Sleep(30000);

                try
                {
                    //Assert.AreEqual(FpCalendarPage.GetLoggedInUserName(), "testuser2, AT");
                    PropertiesCollection.test.Log(Status.Pass, "Calendar Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Calendar Page not loaded");
                    throw;
                }

                /* Validate Control Hours Report Page*/

                SideMenu.ControlHoursReportClick();
                System.Threading.Thread.Sleep(30000);
                FpControlHoursReportPage ControlHoursReport = new FpControlHoursReportPage();

                try
                {
                    Assert.AreEqual(ControlHoursReport.GetReportName(), "Control Hours Report");
                    PropertiesCollection.test.Log(Status.Pass, "Control Hours Report Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Control Hours Report Page not loaded");
                    throw;
                }

                /* Validate Currency History Report Page*/

                SideMenu.CurrencyHistoryReportClick();
                System.Threading.Thread.Sleep(30000);
                FpCurrencyHistoryReportPage CurrencyHistoryReport = new FpCurrencyHistoryReportPage();

                try
                {
                    Assert.AreEqual(CurrencyHistoryReport.GetReportName(), "Currency History Report");
                    PropertiesCollection.test.Log(Status.Pass, "Currency History Report Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Currency History Report Page not loaded");
                    throw;
                }

                /* Validate Events Report Page*/

                SideMenu.EventsReportClick();
                System.Threading.Thread.Sleep(30000);
                FpEventsReportPage EventsReport = new FpEventsReportPage();

                try
                {
                    Assert.AreEqual(EventsReport.GetReportName(), "Events Report");
                    PropertiesCollection.test.Log(Status.Pass, "Events Report Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Events Report Page not loaded");
                    throw;
                }

                /*Validate Roster Page */

                SideMenu.RosterClick();
                System.Threading.Thread.Sleep(30000);
                FpRosterPage Roster = new FpRosterPage();

                try
                {
                    Assert.IsTrue(Roster.RosterTable.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Roster Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Roster Page not loaded");
                    throw;
                }

                /* Validate Daily Scheduling Page*/

                SideMenu.DailySchedulingClick();
                System.Threading.Thread.Sleep(30000);
                FpDailySchedulingPage DailyScheduling = new FpDailySchedulingPage();

                try
                {
                    Assert.IsTrue(DailyScheduling.Table.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Daily Scheduling Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Daily Scheduling Page not loaded");
                    throw;
                }

                /* Validate Duty Times Page*/

                SideMenu.DutyTimesClick();
                System.Threading.Thread.Sleep(30000);
                FpControlHoursPage DutyTimes = new FpControlHoursPage();

                try
                {
                    Assert.AreEqual((DutyTimes.Title()), "testuser2, AT");
                    PropertiesCollection.test.Log(Status.Pass, "Duty Times Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Duty Times Page not loaded");
                    throw;
                }

                /* Validate Control Hours Page*/

                SideMenu.ControlHoursClick();
                System.Threading.Thread.Sleep(30000);
                FPControlHoursPage ControlHours = new FPControlHoursPage();

                try
                {
                    Assert.AreEqual((ControlHours.Title()), "Control Hours");
                    PropertiesCollection.test.Log(Status.Pass, "Control Hours Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Control Hours Page not loaded");
                    throw;
                }

                /* Validate Programme Viewer Page */

                SideMenu.ProgrammeViewerClick();
                System.Threading.Thread.Sleep(30000);
                FpProgrammeViewerPage ProgrammeViewer = new FpProgrammeViewerPage();

                try
                {
                    Assert.IsTrue(ProgrammeViewer.Grid.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Programme Viewer Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Programme Viewer Page not loaded");
                    throw;
                }

                /* Validate Knowledge Base Page */

                SideMenu.KnowledgeBaseClick();
                System.Threading.Thread.Sleep(30000);
                FpKnowledgeBasePage KnowledgeBase = new FpKnowledgeBasePage();

                try
                {
                    Assert.IsTrue(KnowledgeBase.RowValue.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Knowledge Base Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Knowledge Base Page not loaded");
                    throw;
                }

                /* validate status board page*/

                SideMenu.LnkStatusBoard.Click();
                System.Threading.Thread.Sleep(5000);
                FpStatusBoardPage StatusBoard = new FpStatusBoardPage();

                try
                {
                    Assert.IsTrue(StatusBoard.StatusBoard.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Status Board Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Status Board Page not loaded");
                    throw;
                }

                /* Validate Combined Schedule Page */

                SideMenu.CombinedScheduleClick();
                System.Threading.Thread.Sleep(30000);
                FpCombinedSchedulePage CombinedSchedule = new FpCombinedSchedulePage();

                PropertiesCollection.driver.SwitchTo().Frame(CombinedSchedule.frame);

                try
                {
                    Assert.IsTrue(CombinedSchedule.title.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Combined Schedule Page loaded");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Combined Schedule Page not loaded");
                    throw;
                }
            }
            public void TS04_TC01_Smoke_CreateCombinedScheduleReport()
            {
                String strTestCaseNo = "TC001";
                String strtblname    = "automation_combinedschedule";
                String strTestType   = "Smoke";

                PropertiesCollection.test = PropertiesCollection.extent.CreateTest("TC01_Smoke_CreateCombinedScheduleReport");

                /* Get test data from MySQL */

                var connection = new ConnectToMySQL_Fetch_TestData();
                var testdataCombinedSchedule = connection.Select(strtblname, strTestCaseNo, strTestType);


                string strTDReportName        = testdataCombinedSchedule[3];
                string strTDOrganisationGroup = testdataCombinedSchedule[4];
                string strTDClassification    = testdataCombinedSchedule[5];
                string strTDPane = testdataCombinedSchedule[6];
                string strTDNote = testdataCombinedSchedule[7];
                string strTDDate = testdataCombinedSchedule[8];


                /* Delete Combined Schedule Report if existing already */

                string strSQLtblname = "tblCombinedScheduleReport";
                string strtblcolumn  = "Name";
                string strwherecondn = strTDReportName;
                ////var conn = new ConnectToSQLServer();
                //bool result = conn.Delete(strSQLtblname, strtblcolumn, strwherecondn);


                /* Create Combined Schedule Report*/

                FpCombinedSchedulePage CombinedSchedule = new FpCombinedSchedulePage();
                String ReportTitle = CombinedSchedule.CreateCombinedScheduleReport(strTDReportName, strTDOrganisationGroup, strTDClassification, strTDPane, strTDNote);

                Console.WriteLine(ReportTitle);

                /* Verify Report Name */

                try
                {
                    Assert.AreEqual(ReportTitle, strTDReportName);
                    PropertiesCollection.test.Log(Status.Pass, "Combined Schedule Report created successfully");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Combined Schedule Report not Created");
                    throw;
                }


                CombinedSchedule.btnDay.Click();
                System.Threading.Thread.Sleep(5000);

                int height = CombinedSchedule.date.Size.Height;
                int width  = CombinedSchedule.date.Size.Width;

                Console.WriteLine(height);
                Console.WriteLine(width);
                Actions actions = new Actions(PropertiesCollection.driver);

                actions.MoveToElement(CombinedSchedule.date).MoveByOffset((-width / 3), 2).Click().Perform();
                System.Threading.Thread.Sleep(3000);
                CombinedSchedule.date.SendKeys(strTDDate + Keys.Tab);
                System.Threading.Thread.Sleep(15000);
                CombinedSchedule.btnRefresh.Click();
                System.Threading.Thread.Sleep(15000);

                /* Verify Mission Strip  */

                try
                {
                    Assert.IsTrue(CombinedSchedule.missionStrip.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Mission Strip is displayed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Mission Strip is not displayed");
                    throw;
                }


                /* Verify Formation Group Strip  */

                try
                {
                    Assert.IsTrue(CombinedSchedule.formationStrip.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Formation Group Strip is displayed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Formation Group Strip is not displayed");
                    throw;
                }


                /* Verify Sortie Group Strips  */

                try
                {
                    Assert.IsTrue(CombinedSchedule.sortieStrip1.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Sortie Group Strip 1 is displayed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Sortie Group Strip 1 is not displayed");
                    throw;
                }

                try
                {
                    Assert.IsTrue(CombinedSchedule.sortieStrip2.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Sortie Group Strip 2 is displayed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Sortie Group Strip 2 is not displayed");
                    throw;
                }

                try
                {
                    Assert.IsTrue(CombinedSchedule.sortieStrip3.Displayed);
                    PropertiesCollection.test.Log(Status.Pass, "Sortie Group Strip 3 is displayed");
                }
                catch
                {
                    PropertiesCollection.test.Log(Status.Fail, "Sortie Group Strip 3 is not displayed");
                    throw;
                }

                /* Delete Combined Schedule Report */

                //result = conn.Delete(strSQLtblname, strtblcolumn, strwherecondn);

                //   try
                //   {
                //       Assert.AreEqual(result, true);
                //       PropertiesCollection.test.Log(Status.Pass, "Combined Schedule Report deleted");
                //   }
                //   catch
                //   {
                //       PropertiesCollection.test.Log(Status.Fail, "Combined Schedule Report not deleted");
                //    throw;
                //   }
            }