Beispiel #1
0
        public static void UpdateEmployee(string firstname, string lastname, string dependents, IWebDriver driver)
        {
            AddEmployeeDialogBox    addEmp    = new AddEmployeeDialogBox(driver);
            UpdateEmployeeDialogBox updateEmp = new UpdateEmployeeDialogBox(driver);

            addEmp.FirstNameTextbox.Clear();
            addEmp.FirstNameTextbox.SendKeys(firstname);

            addEmp.LastNameTextbox.Clear();
            addEmp.LastNameTextbox.SendKeys(lastname);

            addEmp.DependentsTextbox.Clear();
            addEmp.DependentsTextbox.SendKeys(dependents);

            updateEmp.UpdateButton.Click();
        }
        public void AddEmployeeDialogBoxDisplayValidation()
        {
            EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver);
            UpdateEmployeeDialogBox      updateEmp = new UpdateEmployeeDialogBox(driver);

            Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver);
            dashboard.AddEmployeeButton.Click();
            try
            {
                Assert.IsTrue(updateEmp.UpdateEmployeeDialogBoxHeader.Displayed);
                Assert.AreEqual(updateEmp.UpdateEmployeeDialogBoxHeader.Text, "Update Employee");

                Assert.IsTrue(updateEmp.FirstNameLabel.Displayed);
                Assert.AreEqual(updateEmp.FirstNameLabel.Text, "First Name:");

                Assert.IsTrue(updateEmp.LastNameLabel.Displayed);
                Assert.AreEqual(updateEmp.LastNameLabel.Text, "Last Name:");

                Assert.IsTrue(updateEmp.DependentsLabel.Displayed);
                Assert.AreEqual(updateEmp.DependentsLabel.Text, "Dependents");

                Assert.IsTrue(updateEmp.UpdateButton.Displayed);
                Assert.AreEqual(updateEmp.UpdateButton.Text, "Add");

                Assert.IsTrue(updateEmp.CancelButton.Displayed);
                Assert.AreEqual(updateEmp.CancelButton.Text, "Cancel");

                Assert.IsTrue(updateEmp.CrossButton.Displayed);
            }
            catch (Exception)
            {
                updateEmp.CancelButton.Click();
                Thread.Sleep(2000);
                dashboard.LogOutLink.Click();
            }
        }