public void NavigateToNotificationPage(IWebDriver driver)
        {
            // Wait and Click on Notification
            WaitForElementClickable(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/div", 10);
            NotificationBtn.Click();

            // Wait and Click on See All button
            WaitForElementClickable(driver, "XPath", "//a[contains(text(), 'See All')]", 10);
            SeeAllLink.Click();
        }
Beispiel #2
0
        internal void ShowLessAndMoreNotification(IWebDriver driver)
        {
            // Wait and Click on Notification
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/div", 10);
            NotificationBtn.Click();

            // Wait and Click on See All button
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[contains(text(), 'See All')]", 10);
            SeeAllLink.Click();

            // Judge if the load more button appear, or remind user to add more notifications
            try
            {
                // Wait and scroll down to bottom of page
                GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[@class='ui button']", 10);
                GlobalDefinitions.ScrollToBottom();

                // Click on Load More and record the qty of notification
                Thread.Sleep(500);
                ShowLessAndLoadMoreBtn.Click();
            } catch (NoSuchElementException e)
            {
                Base.test.Log(LogStatus.Fail, "Make sure the notifications are more than 5 to use load more function");
                Assert.Fail("Please make sure more than 5 notifications to use load more function!", e.Message);
            }

            //GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='notification-section']//" +
            //    "div[last()-1]/div/div/div[3]/input", 10);
            Thread.Sleep(1500);
            var requestsLoadMore = driver.FindElements(By.XPath("//h4[contains(text(), 'Service Request')]"));

            requestsQtyLoadMore = requestsLoadMore.Count();

            // Wait and Click on Show Less and record the qty of notifications
            ShowLessAndLoadMoreBtn.Click();

            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='notification-section']//" +
                                                      "div[last()-1]/div/div/div[3]/input", 10);
            var requestsShowLess = driver.FindElements(By.XPath("//h4[contains(text(), 'Service Request')]"));

            requestsQtyShowLess = requestsShowLess.Count();

            // Extent report
            Base.test.Log(LogStatus.Fail, "Show less and load more notifications successfully!");

            Debug.WriteLine("Load MORE qty:" + requestsQtyLoadMore + "SHOW LESS QTY:" + requestsQtyShowLess);
        }
Beispiel #3
0
        internal void MarkAsReadNotification(IWebDriver driver)
        {
            // Wait and Click on Notification
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/div", 10);
            NotificationBtn.Click();

            // Wait and Click on See All button
            GlobalDefinitions.WaitForElement(driver, "XPath", "//a[contains(text(), 'See All')]", 10);
            SeeAllLink.Click();

            // Wait and scroll down to bottom of page
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[@class='ui button']", 10);
            GlobalDefinitions.ScrollToBottom();

            // Click on Load More and record the qty of notification
            Thread.Sleep(500);
            ShowLessAndLoadMoreBtn.Click();

            //Judge if there are unread notifications
            //GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='notification-section']//div[last()-1]/div/div/div[3]/input", 10);
            Thread.Sleep(1500);
            try
            {
                var unreadNotis = driver.FindElements(By.XPath("//div[@class='fourteen wide column' and @style='font-weight: bold;']"));
                unreadNoticQty = unreadNotis.Count();
            } catch (NoSuchElementException)
            {
                Base.test.Log(LogStatus.Fail, "No unread notifications now, please add some first!");
                Assert.Fail("There is no unread notification in list! Please try to add some first!");
            }

            //If so, click on the 1st Notification checkbox
            GlobalDefinitions.ScrollToTop();
            Thread.Sleep(500);
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "(//div[@class='fourteen wide column' " +
                                                      "and @style='font-weight: bold;'])[1]/../div[3]/input", 10);
            FirstUnreadNotisCheckbox.Click();

            // Click on mark as read
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//div[@data-tooltip='Mark selection as read']", 10);
            MarkAsReadBtn.Click();
            Debug.WriteLine("Unread Notification QTY Now:" + unreadNoticQty);

            // Extent report
            Base.test.Log(LogStatus.Pass, "Mark notification ad read successfully!");
        }
Beispiel #4
0
        internal void DeleteNotification(IWebDriver driver)
        {
            // Wait and Click on Notification
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/div", 10);
            NotificationBtn.Click();

            // Wait and Click on See All button
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[contains(text(), 'See All')]", 10);
            SeeAllLink.Click();

            // Wait and Click on Load More
            Thread.Sleep(2000);
            GlobalDefinitions.ScrollToBottom();
            Thread.Sleep(500);
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//a[contains(text(),'Load More')]", 15);

            ShowLessAndLoadMoreBtn.Click();

            // Judge if all notifications are fully loaded
            Thread.Sleep(1500);
            bool present;

            do
            {
                try
                {
                    driver.FindElement(By.XPath("//a[contains(text(),'Load More')]"));
                    present = true;
                }
                catch (NoSuchElementException)
                {
                    present = false;
                    break;
                }

                GlobalDefinitions.ScrollToBottom();
                Thread.Sleep(500);
                driver.FindElement(By.XPath("//a[contains(text(),'Load More')]")).Click();
                Thread.Sleep(1500);
            }while (present);


            // Record the elements qty
            Thread.Sleep(500);
            var notification = driver.FindElements(By.XPath("//h4[contains(text(),'Service Request')]"));

            NotificationQty = notification.Count();
            Debug.WriteLine("The qty of notification is:" + NotificationQty);

            // Scroll down to end of page and Select the notification
            GlobalDefinitions.ScrollToBottom();
            Thread.Sleep(1000);
            LastNotificationCheckbox.Click();
            Thread.Sleep(300);

            // Scroll to top of page
            GlobalDefinitions.ScrollToTop();
            Thread.Sleep(500);

            // Click on delete button
            GlobalDefinitions.WaitForElementClickable(driver, "XPath", "//div[@data-tooltip='Delete selection']", 10);
            DeleteBtn.Click();

            // Extent report
            Base.test.Log(LogStatus.Pass, "Delete notification successfully!");
        }