示例#1
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();
        }
示例#2
0
        public void Trigger_WaitForElement_VisibleAndMissing_NonExistent()
        {
            var page = Go.To <WaitingPage>();

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

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

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

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

            using (StopwatchAsserter.WithinSeconds(1))
                Assert.Throws <TimeoutException>(() =>
                                                 page.RefreshPageUntil(x => x.CurrentTime.Value > time.Value.Add(TimeSpan.FromSeconds(15)), timeout: 1));
        }
示例#6
0
        public void Trigger_WaitForElement_HiddenThenVisible()
        {
            var page = Go.To <WaitingPage>();

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

            page.Result.Should.AtOnce.Exist();
        }
示例#7
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());
        }
示例#8
0
        public void DefaultTimeout_BaseRetryTimeout_ElementFind()
        {
            ConfigureBaseAtataContext().
            UseBaseRetryTimeout(TimeSpan.FromSeconds(2)).
            Build();

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

            using (StopwatchAsserter.WithinSeconds(2))
                page.MissingControl.GetScope();
        }
示例#9
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());
        }
示例#10
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());
        }
示例#11
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
                });
        }
示例#12
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();
        }
示例#13
0
        public void UIComponent_IsPresent_Should_Fail()
        {
            var page = Go.To <ContentPage>();

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

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

            using (StopwatchAsserter.WithinSeconds(2))
                Assert.Throws <AssertionException>(() =>
                                                   page.HiddenDivWithVisibleVisibility.IsPresent.Should.Within(2).BeTrue());
        }