public void Positions_Add_PositionAdded(string name) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PositionsPageObject positionsPage = menu.EnterPositions(); PositionPageObject positionPage = positionsPage.AddPosition(); string url1 = PropertiesCollection.driver.Url; positionPage = positionPage.AddPosition(name); SeleniumUtilityMethods.WaitForJavascript(); string url2 = PropertiesCollection.driver.Url; positionsPage = menu.EnterPositions(); string sId = url2.Substring(url1.Length + 4); int id = Int32.Parse(sId); string tId = positionsPage.GetCellContent(0, 0); string tName = positionsPage.GetCellContent(0, 1); StringAssert.IsMatch(sId, tId); StringAssert.IsMatch(sId, tId); StringAssert.IsMatch(name, tName); }
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); } }
public void Leaves_ChangeDateFilter_FilterTable(string date, string filter) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(date); leavesPage.AddLeave(date, date, "test"); leavesPage.AddLeave(filter, filter, "test"); SeleniumUtilityMethods.WaitForJavascript(); string Id1 = leavesPage.tabLeaves.GetTableCell(0, 0); string Id2 = leavesPage.tabLeaves.GetTableCell(1, 0); leavesPage.SetDate(filter); string Id3 = leavesPage.tabLeaves.GetTableCell(0, 0); string Id4 = ""; try { Id4 = leavesPage.tabLeaves.GetTableCell(1, 0); } catch { } StringAssert.IsMatch(Id1, Id3); StringAssert.DoesNotMatch(Id3, Id4); }
public void People_AddWithInCorrectValues_PersonNotAdded(string name, string surname, string email, string password, string hours) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); string id = ""; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(name, surname, id + email, password, hours); SeleniumUtilityMethods.WaitForJavascript(); string nid = ""; try { nid = peoplePage.GetCellContent(0, 0); } catch { } StringAssert.IsMatch(id, nid); }
public void Person_ChangeDataToAnotherInCorrectValue_DataChanged(string name, string surname, string email, string password, string hours) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setData(name, surname, email, hours, false, password); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); string nname = personPage.getName(); string nsurname = personPage.getSurname(); string nemail = personPage.getEmail(); string nhours = personPage.getHours(); StringAssert.DoesNotMatch(name, nname); StringAssert.DoesNotMatch(surname, nsurname); StringAssert.DoesNotMatch(email, nemail); StringAssert.DoesNotMatch(hours, nhours); }
public void People_Filter_TableFiltered(string filtrName, string filtrSurname, string personValues, Boolean result) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch {} peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); string tId = peoplePage.GetCellContent(0, 0); peoplePage.setFilter(filtrName, filtrSurname); SeleniumUtilityMethods.WaitForJavascript(); string nId = ""; try { nId = peoplePage.GetCellContent(0, 0); } catch { } Assert.That(result == (tId == nId)); }
public void Person_SetWorkDayWithCorrectValues_SetedWorkDay(int day, string begin, string end) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setWorkDay(day, begin, end); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); string nbegin = personPage.getDayBegin(day); string nend = personPage.getDayEnd(day); StringAssert.IsMatch(begin, nbegin); StringAssert.IsMatch(end, nend); }
public void Person_SetWorkDayWithInCorrectValues_SetedWorkDay(int day, string begin, string end) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(0); personPage.setWorkDay(day, begin, end); personPage.Save(); peoplePage = menu.EnterPeople(); personPage = peoplePage.EneterPerson(0); Boolean isworking = personPage.isWorkDay(day); Assert.That(isworking == false); }
public void Position_RemoveRow_RowRemoved() { string day = "niedziela"; string begin = "8:00"; string end = "9:00"; string min = "1"; string max = "2"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PositionsPageObject positionsPage = menu.EnterPositions(); PositionPageObject positionPage = positionsPage.AddPosition(); positionPage.AddRow(day, begin, end, min, max); positionPage.AddPosition("tester"); positionsPage = menu.EnterPositions(); positionPage = positionsPage.EnterPosition(0); positionPage.deleteRow(0); positionPage.Save(); positionsPage = menu.EnterPositions(); positionPage = positionsPage.EnterPosition(0); Assert.That(() => positionPage.getDayName(0), Throws.Exception); }
public void Position_AddRow_RowAdded(string day, string begin, string end, string min, string max) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PositionsPageObject positionsPage = menu.EnterPositions(); PositionPageObject positionPage = positionsPage.AddPosition(); positionPage.AddRow(day, begin, end, min, max); positionPage.AddPosition("tester"); positionsPage = menu.EnterPositions(); positionPage = positionsPage.EnterPosition(0); string tday = positionPage.getDayName(0); string tbegin = positionPage.getBegin(0); string tend = positionPage.getEnd(0); string tmin = positionPage.getMin(0); string tmax = positionPage.getMax(0); StringAssert.IsMatch(day, tday); StringAssert.IsMatch(begin, tbegin); StringAssert.IsMatch(end, tend); StringAssert.IsMatch(min, tmin); StringAssert.IsMatch(max, tmax); }
public void MyData_ChangePassword_PasswordChanged(string email, string password, string newPassword) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); MyDataPageObject mdataPage = menu.EnterDataPage(); mdataPage.changePassword(newPassword); loginPage = menu.LogOut(); mSchedPage = loginPage.Login(email, newPassword); mdataPage = menu.EnterDataPage(); mdataPage.changePassword(password); }
public void Menu_ByGuest_NoButtons() { //LoginPageObject loginPage = new LoginPageObject(); //MySchedPageObject mSchedPage = loginPage.Login("*****@*****.**", "user"); MenuLayoutObject menu = new MenuLayoutObject(); menu.OpenMenu(); Assert.That(() => menu.btnDataPage.Text, Throws.Exception); Assert.That(() => menu.btnMySchedulePage.Text, Throws.Exception); Assert.That(() => menu.btnLeavePage.Text, Throws.Exception); Assert.That(() => menu.btnPeoplePage.Text, Throws.Exception); Assert.That(() => menu.btnSchedulesPage.Text, Throws.Exception); Assert.That(() => menu.btnPositionsPage.Text, Throws.Exception); }
public void Leaves_CheckOnlyConfirmed_HideNotConfirmed(int firsts, int secounds, Boolean firstsConfirmed) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate("2021-04-20"); for (int i = 0; i < firsts + secounds; i++) { leavesPage.AddLeave("2021-04-20", "2021-05-21", "test"); SeleniumUtilityMethods.WaitForJavascript(); } int start; int end; int count; if (firstsConfirmed) { start = 0; end = firsts; count = firsts; } else { start = firsts; end = firsts + secounds; count = secounds; } string[] tab = new string[count]; int j = 0; for (int i = start; i < end; i++) { leavesPage.Confirm(i); SeleniumUtilityMethods.WaitForJavascript(); tab[j] = leavesPage.GetCellContent(i, 0); j++; } leavesPage.ChangeOnlyConfirmed(); SeleniumUtilityMethods.WaitForJavascript(); for (int i = 0; i < count; i++) { StringAssert.IsMatch(tab[i], leavesPage.GetCellContent(i, 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); } }
public void MyData_ChangeToShortPassword_PopUpWrongPasswordAndCannotLoginWithNewPassword(string email, string password, string newPassword) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); MyDataPageObject mdataPage = menu.EnterDataPage(); mdataPage.changePassword(newPassword); SeleniumUtilityMethods.WaitForJavascript(); string txt = mdataPage.getPopUpText(); loginPage = menu.LogOut(); StringAssert.IsMatch("Hasło musi zawierać conajmniej 5 znaków.", txt); Assert.That(() => loginPage.Login(email, newPassword), Throws.Exception); }
public void Leaves_Add_LeaveAdded(string email, string password, string name, string begin, string end, string purpose, Boolean admin) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(begin); leavesPage.AddLeave(begin, end, purpose); SeleniumUtilityMethods.WaitForJavascript(); int i = 0; string pId = leavesPage.GetCellContent(0, i); i++; string pPerson = ""; if (admin) { pPerson = leavesPage.GetCellContent(0, i); i++; } string pBegin = leavesPage.GetCellContent(0, i); i++; string pEnd = leavesPage.GetCellContent(0, i); i++; string pPurpose = leavesPage.GetCellContent(0, i); i++; string pConfirm = leavesPage.GetCellContent(0, i); string rBegin = begin.Split('-')[2] + "." + begin.Split('-')[1] + "." + begin.Split('-')[0]; string rEnd = end.Split('-')[2] + "." + end.Split('-')[1] + "." + end.Split('-')[0]; StringAssert.IsMatch("[0-9]*", pId); if (admin) { StringAssert.IsMatch(name, pPerson); } StringAssert.IsMatch(rBegin, pBegin); StringAssert.IsMatch(rEnd, pEnd); StringAssert.IsMatch(purpose, pPurpose); StringAssert.IsMatch("NIE", pConfirm); }
public void Leaves_TryConfirm_CorrectConfirmPopUpText(string begin, string end) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate(begin); leavesPage.AddLeave(begin, end, "test"); SeleniumUtilityMethods.WaitForJavascript(); string pconfirm = leavesPage.GetConfirmText(0); string rBegin = begin.Split('-')[2] + "-" + begin.Split('-')[1] + "-" + begin.Split('-')[0]; string rEnd = end.Split('-')[2] + "-" + end.Split('-')[1] + "-" + end.Split('-')[0]; StringAssert.IsMatch("Czy zatwierdzasz urlop admin admin w okresie od " + rBegin + " do " + rEnd + "?", pconfirm); }
public void Menu_ByUser_ThreeBtons() { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login("*****@*****.**", "user1"); MenuLayoutObject menu = new MenuLayoutObject(); menu.OpenMenu(); string myData = menu.btnDataPage.Text; string mySchedule = menu.btnMySchedulePage.Text; string leave = menu.btnLeavePage.Text; StringAssert.IsMatch("Moje", myData); StringAssert.IsMatch("Mój Grafik", mySchedule); StringAssert.IsMatch("Urlopy", leave); Assert.That(() => menu.btnPeoplePage.Text, Throws.Exception); Assert.That(() => menu.btnSchedulesPage.Text, Throws.Exception); Assert.That(() => menu.btnPositionsPage.Text, Throws.Exception); }
public void Leaves_PretendConfirm_NotConfirmed(int row) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); LeavePageObject leavesPage = menu.EnterLeavesage(); leavesPage.SetDate("2020-04-20"); for (int i = 0; i < row; i++) { leavesPage.AddLeave("2020-04-20", "2020-04-23", "test"); SeleniumUtilityMethods.WaitForJavascript(); } leavesPage.PretendConfirm(row); SeleniumUtilityMethods.WaitForJavascript(); string pconfirm = leavesPage.GetCellContent(row, 5); StringAssert.IsMatch("NIE", pconfirm); }
public void MyData_ByUser_UsersData(string email, string password, string name, string surname, string id, Boolean admin, string hours, string days) { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login(email, password); MenuLayoutObject menu = new MenuLayoutObject(); MyDataPageObject mdataPage = menu.EnterDataPage(); string pname = mdataPage.getName(); string psurname = mdataPage.getSurname(); string pid = mdataPage.getId(); string pemail = mdataPage.getEmail(); string phours = mdataPage.getHours(); int pdaysCount = mdataPage.getDaysCount(); int daysCount = days.Count(c => c == '1'); Assert.That(pdaysCount == daysCount); StringAssert.IsMatch(pname, name); StringAssert.IsMatch(psurname, surname); StringAssert.IsMatch(pid, id); StringAssert.IsMatch(pemail, email); StringAssert.IsMatch(phours, hours); if (admin) { string padmin = mdataPage.getAdmin(); StringAssert.IsMatch(padmin, "Posiada Uprawnienia Administratora"); } else { Assert.That(() => mdataPage.getAdmin(), Throws.Exception); } for (int i = 0; i < 7; i++) { if (days[i] == '1') { StringAssert.IsMatch("(niedziela)|(poniedziałek)|(wtorek)|(środa)|(czwartek)|(piątek)|(sobota)", mdataPage.getDayName(i)); StringAssert.IsMatch("[0-2][0-9]:[0-6][0-9] - [0-2][0-9]:[0-6][0-9]", mdataPage.getWorkHours(i)); } } }
public void Menu_ByAdmin_AllButtons() { LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mSchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); menu.OpenMenu(); string myData = menu.btnDataPage.Text; string mySchedule = menu.btnMySchedulePage.Text; string peoples = menu.btnPeoplePage.Text; string schedules = menu.btnSchedulesPage.Text; string positions = menu.btnPositionsPage.Text; string leave = menu.btnLeavePage.Text; StringAssert.IsMatch("Moje Dane", myData); StringAssert.IsMatch("Mój Grafik", mySchedule); StringAssert.IsMatch("Pracownicy", peoples); StringAssert.IsMatch("Grafiki", schedules); StringAssert.IsMatch("Stanowiska", positions); StringAssert.IsMatch("Urlopy", leave); }
public void People_ClickRow_EnteredPersonPage(int row) { String personValues = "test"; LoginPageObject loginPage = new LoginPageObject(); MySchedPageObject mySchedPage = loginPage.Login("*****@*****.**", "admin"); MenuLayoutObject menu = new MenuLayoutObject(); PeoplePageObject peoplePage = menu.EnterPeople(); PersonPageObject personPage; string id = "0"; try { id = peoplePage.GetCellContent(0, 0); } catch { } peoplePage.AddPerson(personValues, personValues, personValues + id + "@" + personValues + id + ".pl", "1qazxsw2", "1"); SeleniumUtilityMethods.WaitForJavascript(); personPage = peoplePage.EneterPerson(row); Assert.That(() => personPage.getEmail(), Throws.Nothing); }