Example #1
0
        /// <summary>
        /// Navigate browser to contact list page
        /// </summary>
        public static void GoToContacts()
        {
            if (ContactsPage.IsAt)
            {
                ContactsPage.ResetFilters();
                Commands.ClearSearchbox();
                return;
            }

            try
            {
                var contactsBtn = Driver.Instance.FindElement(By.CssSelector("#Contacts"));
                Driver.MoveToElement(contactsBtn);
                contactsBtn.Click();

                // wait for organization list to load
                var wait = new WebDriverWait(Driver.Instance, TimeSpan.FromSeconds(10));
                wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("main-content")));
            }
            catch (NoSuchElementException e)
            {
                Report.Report.ToLogFile(MessageType.Exception, "Browser was expected to be in Contacts Page but is not or page is not loaded properly", e);
                throw e;
            }
            catch (WebDriverTimeoutException e)
            {
                Report.Report.ToLogFile(MessageType.Exception, "Failed to load Contacts Page on time.", e);
                throw e;
            }
        }
Example #2
0
        public void Filter_Using_Filter_By()
        {
            ContactsPage.FilterBy().SelectingAllowEmail().Filter();
            var expectedResult1 = 85;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult1, $"The sum of contacts being displayed, with Allow Emails = True, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult1}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingAllowSMS().Filter();
            var expectedResult2 = 75;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult2, $"The sum of contacts being displayed, with Allow SMS = True, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult2}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingAllowPhones().Filter();
            var expectedResult3 = 49;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult3, $"The sum of contacts being displayed, with Allow Phones = True, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult3}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingOrphans().Filter();
            var expectedResult4 = 17;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult4, $"The sum of orphan contacts being displayed is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult4}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingDepartment(Department.Logistics).Filter();
            var expectedResult5 = 13;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult5, $"The sum of contacts being displayed and belong to Logistics department, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult5}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingDepartment(Department.Consulting).Filter();
            var expectedResult6 = 57;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult6, $"The sum of contacts being displayed and belong to Consulting department, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult6}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy().SelectingAllowEmail().SelectingDepartment(Department.RnD).Filter();
            var expectedResult7 = 7;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult7, $"The sum of contacts being displayed, with Allow Email = True and belong to RnD department, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult7}");
            ContactsPage.ResetFilters();

            ContactsPage.FilterBy()
            .SelectingAllowSMS()
            .SelectingAllowEmail()
            .SelectingDepartment(Department.Sales)
            .SelectingDepartment(Department.Administration)

            .Filter();
            var expectedResult8 = 6;

            VerifyThat.AreEqual(ContactsPage.TotalContactsCountByLabel, expectedResult8, $"The sum of contacts being displayed, with Allow SMS and Emails and belong either to the Sales or Administration departments, is different from the expected. ContactsDisplayed={ContactsPage.TotalContactsCount}, Expected={expectedResult8}");
        }