예제 #1
0
        public void IWaitForjQueryAjaxCallsToCompleteStep_WhenCanGetUrlReturnsFalse_DoesNotTryToGetUrl()
        {
            var browser = new Mock <IBrowser>(MockBehavior.Strict);

            browser.Setup(s => s.IsClosed).Returns(false);
            browser.Setup(s => s.IsDisposed).Returns(false);
            browser.Setup(s => s.CanGetUrl()).Returns(false);
            WebDriverSupport.Browser = browser.Object;

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);
            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);
            var steps           = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForjQuery();

            browser.VerifyAll();
        }
예제 #2
0
        public void TestIWaitForjQueryAjaxCallsToCompleteStepWithNothingPending()
        {
            var browser = new Mock <IBrowser>(MockBehavior.Strict);

            browser.Setup(s => s.IsClosed).Returns(false);
            browser.Setup(s => s.IsDisposed).Returns(false);
            browser.Setup(s => s.Url).Returns("http://www.specbind.org");
            browser.Setup(s => s.ExecuteScript(It.IsAny <string>())).Returns("0");
            WebDriverSupport.Browser = browser.Object;

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);
            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);
            var steps           = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForjQuery();

            browser.VerifyAll();
        }
예제 #3
0
        public void TestGivenIWaitForViewToBeActiveStep()
        {
            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);

            var testPage = new Mock <IPage>(MockBehavior.Strict);

            testPage.Setup(t => t.WaitForPageToBeActive());

            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            scenarioContext.Setup(s => s.GetValue <IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForTheViewToBeActive();

            testPage.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #4
0
        public void IWaitForAngularAjaxCallsToCompleteStep_WhenCanGetUrlReturnsTrue_GetsUrl()
        {
            var browser = new Mock <IBrowser>(MockBehavior.Strict);

            browser.Setup(s => s.IsClosed).Returns(false);
            browser.Setup(s => s.IsDisposed).Returns(false);
            browser.Setup(s => s.CanGetUrl()).Returns(true);
            browser.Setup(s => s.Url).Returns("http://www.specbind.org");
            browser.Setup(s => s.ExecuteScript(It.IsAny <string>())).Returns("0");
            WebDriverSupport.Browser = browser.Object;

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);
            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);
            var steps           = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForAngular();

            browser.VerifyAll();
        }
예제 #5
0
        public void TestWaitForControlExistsStepInvalidTimeout()
        {
            var testPage = new Mock<IPage>();

            var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict);
            pipelineService.Setup(p => p.PerformAction<WaitForElementAction>(
                testPage.Object,
                It.Is<WaitForElementAction.WaitForElementContext>(c => c.PropertyName == "myfield" && c.Condition == WaitConditions.Exists && c.Timeout == null)))
                .Returns(ActionResult.Successful());

            var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
            scenarioContext.Setup(s => s.GetValue<IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitToSeeElementWithTimeout(0, "My Field");

            pipelineService.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #6
0
        public void TestWaitForControlExistsNoTimeoutStep()
        {
            var testPage = new Mock <IPage>();

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);

            pipelineService.Setup(p => p.PerformAction <WaitForElementAction>(
                                      testPage.Object,
                                      It.Is <WaitForElementAction.WaitForElementContext>(c => c.PropertyName == "myfield" && c.Condition == WaitConditions.Exists && c.Timeout == null)))
            .Returns(ActionResult.Successful());

            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            scenarioContext.Setup(s => s.GetValue <IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitToSeeElement("My Field");

            pipelineService.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #7
0
        public void TestWaitForListItemsWithTimeoutStep()
        {
            var testPage = new Mock <IPage>();

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);

            pipelineService.Setup(p => p.PerformAction <WaitForListItemsAction>(
                                      testPage.Object,
                                      It.Is <WaitForListItemsAction.WaitForListItemsContext>(c => c.PropertyName == "myfield" && c.Timeout == TimeSpan.FromSeconds(3))))
            .Returns(ActionResult.Successful());

            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            scenarioContext.Setup(s => s.GetValue <IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForListElementToContainItemsWithTimeout(3, "My Field");

            pipelineService.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #8
0
        public void TestWaitForControlNotMovingStep()
        {
            var testPage = new Mock <IPage>();

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);

            pipelineService.Setup(p => p.PerformAction <WaitForElementAction>(
                                      testPage.Object,
                                      It.Is <WaitForElementAction.WaitForElementContext>(c => c.PropertyName == "myfield" && c.Condition == WaitConditions.NotMoving && c.Timeout == Timeout)))
            .Returns(ActionResult.Successful());

            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            scenarioContext.Setup(s => s.GetCurrentPage()).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForElementNotMovingWithTimeout(10, "My Field");

            pipelineService.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #9
0
        public void TestGivenIWaitForViewToBeActiveStep()
        {
            var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict);

            var testPage = new Mock<IPage>(MockBehavior.Strict);
            testPage.Setup(t => t.WaitForPageToBeActive());

            var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
            scenarioContext.Setup(s => s.GetValue<IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForTheViewToBeActive();

            testPage.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #10
0
        public void TestWaitForListItemsWithTimeoutStep()
        {
            var testPage = new Mock<IPage>();

            var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict);
            pipelineService.Setup(p => p.PerformAction<WaitForListItemsAction>(
                testPage.Object,
                It.Is<WaitForListItemsAction.WaitForListItemsContext>(c => c.PropertyName == "myfield" && c.Timeout == TimeSpan.FromSeconds(3))))
                .Returns(ActionResult.Successful());

            var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
            scenarioContext.Setup(s => s.GetValue<IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

            steps.WaitForListElementToContainItemsWithTimeout(3, "My Field");

            pipelineService.VerifyAll();
            scenarioContext.VerifyAll();
        }
예제 #11
0
		public void TestIWaitForjQueryAjaxCallsToCompleteStepWithSomethingPending()
		{
			var browser = new Mock<IBrowser>(MockBehavior.Strict);
			browser.Setup(s => s.IsClosed).Returns(false);
			browser.Setup(s => s.IsDisposed).Returns(false);
			browser.Setup(s => s.Url).Returns("http://www.specbind.org");
			browser.SetupSequence(s => s.ExecuteScript(It.IsAny<string>()))
				.Returns("1")
				.Returns("0");
			WebDriverSupport.Browser = browser.Object;

			var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict);
			var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			var steps = new WaitingSteps(pipelineService.Object, scenarioContext.Object);

			steps.WaitForjQuery();

			browser.VerifyAll();
		}