public void LoginSuccess() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Login Success"); utilities.extenttest.AssignCategory("Login and Logout Tests"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2000); login.NavigateTo(); login.LoginSuccess(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2000); Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='page-wrap']/section[1]")).Displayed); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); }
public void ShowMyTeam() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Show My Team Bookings"); utilities.extenttest.AssignCategory("MyBookings"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(4000); mybookings.MyBookingsSelect(); Thread.Sleep(4000); mybookings.TickBox(); //Assert.IsFalse(driver.FindElement(By.ClassName("")); }
public void MyProfile_UserNameCheck() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("My Profile Username Check"); utilities.extenttest.AssignCategory("My Profile Tests"); login.NavigateTo(); login.LoginSuccess(); Assert.IsTrue(this.MyProfileMap.UserNameValidator.Text.Equals(this.MyProfileMap.UserNameLinkValidator.Text)); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); }
public void AddServicesButtonCheck() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Add Services Button Check"); utilities.extenttest.AssignCategory("Services Tests"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(3000); homepage.SelectResource(); login.Wait(); services.AddServicesButton(); login.Wait(); Assert.IsTrue(this.driver.FindElement(By.XPath("//*[@id='step3AddServices']")).Displayed); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); }
//Login functionality taken from Login.Login public void NavigateToInit() { LoginMain login = new LoginMain(this.driver); login.NavigateTo(); login.LoginSuccess(); //Add WAIT Thread.Sleep(5000); }
public void ChangeResource() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("ChangeResource"); // utilities.extenttest = utilities.extent.StartTest("Find Resource"); login.NavigateTo(); login.LoginSuccess(); login.Wait(); Thread.Sleep(4000); homepage.SelectResource(); Thread.Sleep(2000); homepage.NextButton(); login.Wait(); Thread.Sleep(2500); bookings.BookingTitle(); //homepage.NextButton(); login.Wait(); Thread.Sleep(4000); editbooking.CloseButton(); Thread.Sleep(3000); mybooking.MyBookingsEnter(); login.Wait(); Thread.Sleep(5000); editbooking.EditBookingPencil(); login.Wait(); Thread.Sleep(4000); editbooking.EditBookingBurgerButton(); Thread.Sleep(4000); editbooking.EditResourceDropdownSelectChangeResource(); login.Wait(); Thread.Sleep(4500); editbooking.ChangeResourceBTN(); Thread.Sleep(4000); editbooking.Finding(); Thread.Sleep(6000); editbooking.ExactMatchSelect(); Thread.Sleep(3000); homepage.NextButton(); Thread.Sleep(4000); //editbooking.Next(); // homepage.NextButton(); Thread.Sleep(4000); login.Wait(); //editbooking.Finish(); editbooking.FinishBTN(); //EditBooking.CloseButton(); // homepage.NextButton(); // editbooking.EditBookingResource(); /* Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='tblResourcesGrid']/tbody/tr[2]/td")).Displayed); * utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); * utilities.extenttest.Log(LogStatus.Info, "Test");*/ }
public void NavigateToBookingSummaryPage() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Navigate Ti Booking Summary Page"); utilities.extenttest.AssignCategory("Booking Tests"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(4000); homepage.SelectResource(); attendee.AddingInternalAttendee(); homepage.NextButton(); Thread.Sleep(3000); Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='step4ConfirmBooking']/div/form")).Displayed); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); }
public void FindResource() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Find Resource"); utilities.extenttest.AssignCategory("HomePage Tests"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(3000); homepage.SearchResource(); Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='tblResourcesGrid']/tbody/tr[2]/td")).Displayed); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); }
public void Case3615() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("TFS Case 3615 Cancel Popup not displaying properly"); utilities.extenttest.AssignCategory("Case 3615. Cancel Popup"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(4000); homepage.SelectResource(); login.Wait(); attendees.AddingInternalAttendee(); Thread.Sleep(2000); homepage.NextButton(); Thread.Sleep(2000); booking.BookingTitle(); var refnumber = this.driver.FindElement(By.XPath("//*[@id='page-wrap']/section[2]/div[1]/div/div[3]/span")).Text; Console.WriteLine(refnumber); mybookings.MyBookingsSelect(); Thread.Sleep(3000); //Querying DB to get BookingID which is linked with cancel button on the page. utilities.DBConnect("SELECT BookingID, StartTime FROM [Booking] where ReferenceNumber = '" + refnumber + "'"); Thread.Sleep(2000); string S1 = utilities.data[0]; string S2 = utilities.data[1]; Console.WriteLine("Test: " + S1); Console.WriteLine("Booking Date : " + S2); DateTime Date = Convert.ToDateTime(S2); string date = Date.ToShortDateString(); int month = Date.Month; Console.WriteLine(date); Console.WriteLine(month); DateTime TodayDate = DateTime.Now; int TodayMonth = TodayDate.Month; Console.WriteLine("Current Month : " + TodayMonth); //Passing Text inside Text Box with JavascriptExecutor IWebElement element = driver.FindElement(By.CssSelector(".mybooking-calendar .text-box")); IJavaScriptExecutor jse = (IJavaScriptExecutor)driver; jse.ExecuteScript("arguments[0].value='" + S2 + "';", element); driver.FindElement(By.CssSelector(".mybooking-calendar .text-box")).SendKeys(Keys.Enter); Thread.Sleep(2000); this.driver.FindElement(By.XPath("//*[@id='page-wrap']/section[3]/span[1]")).Click(); //Try and catch block. When try element is not found. No such element expection is thrown and then changing the page number and going through the whole processs again. try { IJavaScriptExecutor ex1 = (IJavaScriptExecutor)driver; ex1.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@data-id='" + S1 + "']"))); } catch (NoSuchElementException e) { IList <IWebElement> se = driver.FindElements(By.XPath("//*[@id='customPageList']/div/ul/li")); IEnumerator <IWebElement> enumerator = se.GetEnumerator(); bool hasNext = enumerator.MoveNext(); while (hasNext) { login.Wait(); int c = se.Count; this.driver.FindElement(By.XPath("//*[@id='customPageList']/div/ul/li[" + c + "]/a")).Click(); Thread.Sleep(2000); try { IJavaScriptExecutor ex1 = (IJavaScriptExecutor)driver; ex1.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@data-id='" + S1 + "']"))); var abc = this.driver.FindElement(By.XPath("//*[@id='ConfirmationModal']/div")); if (abc.Displayed) { break; } } catch (NoSuchElementException e2) { hasNext = enumerator.MoveNext(); } } enumerator.Dispose(); } var confirmText = this.driver.FindElement(By.XPath("//*[@id='ConfirmationModal']/div[1]")); var CancelText = this.driver.FindElement(By.XPath("//*[@id='myBookingdialog']/div[1]")); //If Confirmation box contains the ref number then click on yes. If cancel text contains Ref number then click on OK. if (confirmText.Text.Contains(refnumber)) { mybookings.YesBTN(); if (CancelText.Text.Contains("Booking with reference number " + refnumber + " cancelled successfully")) { mybookings.SelectOK(); Console.WriteLine("Booking Cancelled Successfully"); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); } } //If else { Console.WriteLine("Reference numnber doesn't match"); Assert.Fail(); } }
public void AddInternalAttendee() { utilities.ConsoleMessageStart(); utilities.extenttest = utilities.extent.StartTest("Add Internal Attendee"); utilities.extenttest.AssignCategory("Attendees Tests"); login.NavigateTo(); login.LoginSuccess(); Thread.Sleep(4000); homepage.SelectResource(); attendees.InternalAttendeeSearchbox(); Thread.Sleep(3000); var searchedattendee = this.Map.SearchedAttendee.Text; Console.WriteLine("Searched Attendee: " + searchedattendee); string beforetext = searchedattendee.Substring(0, searchedattendee.IndexOf(",")); Console.WriteLine("Short Text: " + beforetext); attendees.InternalAttendeeSelector(); Thread.Sleep(2000); Thread.Sleep(10000); var selectedattendee1 = this.Map.SelectedInternalAttendee.Text; Console.WriteLine("Selected Attendees: " + selectedattendee1); if (selectedattendee1.Contains(beforetext)) { Console.WriteLine("Pass"); utilities.extenttest.Log(LogStatus.Pass, "Assert pass "); } else { Console.WriteLine("Test Fail because Attendee selected and attendee searched doesn't match"); Assert.Fail(); } }