示例#1
0
        public bool CheckShowFullLessDesignNameActionLinkBehaviors(bool needShowFullName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//div[contains(@class, 'fblw-timeline-item')]")));

            try
            {
                if (needShowFullName)
                {
                    DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show full name"))).Click();

                    DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show less"))).Click();

                    return(true);
                }

                DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show less"))).Click();

                DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show full name"))).Click();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#2
0
        public List <IWebElement> DownloadButtons()
        {
            var downloadButtons = DriverContext.BrowserWait().Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(
                                                                        By.XPath("//div[@id='componentInfo']//ul[@class='product-activities']//li//button[@ng-click='downloadDesign(action.jobName)']")));

            return(downloadButtons.ToList());
        }
示例#3
0
        public string GetDesignName(string expectedName = null)
        {
            if (string.IsNullOrEmpty(expectedName))
            {
                return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='product-title']//h2"))).Text);
            }
            else
            {
                var designName = string.Empty;

                void getDesignName()
                {
                    var i = 0;

                    do
                    {
                        designName = DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='product-title']//h2"))).Text;

                        if (designName.IsEquals(expectedName))
                        {
                            break;
                        }

                        Thread.Sleep(1000);
                        i++;
                    } while (i < 3);
                }

                getDesignName();

                return(designName);
            }
        }
示例#4
0
        public bool CheckIfItIsLongText()
        {
            var designNameElement = DriverContext.BrowserWait()
                                    .Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='product-title']//h2")));


            return(false);
        }
示例#5
0
        public string GetSelectedComponentName(bool isKit)
        {
            if (!isKit)
            {
                return(string.Empty);
            }

            return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='dropdown']//button"))).Text.Trim());
        }
示例#6
0
        public void DoSearchAndWaitResults(string designName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            DriverContext.Driver.ScrollToTop();

            var txtSearch = DriverContext.Driver.FindElement(By.Id("txtDesignSearch"));

            txtSearch.Clear();
            txtSearch.SendKeys(designName);

            DriverContext.Driver.FindElement(By.Id("doSearching")).Click();
        }
示例#7
0
        public bool CheckDesignCanGoToActionPage(string designName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var element = DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(
                                                                By.XPath($"//div[@data-documentname='{designName}']//div[@class='thumbnail']")));

            var actions = new Actions(DriverContext.Driver);

            actions.MoveToElement(element).Perform();

            return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath($"//div[@data-documentname='{designName}']//div[@class='thumbnail']//div[@class='content-wrapper']//ul//li[@class='inactive']//a[@name='go']"))) == null);
        }
示例#8
0
        public void DoSort(string optionName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='dropdown']")));

            //we should not use actions.MoveToEelement in this case because the dropdown location is incorrect since more data loaded by paging
            DriverContext.Driver.ScrollToTop();

            DriverContext.Driver.FindElement(By.XPath("//div[@class='dropdown']//button[contains(@class, 'dropdown')]")).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='dropdown open']")));

            DriverContext.Driver.FindElement(By.LinkText(optionName)).Click();
        }
示例#9
0
        public void ClickToEditDesign(string documentName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var element = DriverContext.BrowserWait(35).Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[@data-documentname='{documentName}']//div[@class='thumbnail']")));

            var actions = new Actions(DriverContext.Driver);

            actions.MoveToElement(element).Perform();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[@data-documentname='{documentName}']//div[@class='thumbnail']//div[@class='content-wrapper']//ul//li//a[@name='edit']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.UrlContains("UserEditFormFilling"));
        }
示例#10
0
        public void SubmitApprovalWorkflow()
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//button[@ng-click='submitForApproval()']"))).Click();

            //verify modal visibility
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

            //agree publish design
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//li//button[@ng-click='submitForApproval()']"))).Click();

            //verify modal is closed
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));

            Thread.Sleep(2000);
        }
示例#11
0
        public string[] GetDesignNames()
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var designs = DriverContext.Driver
                          .FindElements(
                By.XPath("//div[@class='thumbnail']//div[@class='caption']//div[@class='caption-container']//h4"));

            if (designs.Any())
            {
                return(designs.Select(x => x.Text).ToArray());
            }

            return(new string[] { });
        }
