示例#1
0
        public void UIComponent_IsPresent()
        {
            var page = Go.To <ContentPage>();

            using (StopwatchAsserter.Within(0))
                page.VisibleDiv.IsPresent.Value.Should().BeTrue();

            using (StopwatchAsserter.Within(0))
                page.VisibleDiv.IsPresent.Should.BeTrue();

            using (StopwatchAsserter.Within(0))
                page.VisibleDiv.Should.Exist();

            using (StopwatchAsserter.Within(0))
                page.HiddenDiv.IsPresent.Value.Should().BeTrue();

            using (StopwatchAsserter.Within(0))
                page.HiddenDiv.IsPresent.Should.BeTrue();

            using (StopwatchAsserter.Within(0))
                page.HiddenDiv.Should.Exist();

            using (StopwatchAsserter.Within(0))
                page.HiddenDivWithVisibleVisibility.IsPresent.Value.Should().BeFalse();

            using (StopwatchAsserter.Within(0))
                page.HiddenDivWithVisibleVisibility.IsPresent.Should.BeFalse();

            using (StopwatchAsserter.Within(0))
                page.HiddenDivWithVisibleVisibility.Should.Not.Exist();
        }
示例#2
0
        public void UIComponent_IsVisible()
        {
            var page = Go.To <ContentPage>();

            using (StopwatchAsserter.WithinSeconds(0))
                page.VisibleDiv.IsVisible.Value.Should().BeTrue();

            using (StopwatchAsserter.WithinSeconds(0))
                page.VisibleDiv.IsVisible.Should.BeTrue();

            using (StopwatchAsserter.WithinSeconds(0))
                page.VisibleDiv.Should.BeVisible();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDiv.IsVisible.Value.Should().BeFalse();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDiv.IsVisible.Should.BeFalse();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDiv.Should.BeHidden();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDivWithVisibleVisibility.IsVisible.Value.Should().BeFalse();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDivWithVisibleVisibility.IsVisible.Should.BeFalse();

            using (StopwatchAsserter.WithinSeconds(0))
                page.HiddenDivWithVisibleVisibility.Should.BeHidden();
        }
示例#3
0
        public void WaitForElement_HiddenAndVisible()
        {
            using (StopwatchAsserter.Within(2))
                page.ButtonWithHiddenAndVisibleWait.Click();

            page.Result.Should.AtOnce.Exist();
        }
示例#4
0
        public void WaitForElement_VisibleAndMissing()
        {
            using (StopwatchAsserter.Within(2))
                page.ButtonWithVisibleAndMissingWait.Click();

            page.Result.Should.AtOnce.Exist();
        }
示例#5
0
        public void Trigger_WaitForElement_VisibleAndMissing_NonExistent()
        {
            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(1))
                Assert.Throws <NoSuchElementException>(
                    () => page.ButtonWithVisibleAndMissingNonExistentWait.Click());
        }
示例#6
0
        public void Trigger_WaitForScript_Timeout()
        {
            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.Within(1))
                Assert.Throws <TimeoutException>(
                    () => page.ButtonWithTimeoutScriptWait());
        }
示例#7
0
        public void Trigger_WaitForElement_VisibleThenMissing()
        {
            WaitingPage page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(2))
                page.ButtonWithVisibleAndMissingWait.Click();

            page.Result.Should.AtOnce.Exist();
        }
        public void Trigger_WaitForElement_HiddenThenVisible()
        {
            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.Within(2))
                page.ButtonWithHiddenAndVisibleWait.Click();

            page.Result.Should.AtOnce.Exist();
        }
示例#9
0
        public void PageObject_RefreshPageUntil_Timeout()
        {
            var page = Go.To <WaitingPage>().
                       CurrentTime.Get(out TimeSpan? time);

            using (StopwatchAsserter.Within(1, 1))
                Assert.Throws <TimeoutException>(() =>
                                                 page.RefreshPageUntil(x => x.CurrentTime.Value > time.Value.Add(TimeSpan.FromSeconds(15)), timeout: 1));
        }
