public void ShowHideCheckbox()
        {
            App.GoTo(HarnessActions.ShowHideCheckbox());
            App.VerifyCanSeeText("Show/Hide for checkbox");

            App.FindElement("Verify hidden part is hidden", By.Id("hidden-part"), e => e.Displayed.Should().BeFalse());
            App.FindElement("Verify shown part is shown", By.Id("shown-part"), e => e.Displayed.Should().BeTrue());

            App.FindElement("Verify hidden part 2 is shown", By.Id("hidden-part2"), e => e.Displayed.Should().BeTrue());
            App.FindElement("Verify shown part 2 is hidden", By.Id("shown-part2"), e => e.Displayed.Should().BeFalse());

            var form = App.FormForModel <HarnessModel>();

            form.Check(m => m.CheckBox1, true);

            App.FindElement("Verify hidden part is now shown", By.Id("hidden-part"), e => e.Displayed.Should().BeTrue());
            App.FindElement("Verify shown part is now hidden", By.Id("shown-part"), e => e.Displayed.Should().BeFalse());

            App.FindElement("Verify hidden part 2 is still shown", By.Id("hidden-part2"), e => e.Displayed.Should().BeTrue());
            App.FindElement("Verify shown part 2 is still hidden", By.Id("shown-part2"), e => e.Displayed.Should().BeFalse());

            App.Submit();

            App.FindElement("Verify hidden part is still shown", By.Id("hidden-part"), e => e.Displayed.Should().BeTrue());
            App.FindElement("Verify shown part is still hidden", By.Id("shown-part"), e => e.Displayed.Should().BeFalse());

            App.FindElement("Verify hidden part 2 is still shown", By.Id("hidden-part2"), e => e.Displayed.Should().BeTrue());
            App.FindElement("Verify shown part 2 is still hidden", By.Id("shown-part2"), e => e.Displayed.Should().BeFalse());
        }
Ejemplo n.º 2
0
        public void ShowHideCheckbox()
        {
            WebAppTest(client =>
            {
                var response = client.Get(HarnessActions.ShowHideCheckbox());
                var form     = response.Form <HarnessModel>(1);

                form.WhenCheckedShows(m => m.CheckBox1, "hidden-part");
                form.WhenUncheckedShows(m => m.CheckBox1, "shown-part");

                form.WhenCheckedShows(m => m.CheckBox2, "hidden-part2");
                form.WhenUncheckedShows(m => m.CheckBox2, "shown-part2");
            });
        }