Beispiel #1
0
 public void WaitUntilProgressBarShowsUpdatedStatusError(int maxWaitSeconds)
 {
     FlowUtilities.WaitUntil(() =>
     {
         return(driver.FindElement(By.XPath("//*[@attr.data-idare-id='CaseUploadFileError']")) != null);
     }, TimeSpan.FromSeconds(maxWaitSeconds), TimeSpan.FromMilliseconds(100));
 }
Beispiel #2
0
        public void ThenTheCaseWithTheUniqueIdAsRexisIDIsOnTheTopOfTheList()
        {
            var response = FlowUtilities.WaitUntil(() => mainCasesPage.firstIdRowText.Contains(rexisId),
                                                   TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(100));

            Assert.True(response.Success, "The case is not displayed.");
        }
Beispiel #3
0
        public void ThenTheOnlyTwoCasesWithTheSameICreatedAreDisplayed(CaseSearchProperty property)
        {
            FlowUtilities.WaitUntil(
                () => (mainCasesPage.SelectCases(caseCreatedForSearch, property)), TimeSpan.FromSeconds(2000), TimeSpan.FromMilliseconds(25));

            Assert.True(mainCasesPage.SelectCases(caseCreatedForSearch, property), "The searching filter is not working");
        }
Beispiel #4
0
        public void ThenTheCaseCreationDialogIsClosed()
        {
            var response =
                FlowUtilities.WaitUntil(() => !InteractionUtilities.IsVisible("CaseDialog", this.environment.Driver),
                                        TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(1));

            Assert.True(response.Success, "The case creation page should not be displayed.");
        }
Beispiel #5
0
        public void AssertThatNoProgressBarIsShown()
        {
            //dont want a progress bar - if one appears we fail - so a timeout is good
            var response = FlowUtilities.WaitUntil(() => driver.FindElements(By.XPath("//*[@attr.data-idare-id='CaseUploadFileProgressBar']")).Count >= 1,
                                                   TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100));

            Assert.True(response.TimedOut);
        }
Beispiel #6
0
 public void WaitUntilProgressBarIsShown(int numberOfUploads)
 {
     for (int i = 0; i < numberOfUploads; i++)
     {
         FlowUtilities.WaitUntil(
             () => driver.FindElements(By.XPath("//*[@attr.data-idare-id='CaseUploadFileProgressBar']")).Count == numberOfUploads,
             TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100));
     }
 }
Beispiel #7
0
        public void AssertFileUploadListFileIsDisplayed(string fileName)
        {
            var response = FlowUtilities.WaitUntil(() =>
            {
                IWebElement caseFileUploaded = this.CaseFilesToUploadList;
                return(caseFileUploaded.Text.Contains(fileName));
            }, TimeSpan.FromSeconds(60), TimeSpan.FromMilliseconds(100));

            Assert.True(response.Success, response.ToString());
        }
Beispiel #8
0
 public void ThereAreAtLeastCasesCreated(int cases)
 {
     FlowUtilities.WaitUntil(() =>
     {
         if (!(mainCasesPage.ReadPageLabel() > cases))
         {
             this.GivenICreateANewCaseWithoutProblemReport();
         }
         return(mainCasesPage.ReadPageLabel() > cases);
     }, TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(100));
 }
Beispiel #9
0
        public void AssertThatAllProgressBarsAreRemoved()
        {
            bool elementHasDisappeared = false;

            var response = FlowUtilities.WaitUntil(() =>
            {
                elementHasDisappeared = !InteractionUtilities.IsVisible("CaseUploadFileProgressBar", this.driver);
                return(elementHasDisappeared);
            },
                                                   TimeSpan.FromSeconds(300), TimeSpan.FromMilliseconds(500));

            Assert.True(response.Success, "The progress bars were not removed at the end of the upload");
        }
Beispiel #10
0
 public void WaitUntilCasesAreUpdated(string caseId, string fieldUpdated)
 {
     FlowUtilities.WaitUntil(
         () =>
     {
         try
         {
             var caseRows = GetRowsElements();
             var ret      = caseRows.Where(row => row.Text.Contains(caseId));
             return(ret.Any(row => row.Text.Contains(fieldUpdated)));
         }
         catch
         {
             return(false);
         }
     }, TimeSpan.FromSeconds(2000), TimeSpan.FromMilliseconds(25));
 }
Beispiel #11
0
        public void NavigateToTeachingModule()
        {
            driver.Manage().Window.Maximize();

            var targetUrl = Constants.PageTeachingUri;

            driver.Navigate().GoToUrl(targetUrl);
            FlowUtilities.WaitUntil(
                () =>
            {
                try
                {
                    IWebElement teachingRocheIconHeader = driver.FindElement(By.XPath("//*[@attr.data-idare-id='TeachingRocheIcon']"));
                    return(true);
                }
                catch (NoSuchElementException ex)
                {
                    return(false);
                }
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100), "The URL specified could not be found");
        }
