Ejemplo n.º 1
0
        public void ScreenshotOnFailedAssert()
        {
            TextPage.Go();

            var c = Config.Settings.ScreenshotOnFailedAssert;

            Config.ScreenshotOnFailedAssert(true);
            try
            {
                var lastFile = MostRecentTempFile()?.Name ?? "xx.xx";

                Assert.Throws <FluentException>(() => I.Assert.True(() => false));

                var newFile = MostRecentTempFile();

                I.Assert
                .True(() => newFile != null)
                .True(() => newFile.Name != lastFile)
                .True(() => newFile.Exists)
                .True(() => newFile.Length > 0);

                newFile.Delete();
            }
            finally
            {
                Config.ScreenshotOnFailedAssert(c);
            }
        }
Ejemplo n.º 2
0
        public void HoverLink()
        {
            TextPage.Go();

            I.Assert.Css("color", Colors.RED).Not.On(TextPage.Link1Selector);
            I.Hover(TextPage.Link1Selector)
            .Assert.Css("color", Colors.RED).On(TextPage.Link1Selector);
        }
Ejemplo n.º 3
0
        public void HoverBlockElement()
        {
            TextPage.Go();

            I.Assert.Css("color", Colors.RED).Not.On(TextPage.TitleSelector);
            I.Hover(TextPage.TitleSelector);
            I.Assert.Css("color", Colors.RED).On(TextPage.TitleSelector);
        }
Ejemplo n.º 4
0
 public void FocusBlockElement()
 {
     TextPage.Go();
     I.Assert.Css("color", Colors.ALICE_BLUE).Not.On(TextPage.TitleSelector);
     // This shouldn't actually do anything. Focusing a block element makes no sense.
     I.Focus(TextPage.TitleSelector)
     .Assert.Css("color", Colors.ALICE_BLUE).Not.On(TextPage.TitleSelector);
 }
        public TakeScreenshotTests()
            : base()
        {
            tempPath = Path.GetTempPath();
            Config.ScreenshotPath(tempPath);

            TextPage.Go();
        }
Ejemplo n.º 6
0
        public void FocusLink()
        {
            TextPage.Go();

            I.Assert.Css("color", InputsPage.FocusColor).Not.On(TextPage.Link1Selector);
            I.Focus(TextPage.Link1Selector)
            .Assert.Css("color", InputsPage.FocusColor).On(TextPage.Link1Selector);
        }
Ejemplo n.º 7
0
        public void HoverLink()
        {
            TextPage.Go();

            I.Assert.Css("color", InputsPage.HoverColor).Not.On(TextPage.Link1Selector);
            I.Hover(TextPage.Link1Selector)
            .Wait(3)
            .Assert.Css("color", InputsPage.HoverColor).On(TextPage.Link1Selector);
        }
Ejemplo n.º 8
0
 public void FocusLink()
 {
     TextPage.Go();
     I.Assert.Css("text-decoration", TextPage.LinkTextDecorationHover).Not.On(TextPage.Link1Selector);
     I.Assert.Css("text-decoration", TextPage.LinkTextDecorationHover).Not.On(TextPage.Link1Selector);
     I.Focus(TextPage.Link1Selector);
     I.Assert.Css("text-decoration", TextPage.LinkTextDecorationHover).On(TextPage.Link1Selector);
     I.Focus(TextPage.Link2Selector);
     I.Assert.Css("text-decoration", TextPage.LinkTextDecorationHover).On(TextPage.Link2Selector);
 }
Ejemplo n.º 9
0
        public void TakeScreenshot()
        {
            TextPage.Go();

            var screenshotName = string.Format(CultureInfo.CurrentCulture, "TakeScreenshot_{0}", DateTimeOffset.Now.Date.ToFileTime());
            var filepath       = this.tempPath + screenshotName + ".png";

            I.Assert.False(() => File.Exists(filepath));
            try
            {
                I.TakeScreenshot(screenshotName)
                .Assert
                .True(() => File.Exists(filepath))
                .True(() => new FileInfo(filepath).Length > 0);
            }
            finally
            {
                File.Delete(filepath);
            }
        }