Exemplo n.º 1
0
        internal static bool ContactCorrectlyAdded(string addr1, string addr2, string city, string state, string zip, string country, string homePhone, string mobilePhone, string workPhone, string workEmail, string otherEmail)
        {
            _logger.Info("Entering ContactCorrectlyAdded().");
            //Build an array of data used to run extracted data against, note the 1 is there to account for column 1 which is a checkbox
            string[] ContactDetailsData = new string[] { addr1, addr2, city, OrangeHRM.AbbreviationStateExpand(state), zip, homePhone, mobilePhone, workPhone, workEmail, otherEmail, country };

            try
            {
                _logger.Info("Getting the data from the page");
                //Get the data from the page
                IList <IWebElement> PageData = Pages.Employee._driver.FindElements(By.XPath("//*/input[@type='text']"));
                //Build a list of extracted elements from table
                List <string> items = new List <string>();
                foreach (IWebElement item in PageData)
                {
                    items.Add(item.GetAttribute("value"));
                }
                // Get the value of the country drop-down and add to items
                items.Add(Pages.Employee._driver.FindElements(By.XPath("//option[@selected='selected']"))[1].GetAttribute("text"));
                //compare the two data sets and return true if they are equal
                _logger.Info($"Comparing Expected: {ContactDetailsData} to Actual: {items}.");
                return(Enumerable.SequenceEqual(items, ContactDetailsData));
            }

            catch
            {
                _logger.Info("The Contact was not added correctly.");
                return(false);
            }
            finally
            {
                _logger.Info("Exiting ContactCorrectlyAdded().");
            }
        }
Exemplo n.º 2
0
        internal static bool?IsLoadedCorrectly(string employeeDataFile)
        {
            _logger.Info("Entering IsLoadedCorrectly().");

            try
            {
                // Count number of emmployees in CSVData file
                long record_count = OrangeHRM.CountLinesInFile(employeeDataFile) - 1;

                // Get count from screen
                var screen_Text = Pages.CSVDataImport._driver.FindElement(By.XPath("//div[contains(@class, 'message success fadable')]")).Text;
                //var screen_Text  = Pages.CSVDataImport.NumberOfImportedRecords.Text;

                int num_Records_Imported = Int32.Parse(screen_Text.Remove(0, 28));

                if (record_count == num_Records_Imported)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
            finally
            {
                _logger.Info("Exiting IsLoadedCorrectly().");
            }
        }