Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
        public bool CheckIfItIsLongText()
        {
            var designNameElement = DriverContext.BrowserWait()
                                    .Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='product-title']//h2")));


            return(false);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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[] { });
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 23
0
 public string GetNoDesignsMessage()
 {
     return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'no-designs-wrapper')]//h4"))).Text);
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 25
0
 public bool IsDisplayedHyperlinkMore()
 {
     return(DriverContext.BrowserWait().Until(ExpectedConditions.ElementExists(By.Id("designTitleDisplayMngLink"))).Displayed);
 }
Ejemplo n.º 26
0
 public void BackToMyDesign()
 {
     DriverContext.BrowserWait().Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='rmui-breadcrumb']//a[contains(@href, '#/designs')]"))).Click();
 }
Ejemplo n.º 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);
        }