public void SCollectionSearchIsPostponedUntilActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS(".will-appear");

            When.WithBody(@"
                <ul>Hello to:
                    <li class='will-appear'>Bob</li>
                    <li class='will-appear'>Kate</li>
                </ul>");
            Assert.AreEqual(2, elements.Count);
        }
        public void FilteredSCollectionSearchIsPostponedUntilActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS("li").FilterBy(Be.Visible);

            When.WithBody(@"
                <ul>Hello to:
                    <li class='will-appear' style='display:none'>Bob</li>
                    <li class='will-appear'>Kate</li>
                </ul>"
                          );
            Assert.AreEqual(1, elements.Count);
        }
Beispiel #3
0
        public void IndexedSElementSearchIsPostponedUntilActualActionLikeQuestioiningValue()
        {
            Given.OpenedEmptyPage();
            var element = Selene.SS("#will-exist>input")[1];

            When.WithBody(@"
                <p id='will-exist'>
                    <input id='ask' type='submit' value='How r u?'></input>
                    <input id='answer' type='submit' value='Good!'></input>
                </p>"
                          );
            Assert.AreEqual("Good!", element.Value);
        }
        public void FoundByConditionSElementSearchIsPostponedUntilActualActionLikeQuestioiningValue()
        {
            Given.OpenedEmptyPage();
            var element = SS("#will-exist>input").FindBy(Be.Visible);

            When.WithBody(@"
                <p id='will-exist'>
                    <input id='ask' type='submit' value='How r u?' style='display:none'></input>
                    <input id='answer1' type='submit' value='Good!'></input>
                    <input id='answer2' type='submit' value='Great!'></input>
                </p>"
                          );
            Assert.AreEqual("Good!", element.Value);
        }
        public void SCollectionGetCountCountsInvisible()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS(".will-appear");

            When.WithBody(@"
                <p>
                    <ul>Hello to:
                        <li class='will-appear'>Bob</li>
                        <li class='will-appear' style='display:none'>Kate</li>
                    </ul>
                </p>"
                          );
            Assert.AreEqual(2, elements.Count);
        }
        public void InnerSCollectionSearchIsPostponedUntilActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = S("div").SS("li");

            When.WithBody(@"
                <div>
                    <ul>Hello to:
                        <li class='will-appear'>Bob</li>
                        <li class='will-appear'>Kate</li>
                    </ul>
                </div>"
                          ); //TODO: consider simplifying example via removing div and using ul instead
            Assert.AreEqual(2, elements.Count);
        }
        public void InnerSElementSearchIsUpdatedOnNextActualActionLikeQuestioiningValue()
        {
            Given.OpenedEmptyPage();
            var element = SS("#will-exist>input").FindBy(Be.Visible);

            When.WithBody(@"
                <p id='will-exist'>
                    <input id='ask' type='submit' value='How r u?' style='display:none'></input>
                    <input id='answer1' type='submit' value='Good!'></input>
                </p>"
                          );
            Assert.AreEqual("Good!", element.Value);
            Selene.ExecuteScript(@"
                document.getElementById('answer1').value = 'Great!';"
                                 );
            Assert.AreEqual("Great!", element.Value);
        }
        public void FilteredSCollectionSearchIsUpdatedOnNextActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS("li").FilterBy(Be.Visible);

            When.WithBody(@"
                <ul>Hello to:
                    <li class='will-appear' style='display:none'>Miller</li>
                    <li class='will-appear' style='display:none'>Julie Mao</li>
                </ul>"
                          );
            Assert.AreEqual(0, elements.Count);
            Selene.ExecuteScript(@"
                document.getElementsByTagName('li')[0].style = 'display:block';"
                                 );
            Assert.AreEqual(1, elements.Count);
        }
        public void FilteredSCollectionSearchWaitsNothing()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS("li").FilterBy(Be.Visible);

            When.WithBodyTimedOut(@"
                <ul>Hello to:
                    <li class='will-appear' style='display:none'>Miller</li>
                    <li class='will-appear' style='display:none'>Julie Mao</li>
                </ul>"
                                  ,
                                  500
                                  );
            When.ExecuteScriptWithTimeout(@"
                document.getElementsByTagName('a')[1].style = 'display:block';
                ", 1000
                                          );
            Assert.AreEqual(0, elements.Count);
        }
        public void SCollectionSearchWaitsNothing()
        {
            Given.OpenedEmptyPage();
            var elements = Selene.SS(".will-appear");

            When.WithBody(@"
                <ul>Hello to:
                    <li class='will-appear'>Bob</li>
                    <li class='will-appear' style='display:none'>Kate</li>
                </ul>"
                          );
            When.WithBodyTimedOut(@"
                <ul>Hello to:
                    <li class='will-appear'>Bob</li>
                    <li class='will-appear' style='display:none'>Kate</li>
                    <li class='will-appear'>Bobik</li>
                </ul>",
                                  500
                                  );
            Assert.AreEqual(2, elements.Count);
        }
Beispiel #11
0
 public void BothSCollectionAndIndexedSElementSearchWaitsForVisibilityOnActionsLikeClick()
 {// TODO: think on breaking down this test into two, or add one more explicitly testing implicit wait in get
     Given.OpenedEmptyPage();
     When.WithBodyTimedOut(@"
         <a href='#first'>go to Heading 1</a>
         <a href='#second' style='display:none'>go to Heading 2</a>
         <h1 id='first'>Heading 1</h1>
         <h2 id='second'>Heading 2</h2>"
                           ,
                           250
                           );
     Selene.ExecuteScript(@"
        setTimeout(
             function(){
                 document.getElementsByTagName('a')[1].style = 'display:block';
             }, 
             500);"
                          );
     Selene.SS("a")[1].Click();
     Assert.IsTrue(Selene.GetWebDriver().Url.Contains("second"));
 }
 public void BothSCollectionAndFoundByConditionSElementSearchWaitsForVisibilityOnActionsLikeClick()
 {
     Given.OpenedEmptyPage();
     When.WithBodyTimedOut(@"
         <a href='#first' style='display:none'>go to Heading 1</a>
         <a href='#second' style='display:none'>go to Heading 2</a>
         <h1 id='first'>Heading 1</h1>
         <h2 id='second'>Heading 2</h2>"
                           ,
                           250
                           );
     Selene.ExecuteScript(@"
        setTimeout(
             function(){
                 document.getElementsByTagName('a')[1].style = 'display:block';
             }, 
             500);"
                          );
     SS("a").FindBy(Be.Visible).Click();
     Assert.IsTrue(Selene.Url().Contains("second"));
 }
Beispiel #13
0
 public static void OpenedPageWithBody(string pageBody, IWebDriver driver)
 {
     Given.OpenedEmptyPage(driver);
     When.WithBody(pageBody, driver);
 }
Beispiel #14
0
 public static void OpenedPageWithBody(string pageBody)
 {
     Given.OpenedEmptyPage();
     When.WithBody(pageBody);
 }
Beispiel #15
0
 public static void OpenedPageWithBody(string html)
 {
     Given.OpenedEmptyPage();
     When.WithBody(html);
 }