示例#12
0
        public bool CheckShowFullLessDesignNameActionLinkVisibility(bool visibilityExpectation, bool needShowFullName = true)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//div[contains(@class, 'fblw-timeline-item')]")));

            if (visibilityExpectation)
            {
                if (needShowFullName)
                {
                    return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show full name"))) != null);
                }

                return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Show less"))) != null);
            }

            return(Driver.FindElements(By.LinkText("Show less")).Any());
        }
示例#13
0
        public string RenameDesign(string name)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//div[contains(@class, 'fblw-timeline-item')]")));

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//a[@ng-click='renameDesign()']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

            var textField = DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.Name("designName")));

            textField.Clear();
            if (!string.IsNullOrEmpty(name))
            {
                textField.SendKeys(name);
            }

            Console.WriteLine("run to here 1!!!");
            //wait to renameDesign button ready for clicking
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//button[contains(@class, 'disabled')]")));
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@ng-click='renameDesign()']"))).Click();

            var messageElement =
                Driver.FindElements(By.XPath("//p[contains(@class, 'text-danger')]")).FirstOrDefault();

            if (messageElement != null)
            {
                var message = messageElement.Text;

                DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@ng-click='$dismiss()']"))).Click();

                //verify modal is closed
                DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));

                Driver.RefreshPage();

                return(message);
            }

            //verify modal is closed
            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));

            Console.WriteLine("run to here 2!!!");

            Driver.RefreshPage();

            return(string.Empty);
        }
示例#14
0
        public bool DoCopyDesign(string designName, string copiedDesignName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[@data-documentname='{designName}']//div[@class='thumbnail']//div[@class='content-wrapper']//ul//li//a[@name='copy']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

            var textField = DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.Name("designName")));

            textField.Clear();
            textField.SendKeys(copiedDesignName);

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@ng-click='cloneDesign()']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));

            return(CheckDesignExists(copiedDesignName));
        }
示例#15
0
        public string CheckValidDesignNameWhenRenaming(string designName)
        {
            var renameButton = DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.LinkText("Rename")));

            renameButton.Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

            var textField = DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.Name("designName")));

            textField.Clear();
            textField.SendKeys(designName);

            //wait until it's show error message if invalid design name

            return(string.Empty);
        }
示例#16
0
        public void DownloadDesign(bool needToPublishFirst, ref bool isShowSurveyInvitationModal)
        {
            var downloadButtons = DownloadButtons();

            foreach (var button in downloadButtons)
            {
                button.Click();

                if (needToPublishFirst)
                {
                    needToPublishFirst = false;

                    //verify modal visibility
                    DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

                    //agree publish design
                    DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@ng-click='createDesign()']"))).Click();

                    //verify modal is closed
                    DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));
                }
            }

            //TakeSurveyIfVisible(isShowSurveyInvitationModal);//TODO
            if (isShowSurveyInvitationModal)
            {
                isShowSurveyInvitationModal = false;
            }

            //wait until all download buttons are show checked icon
            void makeSureAllOutputsAreDownloaded(int expectedNumber)
            {
                var downloadedButtonsCount = DriverContext.BrowserWait().Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(
                                                                                   By.XPath("//div[@id='componentInfo']//ul[@class='product-activities']//li//button[contains(@class, 'downloaded')]"))).Count;

                if (downloadedButtonsCount != expectedNumber)
                {
                    makeSureAllOutputsAreDownloaded(expectedNumber);
                }
            }

            makeSureAllOutputsAreDownloaded(downloadButtons.Count);

            //DisplayCompletedDownloadModal();
        }
示例#17
0
        public void CheckGoToActions(string documentName)
        {
            if (DriverContext.Driver.IsUrlEndsWith("onedesign"))
            {
                return;
            }

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));
            var element = DriverContext.BrowserWait(35).Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[@data-documentname='{documentName}']//div[@class='thumbnail']")));

            var actions = new Actions(DriverContext.Driver);

            actions.MoveToElement(element).Perform();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[@data-documentname='{documentName}']//div[@class='thumbnail']//div[@class='content-wrapper']//ul//li//a[@name='go']"))).Click();


            DriverContext.BrowserWait().Until(ExpectedConditions.UrlContains("onedesign"));
        }