Beispiel #12
0
        public void SelectOptionInTimezoneDropdown(int optionIndex)
        {
            TimezoneElement.Click();
            TimezoneElement.SendKeys("U");
            var response = FlowUtilities.WaitUntil(() =>
            {
                var optionsLoaded = GetTimezoneOptions().Count >= optionIndex - 1;

                if (!optionsLoaded)
                {
                    TimezoneElement.Click();
                }

                return(optionsLoaded);
            }, TimeSpan.FromSeconds(4), TimeSpan.FromMilliseconds(100));

            Assert.True(response.Success, response.ToString());

            IWebElement timezoneOption = GetTimezoneOptions().ToArray()[optionIndex - 1];

            timezoneOption.Click();
        }
Beispiel #13
0
        public void ThenCasesAreSortedByCreationTime()
        {
            IEnumerable <DateTime> obtainedCreationDateTime = null;
            IEnumerable <DateTime> orderedCreationDateTime  = null;

            FlowUtilities.WaitUntil(
                () =>
            {
                try
                {
                    obtainedCreationDateTime = mainCasesPage.GetCreationDateTime();
                    orderedCreationDateTime  = mainCasesPage.GetSortedDates();

                    return(orderedCreationDateTime.SequenceEqual(obtainedCreationDateTime));
                }
                catch (StaleElementReferenceException ex)
                {
                    environment.Log.Error("Error getting data: " + ex.Message);
                    return(false);
                }
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100));
        }
Beispiel #14
0
        public int ReadPageLabel()
        {
            int numberOfCases = -1;
            var response      = FlowUtilities.WaitUntilWithoutException(
                () =>
            {
                IWebElement componentPaginator = driver.FindElement(By.XPath("//*[@attr.data-idare-id='CaseListComponentPaginator']"));
                IWebElement inside1            = componentPaginator.FindElement(By.CssSelector("div.mat-paginator-range-label"));
                string rangeLabel = inside1.Text;

                int start = rangeLabel.LastIndexOf(" ");
                if (start < 0)
                {
                    return(false);
                }
                string labelCut = rangeLabel.Substring(start);
                numberOfCases   = Int32.Parse(labelCut);
                return(numberOfCases > 0);
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(25));

            Assert.True(response.Success, response.ToString());

            return(numberOfCases);
        }
Beispiel #15
0
        public void WhenIEnterToTheDetailsOfACase()
        {
            FlowUtilities.WaitUntil(
                () => (mainCasesPage.firstIdRowText.Contains("CAS-0123")), TimeSpan.FromSeconds(20), TimeSpan.FromMilliseconds(100),
                "The created case is not located in the first position of the Cases Overview grid");

            FlowUtilities.WaitUntil(
                () =>
            {
                try
                {
                    mainCasesPage.PressDetailsButton();
                    casesDetailsPage.PressCloseCaseDetailsButton();
                    return(mainCasesPage.firstCaseSWVersionText.Contains("01."));
                }
                catch
                {
                    return(false);
                }
            }, TimeSpan.FromSeconds(20), TimeSpan.FromMilliseconds(1000));

            mainCasesPage.PressDetailsButton();
            Assert.True(casesDetailsPage.closeCaseDetailsButton.Enabled, "The case details page was not opened.");
        }
Beispiel #16
0
        public void NavigateTo()
        {
            driver.Manage().Window.Maximize();

            var targetUrl = Constants.PageUri;

            this.log.Info($"Navigating to {targetUrl}");

            driver.Navigate().GoToUrl(targetUrl);
            FlowUtilities.WaitUntil(
                () =>
            {
                try
                {
                    IWebElement rocheLogo = driver.FindElement(By.CssSelector("svg.prv-roche-icon"));
                    return(true);
                }
                catch (NoSuchElementException ex)
                {
                    log.Error("The URL specified could not be found" + ex);
                    return(false);
                }
            }, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100), "The URL specified could not be found");
        }
Beispiel #17
0
 public void ThenTheStatusGetsUpdatedAsSuccessful()
 {
     FlowUtilities.WaitUntil(() => rexisId.Contains(mainCasesPage.firstIdRowText), TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(100));
 }
Beispiel #18
0
 public void PressCloseCaseDetailsButton()
 {
     FlowUtilities.WaitUntil(() => closeCaseDetailsButton.Enabled, TimeSpan.FromSeconds(2), TimeSpan.FromMilliseconds(100));
     closeCaseDetailsButton.Click();
 }
Beispiel #19
0
 internal void WaitUntilRangeLabelChanges()
 {
     FlowUtilities.WaitUntil(() => RangeLabelText.StartsWith("1 -"), TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(100));
 }