Esempio n. 1
0
        public void Schedules_EnterSchedules_SchedulePageWithCorrectData(int row)
        {
            String              personValues  = "test";
            LoginPageObject     loginPage     = new LoginPageObject();
            MySchedPageObject   mySchedPage   = loginPage.Login("*****@*****.**", "admin");
            MenuLayoutObject    menu          = new MenuLayoutObject();
            SchedulesPageObject schedulesPage = menu.EnterSchedules();

            string tid    = schedulesPage.GetCellContent(row, 0);
            string tbegin = schedulesPage.GetCellContent(row, 1);
            string tend   = schedulesPage.GetCellContent(row, 2);
            string tconf  = schedulesPage.GetCellContent(row, 3);

            SchedulePageObject schedulePage = schedulesPage.EnterSchedule(row);

            string sid    = schedulePage.getId();
            string sdates = schedulePage.getDates();
            string sconf  = schedulePage.getConfirmed();

            StringAssert.IsMatch("Grafik nr " + tid, sid);
            StringAssert.IsMatch(tbegin + " - " + tend, sdates);
            if (tconf == "NIE")
            {
                StringAssert.IsMatch("Wymaga Zatwiedzenia", sconf);
            }
            else
            {
                StringAssert.IsMatch(tconf, sconf);
            }
        }
Esempio n. 2
0
        public void Schedules_Filter_TableFiltered(string begin, string end, Boolean confirmed)
        {
            String              personValues  = "test";
            LoginPageObject     loginPage     = new LoginPageObject();
            MySchedPageObject   mySchedPage   = loginPage.Login("*****@*****.**", "admin");
            MenuLayoutObject    menu          = new MenuLayoutObject();
            SchedulesPageObject schedulesPage = menu.EnterSchedules();

            schedulesPage.FilterTable(begin, end, confirmed);

            DateTime dateBegin  = new DateTime();
            DateTime dateEnd    = new DateTime();
            DateTime dateBeginT = new DateTime();
            DateTime dateEndT   = new DateTime();
            string   tconf      = "";
            Boolean  isData     = true;

            try
            {
                string tbegin = schedulesPage.GetCellContent(0, 1);
                string tend   = schedulesPage.GetCellContent(0, 2);
                tconf = schedulesPage.GetCellContent(0, 3);

                dateBegin  = new DateTime(Int32.Parse(begin.Split('-')[0]), Int32.Parse(begin.Split('-')[1]), Int32.Parse(begin.Split('-')[2]));
                dateEnd    = new DateTime(Int32.Parse(end.Split('-')[0]), Int32.Parse(end.Split('-')[1]), Int32.Parse(end.Split('-')[2]));
                dateBeginT = new DateTime(Int32.Parse(tbegin.Split('.')[2]), Int32.Parse(tbegin.Split('.')[1]), Int32.Parse(tbegin.Split('.')[0]));
                dateEndT   = new DateTime(Int32.Parse(tend.Split('.')[2]), Int32.Parse(tend.Split('.')[1]), Int32.Parse(tend.Split('.')[0]));
            }
            catch { isData = false; }

            if (isData)
            {
                Assert.That((dateBegin >= dateBeginT && dateBegin <= dateEndT) || (dateEnd >= dateBeginT && dateEnd <= dateEndT) || (dateBegin <= dateBeginT && dateEnd >= dateEndT));

                if (confirmed)
                {
                    StringAssert.DoesNotMatch("NIE", tconf);
                }
                else
                {
                    StringAssert.IsMatch("(NIE)|([0-3][0-9]\\.[0-3][0-9]\\.[0-9][0-9][0-9][0-9])", tconf);
                }
            }
            else
            {
                Assert.That(() => schedulesPage.GetCellContent(0, 0), Throws.Exception);
            }
        }