示例#18
0
        public bool CheckDeleteDocumentAction(string documentName)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var element = DriverContext.BrowserWait(35).Until(ExpectedConditions.ElementToBeClickable(
                                                                  By.XPath($"//div[contains(@data-documentname, '{documentName}')]//div[@class='thumbnail']")));

            var actions = new Actions(DriverContext.Driver);

            actions.MoveToElement(element).Perform();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath($"//div[contains(@data-documentname, '{documentName}')]//div[@class='thumbnail']//div[@class='content-wrapper']//ul//li//a[@name='delete']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.ClassName("modal-open")));

            DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//button[@ng-click='deleteDesign()']"))).Click();

            DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.ClassName("modal-open")));

            return(!CheckDesignExists(documentName));
        }
示例#19
0
        public string GetDesignStatus(string designName)
        {
            var result = string.Empty;

            void getStatus(string name)
            {
                var i = 0;

                do
                {
                    try
                    {
                        DriverContext.BrowserWait()
                        .Until(ExpectedConditions.ElementIsVisible(
                                   By.XPath($"//div[@data-documentname='{name}']")));

                        var element = DriverContext.BrowserWait(3).Until(ExpectedConditions.ElementIsVisible(
                                                                             By.XPath(
                                                                                 $"//div[@data-documentname='{name}']//div[@class='thumbnail']//div[@class='content-wrapper']//div[contains(@class, 'design-info')]//span")));

                        result = element.Text;

                        break;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Design name: {designName}; exception details: {ex}");
                    }

                    i++;

                    DriverContext.Driver.RefreshPage();
                } while (i < 3);
            }

            getStatus(designName);

            return(result);
        }
示例#20
0
        public int CountDesignsByStatus(int expectedNumber, string status)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var designsByStatusCount = 0;
            var tryingTime           = 0;

            do
            {
                designsByStatusCount = DriverContext.Driver.FindElements(By.XPath("//div[@class='thumbnail']//div[@class='content-wrapper']//div[contains(@class, 'design-info')]//span")).Where(x => x.Text.IsEquals(status)).Count();

                if (designsByStatusCount == expectedNumber)
                {
                    break;
                }

                tryingTime++;

                Thread.Sleep(1000);
            } while (tryingTime < 5);

            return(designsByStatusCount);
        }
示例#21
0
        public bool DoPaging()
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            var elements = DriverContext.Driver.FindElements(By.Id("paging"));

            if (elements.Any() && elements.FirstOrDefault().Displayed)
            {
                var button  = DriverContext.Driver.FindElement(By.XPath("//div[@id='paging']//div/button"));
                var actions = new Actions(DriverContext.Driver);
                actions.MoveToElement(button);

                button.Click();

                DriverContext.BrowserWait().Until(ExpectedConditions.InvisibilityOfElementLocated(By.XPath("//div[@id='paging']//div//button[contains(@class, 'pressed')]")));

                Thread.Sleep(2000);

                return(true);
            }

            return(false);
        }
示例#22
0
 public string GetRetiredOrDeletedLabel(string designName)
 {
     return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath($"//div[@data-documentname='{designName}']//div[@class='thumbnail']//div[@class='content-wrapper']//label"))).Text);
 }
示例#23
0
 public string GetNoDesignsMessage()
 {
     return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'no-designs-wrapper')]//h4"))).Text);
 }
示例#24
0
        public int CountDesignsByStatus(string status)
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.Id("products")));

            return(DriverContext.Driver.FindElements(By.XPath("//div[@class='thumbnail']//div[@class='content-wrapper']//div[contains(@class, 'design-info')]//span")).Where(x => x.Text.IsEquals(status)).Count());
        }
示例#25
0
 public bool IsDisplayedHyperlinkMore()
 {
     return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementExists(By.Id("designTitleDisplayMngLink"))).Displayed);
 }
示例#26
0
 public void BackToMyDesign()
 {
     DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='rmui-breadcrumb']//a[contains(@href, '#/designs')]"))).Click();
 }
示例#27
0
        public string GetSelectedSortingOption()
        {
            DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='dropdown']")));

            return(DriverContext.Driver.FindElement(By.XPath("//div[@class='dropdown']//button[contains(@class, 'dropdown')]")).Text);
        }