示例#10
0
        public void Find_Timeout(double timeout)
        {
            var control = _page.MissingOptionById;

            control.Metadata.Get <FindAttribute>().Timeout = timeout;

            using (StopwatchAsserter.WithinSeconds(timeout))
                Assert.Throws <NoSuchElementException>(() =>
                                                       control.Click());
        }
示例#11
0
        public void DefaultTimeout_BaseRetryTimeout_ElementFind()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(2)).
            Build();

            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(2))
                page.MissingControl.GetScope();
        }
示例#12
0
        public void Trigger_WaitForElement_HiddenThenVisible()
        {
            var page    = Go.To <WaitingPage>();
            var control = page.ButtonWithHiddenAndVisibleWait;

            control.WaitTo().BeVisible();

            using (StopwatchAsserter.WithinSeconds(2))
                control.Click();

            page.Result.Should.AtOnce.Exist();
        }
示例#13
0
        public void DefaultTimeout_BaseRetryTimeout_Verification()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(2)).
            Build();

            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(2))
                Assert.Throws <AssertionException>(() =>
                                                   page.MissingControl.Should.BeEnabled());
        }
示例#14
0
        public void DefaultTimeout_VerificationTimeout_CheckDataProperty()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(1)).
            UseVerificationTimeout(TimeSpan.FromSeconds(3)).
            Build();

            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.Within(3))
                Assert.Throws <AssertionException>(() =>
                                                   page.MissingControl.IsEnabled.Should.BeTrue());
        }
示例#15
0
        public void DefaultTimeout_VerificationTimeout_DoesExist()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(1)).
            UseVerificationTimeout(TimeSpan.FromSeconds(3)).
            Build();

            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(3))
                AssertThrowsWithInnerException <AssertionException, NoSuchElementException>(() =>
                                                                                            page.MissingControl.Should.Exist());
        }
示例#16
0
        public void DefaultTimeout_BaseRetryTimeout_Waiting()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(2)).
            Build();

            var page = Go.To <WaitingPage>();

            using (StopwatchAsserter.WithinSeconds(2))
                page.MissingControl.Wait(Until.Visible, new WaitOptions {
                    ThrowOnPresenceFailure = false
                });
        }
示例#17
0
        public void ControlList_Empty()
        {
            var component = Go.To <TablePage>().EmptyTable.Rows;

            using (StopwatchAsserter.WithinSeconds(0))
                component.Should.BeEmpty();

            using (StopwatchAsserter.WithinSeconds(0))
                component.Count.Should.Equal(0);

            using (StopwatchAsserter.WithinSeconds(0))
                component.Should.HaveCount(0);

            using (StopwatchAsserter.WithinSeconds(0))
                component.AsEnumerable().Should().BeEmpty();
        }
示例#18
0
        public void UIComponent_IsPresent_Should_Fail()
        {
            var page = Go.To <ContentPage>();

            using (StopwatchAsserter.Within(2))
                Assert.Throws <AssertionException>(() =>
                                                   page.VisibleDiv.IsPresent.Should.Within(2).BeFalse());

            using (StopwatchAsserter.Within(2))
                Assert.Throws <AssertionException>(() =>
                                                   page.HiddenDiv.IsPresent.Should.Within(2).BeFalse());

            using (StopwatchAsserter.Within(2))
                Assert.Throws <AssertionException>(() =>
                                                   page.HiddenDivWithVisibleVisibility.IsPresent.Should.Within(2).BeTrue());
        }
示例#19
0
 public void WaitForElement_VisibleAndMissing_NonExistent()
 {
     using (StopwatchAsserter.Within(1))
         Assert.Throws <NoSuchElementException>(
             () => page.ButtonWithVisibleAndMissingNonExistentWait.Click());
 }