public void TestAddTimeAndMaterial() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click TimeAndMaterialsPage timeAndMaterialsPage = null; TimeAndMaterial timeAndMaterialObject = null; try { timeAndMaterialsPage = homePage.GoToTimeAndMaterialsPage(Driver); // Verify that you are on Time & Materials Page by checking the URL ValidateURL(Driver, timeAndMaterialUrl); // Create new Time and Material item // Locate TypeCode dropdown field and Select Time // Locate Code textfield and enter test123 // Locate Description textfield and enter current timestamp as the description for uniqueness // Locate Price per unit field and enter 10.00; // Locate and click Save Button timeAndMaterialObject = CreateNewTimeAndMaterial( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Code"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Price")); timeAndMaterialsPage.CreateNewTimeAndMaterial(Driver, timeAndMaterialObject); // Verify that the item was added } catch (WebDriverException e) { Console.WriteLine(e.StackTrace); Assert.Fail("Unexpected exception occurred - TestAddTimeAndMaterial failed", e); } Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Not.Null, "Time and Material was not added - TestAddTimeAndMaterial failed"); }
public void TestDeleteTimeAndMaterial() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click TimeAndMaterialsPage timeAndMaterialsPage = null; TimeAndMaterial timeAndMaterialObject = null; try { timeAndMaterialsPage = homePage.GoToTimeAndMaterialsPage(Driver); // Verify that you are on Time & Materials Page by checking the URL ValidateURL(Driver, timeAndMaterialUrl); timeAndMaterialObject = CreateNewTimeAndMaterial( ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Code"), ExcelLibHelpers.ReadData(GenerateRandomNumber(2, 6), "Price")); timeAndMaterialsPage.CreateNewTimeAndMaterial(Driver, timeAndMaterialObject); // Verify that the item was added PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject); Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Not.Null, "Time and Material was not created - TestDeleteTimeAndMaterial failed"); // Now perform delete by clicking Delete button timeAndMaterialsPage.DeleteTimeAndMaterial(Driver, timeAndMaterialObject); } catch (WebDriverException e) { Console.WriteLine(e.StackTrace); Assert.Fail("Unexpected exception occurred - TestDeleteTimeAndMaterial failed" + e.Message); } // verify that deletion was successful Assert.That(PerformVerification(Driver, timeAndMaterialsPage, timeAndMaterialObject), Is.Null, "Time and Material was not deleted - TestDeleteTimeAndMaterial failed"); }
public void TestDragAndDRop() { HomePage homePage = new HomePage(); // Locate Administration Menu and Click // Locate Time & Materials Menu item and Click TimeAndMaterialsPage timeAndMaterialsPage = homePage.GoToTimeAndMaterialsPage(Driver); timeAndMaterialsPage.dragAndDrop(Driver); }
private IWebElement PerformVerification(IWebDriver driver, TimeAndMaterialsPage page, TimeAndMaterial timeAndMaterial) { return(PerformVerification(driver, page, timeAndMaterial.Code, timeAndMaterial.Description, timeAndMaterial.Price)); }
private IWebElement PerformVerification(IWebDriver driver, TimeAndMaterialsPage page, string code, string timeStamp, string price) { ValidateURL(driver, timeAndMaterialUrl); // Verify that the item was added,edited, or deleted by searching for it in the table return(page.Search(driver, code, timeStamp, price)); }