public void ThenIShouldBeAbleToDeleteCustomerRecord() { // create object for CustomerPage CustomersPage custObj = new CustomersPage(); //Delete customer test custObj.DeleteCustomer(driver); // quit driver driver.Quit(); }
public void DeleteCustonerTest() { // page object for Home page HomePage homeObj = new HomePage(); homeObj.NavigateToCustomer(driver); // create object for CustomerPage CustomersPage custObj = new CustomersPage(); //Delete customer test custObj.DeleteCustomer(driver); }
public void TestDeleteCustomer() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click IWebElement customerRow = null; try { CustomersPage customersPage = homePage.GoToCustomersPage(Driver); Contact contactObject = new Contact( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactFirstName"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactLastName"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "ContactPhoneNumber")); Customer customerObject = new Customer(ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 7), "CustomerName"), contactObject, contactObject); customersPage.CreateNewCustomer(Driver, customerObject); // go back to the summary page Driver.Navigate().GoToUrl(customersUrl); // verify customerRow = PerformValidation(Driver, customersPage, customerObject); Assert.That(customerRow, Is.Not.Null, "Unable to create new customer - TestDeleteCustomer failed"); string id = customerRow.FindElement(By.XPath("td[1]")).Text; customersPage.DeleteCustomer(Driver, id); Driver.Navigate().Refresh(); //customersPage.refreshTable(Driver); customerRow = PerformValidation(Driver, customersPage, id); } catch (Exception e) { Console.WriteLine(e.StackTrace); Assert.Fail("Unexpected error has occurred - TestDeleteCustomer failed " + e.Message); } Assert.That(customerRow, Is.Null, "Unable to delete customer - TestDeleteCustomer failed"); }