Ejemplo n.º 1
0
 private static void ChangeAndTestLocalization(IBrowserWrapperFluentApi browser)
 {
     browser.First("p").CheckIfInnerTextEquals("This comes from resource file!", false, true);
     // change language
     browser.Last("a").Click();
     browser.First("p").CheckIfInnerTextEquals("Tohle pochází z resource souboru!", false, true);
 }
Ejemplo n.º 2
0
        private void TestLinkButton(IBrowserWrapperFluentApi browser, string id, bool shouldBeEnabled, ref int currentPresses)
        {
            browser.First($"#{id}").Click();
            if (shouldBeEnabled)
            {
                currentPresses++;
            }

            browser.First("#linkbuttons-pressed").CheckIfInnerTextEquals(currentPresses.ToString());
        }
Ejemplo n.º 3
0
        public static void CheckArticleCount(IBrowserWrapperFluentApi browser, string repeaterUiId, int expectedCount)
        {
            var articles = browser.First($"div[data-ui='{repeaterUiId}']").FindElements("article[data-ui='test-article']");

            if (articles.Count != expectedCount)
            {
                throw new UnexpectedElementStateException($"There should be only 2 article in the repeater. There are {articles.Count}");
            }
        }
Ejemplo n.º 4
0
        private void ReturnedFileDownload(IBrowserWrapperFluentApi browser, string fileContent)
        {
            browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_ReturnedFile_ReturnedFileSample);
            var jsexec = browser.GetJavaScriptExecutor();

            jsexec.ExecuteScript("var downloadURL = \"\";");
            jsexec.ExecuteScript("DotVVM.prototype.performRedirect = function(url){downloadURL = url};");

            browser.First("textarea").SendKeys(fileContent);
            browser.First("input").SendKeys(Keys.Enter);
            var downloadURL = (string)jsexec.ExecuteScript("return downloadURL");

            Assert.IsNotNull(downloadURL);

            string returnedFile;

            using (var client = new WebClient())
            {
                returnedFile = client.DownloadString(browser.GetAbsoluteUrl(downloadURL));
            }
            Assert.AreEqual(fileContent, returnedFile);
        }
Ejemplo n.º 5
0
        private void ShowHideControl(IBrowserWrapperFluentApi browser)
        {
            // verify the second pager is hidden
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsNotDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(2);
            // verify the second pager appears
            browser.Single("populate-button", this.SelectByDataUi).Click();

            // verify the second pager appears
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(3);

            // switch to another page
            browser.First(".pagination").ElementAt("li a", 4).Click();

            // verify the second pager is still visible
            browser.First(".pagination").CheckIfIsDisplayed();
            browser.ElementAt(".pagination", 1).CheckIfIsDisplayed();
            browser.First("ul").FindElements("li").ThrowIfDifferentCountThan(3);
        }