Exemplo n.º 1
0
 public void SElementShouldBeEnabled()
 {
     Given.OpenedPageWithBody("<input type='text' disabled/>");
     Selene.S("input").ShouldNot(Be.Enabled);
     When.WithBody("<input type='text'/>");
     Selene.S("input").Should(Be.Enabled);
 }
        public void InnerSCollectionSearchIsUpdatedOnNextActualActionLikeQuestioiningCount()
        {
            Given.OpenedEmptyPage();
            var elements = S("div").SS(".will-appear");

            When.WithBody(@"
                <div>
                    <ul>Hello to:
                        <li class='will-appear'>Bob</li>
                        <li class='will-appear'>Kate</li>
                    </ul>
                </div>"
                          );
            Assert.AreEqual(2, elements.Count);
            When.WithBody(@"
                <div>
                    <ul>Hello to:
                        <li class='will-appear'>Bob</li>
                        <li class='will-appear'>Kate</li>
                        <li class='will-appear'>Joe</li>
                    </ul>
                </div>"
                          );
            Assert.AreEqual(3, elements.Count);
        }
Exemplo n.º 3
0
 public void SCollectionShouldBeEmpty()
 {
     Given.OpenedEmptyPage();
     SS("li").Should(Be.Empty);
     When.WithBody("<ul>Hello to:<li>Dear Bob</li><li>Lovely Kate</li></ul>");
     SS("li").ShouldNot(Be.Empty);
 }
Exemplo n.º 4
0
 public void SElementShouldHaveAttribute()
 {
     Given.OpenedPageWithBody("<h1 class='big-title'>Hello Babe!</h1>");
     Selene.S("h1").ShouldNot(Have.Attribute("class", "big title"));
     When.WithBody("<h1 class='big title'>Hello world!</h1>");
     Selene.S("h1").Should(Have.Attribute("class", "big title"));
 }
Exemplo n.º 5
0
 public void SElementShouldBeInDOM()
 {
     Given.OpenedEmptyPage();
     Selene.S("h1").ShouldNot(Be.InDom);
     When.WithBody("<h1 style='display:none'>ku ku</h1>");
     Selene.S("h1").Should(Be.InDom);
 }
        public void InnerSCollectionSearchWaitsNothing()
        {
            Given.OpenedEmptyPage();
            var elements = S("div").SS(".will-appear");

            When.WithBody(@"
                <div>
                    <ul>Hello to:
                        <li class='will-appear'>Bob</li>
                        <li class='will-appear' style='display:none'>Kate</li>
                    </ul>
                </div>"
                          );
            When.WithBodyTimedOut(@"
                <div>
                    <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>
                </div>",
                                  500
                                  );
            Assert.AreEqual(2, elements.Count);
        }
Exemplo n.º 7
0
 public void SElementShouldHaveCssClass()
 {
     Given.OpenedPageWithBody("<h1 class='big-title'>Hello Babe!</h1>");
     S("h1").ShouldNot(Have.CssClass("title"));
     When.WithBody("<h1 class='big title'>Hello world!</h1>");
     S("h1").Should(Have.CssClass("title"));
 }
Exemplo n.º 8
0
 public void SElementShouldBeVisible()
 {
     Given.OpenedPageWithBody("<h1 style='display:none'>ku ku</h1>");
     S("h1").ShouldNot(Be.Visible);
     When.WithBody("<h1 style='display:block'>ku ku</h1>");
     S("h1").Should(Be.Visible);
 }
Exemplo n.º 9
0
 public void SElementShouldHaveValue()
 {
     Given.OpenedEmptyPage();
     Selene.S("input").ShouldNot(Have.Value("Yo"));
     When.WithBody("<input value='Yo'></input>");
     Selene.S("input").ShouldNot(Have.Value("o_O"));
     Selene.S("input").Should(Have.Value("Yo"));
 }
Exemplo n.º 10
0
        public void SElementSearchIsPostponedUntilActualActionLikeQuestioiningDisplayed()
        {
            Given.OpenedEmptyPage();
            var element = S("#will-be-existing-element-id");

            When.WithBody(@"<h1 id='will-be-existing-element-id'>Hello kitty:*</h1>");
            Assert.IsTrue(element.Displayed);
        }
Exemplo n.º 11
0
 public void SCollectionShouldHaveCountAtLeastAndCount()
 {
     Given.OpenedEmptyPage();
     SS("li").ShouldNot(Have.Count(2));
     When.WithBody("<ul>Hello to:<li>Dear Bob</li><li>Lovely Kate</li></ul>");
     SS("li").ShouldNot(Have.CountAtLeast(3));
     SS("li").Should(Have.Count(2));
     SS("li").Should(Have.CountAtLeast(1));
 }
Exemplo n.º 12
0
 public void SElementShouldBeBlank()
 {
     Given.OpenedEmptyPage();
     Selene.S("input").ShouldNot(Be.Blank);             // TODO: sounds crazy, no? :)
     When.WithBody("<input type='text' value='Yo'/>");
     Selene.S("input").ShouldNot(Be.Blank);
     When.WithBody("<input type='text'/>");
     Selene.S("input").Should(Be.Blank);
 }
Exemplo n.º 13
0
        public void SElementSearchIsUpdatedOnNextActualActionLikeQuestioiningDisplayed()
        {
            Given.OpenedEmptyPage();
            var element = S("#will-be-existing-element-id");

            When.WithBody(@"<h1 id='will-be-existing-element-id'>Hello kitty:*</h1>");
            Assert.IsTrue(element.Displayed);
            When.WithBody(@"<h1 id='will-be-existing-element-id' style='display:none'>Hello kitty:*</h1>");
            Assert.IsFalse(element.Displayed);
        }
        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);
        }
Exemplo n.º 15
0
        public void InnerSElementSearchIsPostponedUntilActualActionLikeQuestioiningValue()
        {
            Given.OpenedPageWithBody("<p id='existing'>Hello!</p>");
            var element = S("#existing").Find("#will-exist");

            When.WithBody(@"
                <p id='existing'>Hello! 
                    <input id='will-exist' type='submit' value='How r u?'></input>
                </p>"
                          );
            Assert.AreEqual("How r u?", element.Value);
        }
Exemplo n.º 16
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 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);
        }
        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);
        }
Exemplo n.º 19
0
        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 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 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 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);
        }
Exemplo n.º 23
0
 public static void OpenedPageWithBody(string html)
 {
     Given.OpenedEmptyPage();
     When.WithBody(html);
 }
Exemplo n.º 24
0
 public static void OpenedPageWithBody(string pageBody)
 {
     Given.OpenedEmptyPage();
     When.WithBody(pageBody);
 }
Exemplo n.º 25
0
 public static void OpenedPageWithBody(string pageBody, IWebDriver driver)
 {
     Given.OpenedEmptyPage(driver);
     When.WithBody(pageBody, driver);
 }