Пример #1
0
        public void Given_verification_on_IClickable_and_take_screenshot_is_false_When_verification_succeeds_Then_screenshot_is_not_taken()
        {
            var driver            = Substitute.For <IWebDriver>();
            var driverEnvironment = Substitute.For <IDriverEnvironment>();
            var settings          = Substitute.For <ISettings>();
            var session           = Substitute.For <Session>(driverEnvironment);

            driverEnvironment.CreateWebDriver().Returns(driver);

            settings.CaptureScreenOnVerificationFailure.Returns(false);

            session.Settings.Returns(settings);

            var clickable = new TestClickable
            {
                Session = session,
                Text    = "The right text"
            };

            clickable.Verify(x => x.Text == "The right text");

            session.DidNotReceiveWithAnyArgs().CaptureScreen();

            session.End();
        }
Пример #2
0
        public void Given_verification_on_IClickable_and_take_screenshot_is_false_When_verification_fails_Then_screenshot_is_not_taken()
        {
            var driver            = Substitute.For <IWebDriver>();
            var driverEnvironment = Substitute.For <IDriverEnvironment>();
            var settings          = Substitute.For <ISettings>();
            var session           = Substitute.For <Session>(driverEnvironment);

            driverEnvironment.CreateWebDriver().Returns(driver);

            settings.CaptureScreenOnVerificationFailure.Returns(false);

            session.Settings.Returns(settings);

            var clickable = new TestClickable
            {
                Session = session,
                Text    = "Not the right text"
            };

            try
            {
                clickable.Verify(x => x.Text == "The right text");
            }
            catch (VerificationException)
            {
            }

            session.DidNotReceive().CaptureScreen(Path.Combine(Environment.CurrentDirectory, String.Format("{0}.png", MethodBase.GetCurrentMethod().GetFullName())));

            session.DidNotReceiveWithAnyArgs().CaptureScreen();

            session.End();
        }