Example #1
0
 public bool SearchProject(TestDataSheet data, string projectStatus = "All")
 {
     Log.Information("Start of SearchProject()...");
     WaitForProgressToComplete();
     HoverElement(AddProjectLink);
     GetElement(ProjectStatus).SelectComboValue(projectStatus);
     GetElement(ProjectSearch).EnterText(data.Value(0, "ProjectName"));
     WaitForProgressToComplete();
     if (IsElementPresent(ProjectSearchResults))
     {
         if (IsElementPresent(SearchResultProjectCard))
         {
             var searchResultProjectName = new BaseElement("Xpath", ".//span[@class='empName']");
             var searchResultCard        = GetElement(SearchResultProjectCard);
             var actualProjectName       = searchResultCard.GetElement(searchResultProjectName).Text;
             Log.Information("Found {actualProjectName} in Search Results", actualProjectName);
             return(String.Equals(actualProjectName, data.Value(0, "ProjectName")));
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 public bool SearchClient(TestDataSheet data, string clientStatus = "All")
 {
     Log.Information("Start of SearchClient()...");
     WaitForProgressToComplete(5);
     HoverElement(AddClientBtn);
     WaitForProgressToComplete(25);
     GetElement(ClientStatus).SelectComboValue(clientStatus);
     GetElement(ClientSearch).EnterText(data.Value(0, "ClientName"));
     WaitForProgressToComplete(5);
     if (IsElementPresent(ClientSearchResults))
     {
         if (IsElementPresent(SearchResultClientCard))
         {
             var actualClientName = GetElement(SearchResultClientCard)
                                    .GetElement(SearchResultClientName).Text;
             Log.Information("Found {actualClientName} in Search Results", actualClientName);
             return(String.Equals(actualClientName, data.Value(0, "ClientName")));
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        public int SearchExpense(TestData data)
        {
            var resultRows = -1;

            Log.Information("In SearchExpense...");
            try
            {
                WaitForProgressToComplete();
                Thread.Sleep(20000); // Workaround - No Progress Bar
                TestDataSheet expenseRows = data.Get("Expense");
                GetElement(SearchProject).SelectComboValue(expenseRows.Value(0, "ProjectName"));
                WaitForProgressToComplete();
                GetElement(SearchEmployee).SelectComboValue(expenseRows.Value(0, "EmployeeName"));
                WaitForProgressToComplete();
                GetElement(SearchYear).SelectComboValue(expenseRows.Value(0, "SearchYear"));

                WaitForProgressToComplete(3);
                if (IsElementPresent(ExpenseTable))
                {
                    resultRows = GetElement(ExpenseTable).GetTableRows().Count;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Log.Information("End of SearchExpense...");

            return(resultRows);
        }
Example #4
0
        public Login LogIn(TestDataSheet data, int rowNum = 0)
        {
            GetElement(UserName).EnterText(data.Value(rowNum, "UserName"));
            GetElement(Password).EnterText(data.Value(rowNum, "Password"));
            GetElement(LoginBtn).ClickIt();

            Log.Information("Logging with User Name {UserName}, Password {Password}", data.Value(0, "UserName"), data.Value(0, "Password"));

            return(this);
        }
Example #5
0
        public void EditExpense(TestData data)
        {
            Log.Information("In EditExpense...");
            try
            {
                TestDataSheet expenseRows = data.Get("Expense");

                int searchRows = SearchExpense(data);

                if (searchRows > 0)
                {
                    var searchCriteria = String.Format("Consultant={0}", expenseRows.Value(0, "EmployeeName"));
                    GetElement(ExpenseTable)
                    .GetTableCell("Actions", searchCriteria)
                    .GetElement(EditExpenseIcon)
                    .ClickIt();
                }
                else
                {
                    throw new Exception("No results found in Expense Summary Table");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Log.Information("End of EditExpense");
        }
        public void ActivateEmployeeViaUrl(TestDataSheet data)
        {
            try
            {
                var employeeEmail    = data.Value(0, "Email");
                var employeeLastName = data.Value(0, "LastName");

                var activationLink = this.GetActivationUrl(employeeEmail);
                this.DriverManager.OpenUrl(activationLink);

                GetElement(LastName).EnterText(employeeLastName);
                GetElement(Email).EnterText(employeeEmail);
                WaitForProgressToComplete();
                GetElement(ConfirmBtn).ClickIt();
            }
            catch (Exception ex)
            {
                Log.Error("Error in ActivateEmployeeViaUrl {message} {stack}", ex.Message, ex.StackTrace);
                throw ex;
            }
        }
Example #7
0
        public string Register(TestDataSheet data)
        {
            try
            {
                Log.Information("RegisterEmployee.Register...Start");
                WaitForProgressToComplete();
                HoverElement(RegisterEmployeeLink);
                GetElement(RegisterEmployeeLink).ClickIt();
                GetElement(EmployeeType).SelectComboValue(data.Value(0, "EmployeeType"));
                GetElement(Salutation).SelectComboValue(data.Value(0, "Salutation"));
                GetElement(FirstName).EnterText(data.Value(0, "FirstName"));
                GetElement(LastName).EnterText(data.Value(0, "LastName"));
                GetElement(DateOfBirth).EnterText(data.Value(0, "DateOfBirth"));
                GetElement(SocialSecurityNumber).EnterText(data.Value(0, "SocialSecurityNumber"));
                GetElement(Gender).SelectComboValue(data.Value(0, "Gender"));
                GetElement(Email).EnterText(data.Value(0, "Email"));
                GetElement(Phone).EnterText(data.Value(0, "Phone"));
                GetElement(RegistrationSubmit).ClickIt();

                var actualMessage = this.Driver.GetElement(AlertMessage).GetText();
                GetElement(AlertOkBtn).ClickIt();

                if (IsElementPresent(AlertOkBtn)) // Bug
                {
                    GetElement(AlertOkBtn).ClickIt();
                }

                Log.Information("RegisterEmployee.Register...End");

                return(actualMessage);
            }
            catch (Exception ex)
            {
                Log.Error("Error in RegisterEmployee.Register {message} {stack}", ex.Message, ex.StackTrace);
                throw ex;
            }
        }
Example #8
0
        public void AddNewExpense(TestData data)
        {
            Log.Information("In AddNewExpense...");
            try
            {
                TestDataSheet expenseRows = data.Get("Expense");
                WaitForProgressToComplete();
                HoverElement(AddExpense);
                GetElement(AddExpense).ClickIt();

                WaitForProgressToComplete(10);
                var empName = expenseRows.Value(0, "EmployeeName");
                GetElement(EmployeeName).SelectComboValue(empName);
                WaitForProgressToComplete(30); // Workaround - no progress bar
                GetElement(ProjectName).Select("Text", expenseRows.Value(0, "ProjectName"));
                GetInlineSwitchElement("Approved By Client", expenseRows.Value(0, "ApprovedByClient")).ClickIt();
                GetElement(StartDate).EnterText(expenseRows.Value(0, "StartDate"));
                GetElement(EndDate).EnterText(expenseRows.Value(0, "EndDate"));
                GetElement(ApproverName).EnterText(expenseRows.Value(0, "ApproverName"));

                List <TestDataRow> receiptLines = data.Get("Receipts")
                                                  .FilterRows("EmployeeName=" + empName);
                foreach (TestDataRow receipt in receiptLines)
                {
                    GetElement(AddReceipt).ClickIt();
                    GetElement(ReceiptAmount).EnterText(receipt.Value("ReceiptAmount"));
                    GetElement(ReceiptType).SelectComboValue(receipt.Value("ReceiptType"));
                    GetElement(SaveReceipt).ClickIt();
                }

                GetElement(SaveExpense).ClickIt();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Log.Information("End of AddNewExpense");
        }
Example #9
0
        public void CreateNewProject(TestDataSheet data)
        {
            Log.Information("In CreateProject...");

            WaitForProgressToComplete(5);
            GetElement(ProjectName).EnterText(data.Value(0, "ProjectName"));
            GetElement(ProjectShortName).EnterText(data.Value(0, "ProjectShortName"));
            GetElement(Client).SelectComboValue(data.Value(0, "Client"));
            GetElement(StartDate).EnterText(data.Value(0, "StartDate"));
            Thread.Sleep(3000); // Workaround
            GetElement(DurationType).SelectComboValue(data.Value(0, "DurationType"));
            GetElement(Duration).EnterText(data.Value(0, "Duration"));
            GetElement(ProjectDescription).SendKeys(Keys.Tab);

            GetElement(Next).ClickIt();

            var purhcaseOrderFile = Path.Combine(ConfigManager.DataFolder, data.Value(0, "PurchaseOrderFile"));

            SelectFile(PurchaseOrder, purhcaseOrderFile);
            GetElement(Rate).EnterText(data.Value(0, "Rate"));
            GetElement(Weekends).MultiSelectComboValues(data.Value(0, "Weekends").Split(','));
            GetElement(Next).ClickIt();

            GetElement(HomeAddress1).EnterText(data.Value(0, "HomeAddress1"));
            GetElement(HomeAddress2).EnterText(data.Value(0, "HomeAddress2"));
            GetElement(HomeCountry).SelectComboValue(data.Value(0, "HomeCountry"));
            GetElement(HomeCity).EnterText(data.Value(0, "HomeCity"));
            GetElement(HomeZip).EnterText(data.Value(0, "HomeZip"));
            GetElement(Next).ClickIt();

            GetElement(Submit).ClickIt();

            WaitForProgressToComplete(10);
            Log.Information("End of CreateProject");
        }
Example #10
0
        public bool AddBasicDetails(TestDataSheet data)
        {
            //try
            //{
            Log.Information("RegisterEmployee.AddBasicDetails...Start");

            WaitForLoadingToComplete();
            GetElement(HomePhone).EnterText(data.Value(0, "HomePhone"));
            GetElement(HomeAddress1).EnterText(data.Value(0, "HomeAddress1"));
            GetElement(HomeAddress2).EnterText(data.Value(0, "HomeAddress2"));
            GetElement(HomeCountry).SelectComboValue(data.Value(0, "HomeCountry"));
            GetElement(HomeCity).EnterText(data.Value(0, "HomeCity"));
            GetElement(HomeZip).EnterText(data.Value(0, "HomeZip"));
            WaitForLoadingToComplete();
            GetElement(NextBtn).ClickIt();

            // Additional Info
            GetElement(PositionAppliedFor).EnterText(data.Value(0, "PositionAppliedFor"));
            GetElement(NextBtn).ClickIt();

            // Edu & Exp
            GetElement(NextBtn).ClickIt();

            // Skills & Cert
            GetElement(AddSkillBtn).ClickIt();
            GetElement(SkillName).EnterText(data.Value(0, "SkillName"));
            GetElement(SkillLevel).SelectComboValue(data.Value(0, "SkillLevel"));
            if (data.Value(0, "IsCertified").ToLower().Equals("yes"))
            {
                GetSwitchElement("Certified", "Yes").ClickIt();
            }
            GetElement(SkillSaveBtn).ClickIt();
            GetElement(NextBtn).ClickIt();

            // Dependents
            WaitForLoadingToComplete();
            GetElement(AlertOkBtn).ClickIt();     // Application Issue
            GetElement(NextBtn).ClickIt();

            // Emergency Contacts
            WaitForLoadingToComplete();
            GetElement(AlertOkBtn).ClickIt();     // Application Issue
            GetElement(NextBtn).ClickIt();

            // Medical CC
            WaitForLoadingToComplete();
            GetElement(AlertOkBtn).ClickIt();     // Application Issue
            GetElement(NextBtn).ClickIt();

            // Reference
            WaitForLoadingToComplete();
            GetElement(AlertOkBtn).ClickIt();     // Application Issue
            GetElement(NextBtn).ClickIt();

            // Summary
            WaitForLoadingToComplete();
            GetElement(AcknowlegeCheck).ClickIt();
            GetElement(SubmitBtn).ClickIt();

            Log.Information("RegisterEmployee.AddBasicDetails...End");

            return(true);

            /*}
             * catch (Exception ex)
             * {
             *  Log.Error("Error in AddBasicDetails {message} {stack}", ex.Message, ex.StackTrace);
             *  throw ex;
             * }*/
        }
Example #11
0
 public string EmployeeRegistrationExpectedMessage(TestDataSheet data)
 {
     return(String.Format("Employee {0} {1} added.", data.Value(0, "FirstName"), data.Value(0, "LastName")));
 }
Example #12
0
        public void AddClient(TestData data)
        {
            Log.Information("In AddClient()...start");
            TestDataSheet clientData = data.Get("Client");

            WaitForProgressToComplete(2);
            GetElement(ClientName).EnterText(clientData.Value(0, "ClientName"));
            GetElement(RelationshipManager).SelectComboValue(clientData.Value(0, "RelationshipManager"));
            GetElement(Email).EnterText(clientData.Value(0, "Email"));
            GetElement(Phone).EnterText(clientData.Value(0, "Phone"));
            GetElement(Next).ClickIt();

            WaitForLoadingToComplete();
            GetElement(HomeAddress1).EnterText(clientData.Value(0, "HomeAddress1"));
            GetElement(HomeAddress2).EnterText(clientData.Value(0, "HomeAddress2"));
            GetElement(HomeCountry).SelectComboValue(clientData.Value(0, "HomeCountry"));
            GetElement(HomeState).SelectComboValue(clientData.Value(0, "HomeState"));
            GetElement(HomeCity).EnterText(clientData.Value(0, "HomeCity"));
            GetElement(HomeZip).EnterText(clientData.Value(0, "HomeZip"));
            GetInlineSwitchElement("Same as Address", clientData.Value(0, "SameAsAddress")).ClickIt();
            GetElement(Next).ClickIt();

            WaitForLoadingToComplete();
            GetElement(Weekends).MultiSelectComboValues(clientData.Value(0, "Weekends").Split(','));
            GetElement(Next).ClickIt();

            GetElement(Submit).ClickIt();

            Log.Information("In AddClient()...End");
        }