Пример #1
0
        public void CreateNewCustomer(IWebDriver driver, Customer customer)
        {
            driver.FindElement(createNewCustomerButtonLocator).Click();
            // fill out name
            driver.FindElement(customerNameLocator).SendKeys(customer.Name);
            // check contact check box for simplicity
            driver.FindElement(isSameContactCheckBoxLocator).Click();
            // click editContactButtonLocator
            driver.FindElement(editContactButtonLocator).Click();
            // fill out contact first name and last name and phone number
            SynchronizationHelper.WaitForVisibility(driver, contactDetailFrame, 10);
            IWebElement contactDetailForm = driver.FindElement(contactDetailFrame);

            // switching to Edit Contact Form iframe
            driver.SwitchTo().Frame(contactDetailForm);
            ClearAndEnter(driver.FindElement(contactFirstNameLocator), customer.CustomerContact.FirstName);
            ClearAndEnter(driver.FindElement(contactLastNameLocator), customer.CustomerContact.LastName);
            ClearAndEnter(driver.FindElement(contactPhoneNumberLocator), customer.CustomerContact.PhoneNumber);
            // click save contact button
            driver.FindElement(saveContactButtonLocator).Click();
            // switching iframe back
            driver.SwitchTo().DefaultContent();
            // cick save button
            SynchronizationHelper.WaitForClickability(driver, saveButtonLocator, 10);
            driver.FindElement(saveButtonLocator).Click();
        }
Пример #2
0
        public void UpdateCustomer(IWebDriver driver, string id, Customer updatedCustomer)
        {
            IWebElement customerToUpdate = SearchById(driver, id); // row

            // fill out name
            customerToUpdate.FindElement(editButtonLocator).Click();
            // new client edit iframe
            IWebElement editCustomerIframe = driver.FindElement(editCustomerFrame);

            driver.SwitchTo().Frame(editCustomerIframe);
            ClearAndEnter(driver.FindElement(customerNameLocator), updatedCustomer.Name);
            // click editContactButtonLocator
            driver.FindElement(editContactButtonLocator).Click();
            // fill out contact first name and last name and phone number
            SynchronizationHelper.WaitForVisibility(driver, contactDetailFrame, 10);
            IWebElement editContactForm = driver.FindElement(contactDetailFrame);

            // switching to Edit Contact Form iframe
            driver.SwitchTo().Frame(editContactForm);
            ClearAndEnter(driver.FindElement(contactFirstNameLocator), updatedCustomer.CustomerContact.FirstName);
            ClearAndEnter(driver.FindElement(contactLastNameLocator), updatedCustomer.CustomerContact.LastName);
            ClearAndEnter(driver.FindElement(contactPhoneNumberLocator), updatedCustomer.CustomerContact.PhoneNumber);
            // click save contact button
            driver.FindElement(saveContactButtonLocator).Click();
            // switching iframe back
            driver.SwitchTo().ParentFrame();
            // have to wait for the contact detail iframe to be hidden before proceeding to clicking save button
            SynchronizationHelper.WaitForElementToBeHidden(driver, By.Id("contactDetailWindow"), 10);
            // cick save button
            SynchronizationHelper.WaitForClickability(driver, driver.FindElement(saveButtonLocator), 10);
            driver.FindElement(saveButtonLocator).Click();
        }
Пример #3
0
        public void DeleteCustomer(IWebDriver driver, string id)
        {
            SynchronizationHelper.WaitForVisibility(driver, customerRowsLocator, 10);
            IWebElement row = SearchById(driver, id);

            SynchronizationHelper.WaitForClickability(driver, row.FindElement(deleteButtonLocator), 10);
            row.FindElement(deleteButtonLocator).Click();
            ClickOkForPopUp(driver);
        }
Пример #4
0
        public void DeleteTimeAndMaterial(IWebDriver driver, string code, string description, string price)
        {
            SynchronizationHelper.WaitForVisibility(driver, timeAndMaterialsRowsLocator, 10);
            IWebElement itemToDelete = Search(driver, code, description, price); // row

            SynchronizationHelper.WaitForClickability(driver, itemToDelete.FindElement(deleteButtonLocator), 10);
            itemToDelete.FindElement(deleteButtonLocator).Click();
            // click OK button
            ClickOkForPopUp(driver);
        }