public void ValueInAlerts()
        {
            AlertsPage.Go();

            I.Click(AlertsPage.TriggerAlertSelector)
            .Assert
            .Value("Alert box").In(Alert.Message)
            .Value("Prompt box").Not.In(Alert.Message);

            I.Expect
            .Value("Alert box").In(Alert.Message)
            .Value("Prompt box").Not.In(Alert.Message);

            Assert.Throws <FluentAssertFailedException>(() => I.Assert.Value("Alert box").Not.In(Alert.Message)); // always returns immediately, so not wrapped in FluentException
            Assert.Throws <FluentException>(() => I.Assert.Value("Alert box1").In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Alert box").Not.In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Alert box1").In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Wat").In(Alert.Input));

            Assert.Throws <FluentException>(() => I.Assert.Value("Alert box").Not.In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Assert.Value("Alert box1").In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Alert box").Not.In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Alert box1").In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value("Wat").In(Alert.Input));

            Assert.Throws <FluentException>(() => I.Expect.Value(x => x.StartsWith("Alert box")).In(Alert.Message));
            Assert.Throws <FluentException>(() => I.Expect.Value(x => x.StartsWith("Prompt box")).Not.In(Alert.Message));
        }
Example #2
0
        public void EnterTextInAlertConfirmPrompt()
        {
            AlertsPage.Go();

            I.Click(AlertsPage.TriggerPromptSelector)
            .Enter("Wat").In(Alert.Input)
            .Assert.Text("Clicked Prompt OK: Wat").In(AlertsPage.ResultSelector);

            // Can't enter text into a message, verify exception is thrown properly
            Assert.Throws <FluentException>(() => I.Enter("Wat2").In(Alert.Message));
        }
Example #3
0
        public void AlertClicks()
        {
            AlertsPage.Go();

            // No alerts present
            Assert.Throws <FluentException>(() => I.Click(Alert.OK));

            // Can't 'click' these fields
            Assert.Throws <FluentException>(() => I.Click(Alert.Input));
            Assert.Throws <FluentException>(() => I.Click(Alert.Message));

            // Alert box:
            // Alerts don't have OK/Cancel but both work, so we test as if Cancel was clicked
            I.Click(AlertsPage.TriggerAlertSelector)
            .Click(Alert.OK)
            .Assert.Text("Clicked Alert Cancel").In(AlertsPage.ResultSelector);

            I.Click(AlertsPage.TriggerAlertSelector)
            .Click(Alert.Cancel)
            .Assert.Text("Clicked Alert Cancel").In(AlertsPage.ResultSelector);

            // Confirmation box:
            I.Click(AlertsPage.TriggerConfirmSelector)
            .Click(Alert.OK)
            .Assert.Text("Clicked Confirm OK").In(AlertsPage.ResultSelector);

            I.Click(AlertsPage.TriggerConfirmSelector)
            .Click(Alert.Cancel)
            .Assert.Text("Clicked Confirm Cancel").In(AlertsPage.ResultSelector);

            // Prompt box:
            I.Click(AlertsPage.TriggerPromptSelector)
            .Enter("1").In(Alert.Input)
            .Assert.Text("Clicked Prompt OK: 1").In(AlertsPage.ResultSelector);

            I.Click(AlertsPage.TriggerPromptSelector)
            .Click(Alert.Cancel)
            .Assert.Text("Clicked Prompt Cancel").In(AlertsPage.ResultSelector);
        }
Example #4
0
 public CheckTextTests() : base()
 {
     AlertsPage.Go();
 }
Example #5
0
 public CheckExistenceTests() : base()
 {
     AlertsPage.Go();
 }
Example #6
0
 public CheckVisibilityTests() : base()
 {
     AlertsPage.Go();
 }