コード例 #1
0
            /// <summary>
            /// Look in the active Alert/Prompt for the specified text. If the text does not match the prompt will be cleanly exited to allow clean failure or continuation of the test.
            /// </summary>
            /// <param name="accessor"></param>
            public AssertSyntaxProvider In(Alert accessor)
            {
                if (accessor != Alert.Message)
                    throw new FluentException("FluentAutomation only supports checking the message in an alerts or prompts.");

                if (this.matchFunc == null)
                {
                    if (this.notMode)
                        this.assertProvider.AlertNotText(this.text);
                    else
                        this.assertProvider.AlertText(this.text);
                }
                else
                {
                    if (this.notMode)
                        this.assertProvider.AlertNotText(this.matchFunc);
                    else
                        this.assertProvider.AlertText(this.matchFunc);
                }

                return this.assertSyntaxProvider;
            }
コード例 #2
0
            /// <summary>
            /// Look in the active Alert/Prompt for the specified value.
            /// </summary>
            /// <param name="accessor"></param>
            public AssertSyntaxProvider In(Alert accessor)
            {
                if (accessor != Alert.Message)
                {
                    this.commandProvider.AlertClick(Alert.Cancel);
                    throw new FluentException("FluentAutomation only supports checking the message in an alerts or prompts.");
                }

                if (this.matchFunc == null)
                {
                    if (this.notMode)
                        this.assertProvider.AlertNotText(this.value.ToString());
                    else
                        this.assertProvider.AlertText(this.value.ToString());
                }
                else
                {
                    if (this.notMode)
                        this.assertProvider.AlertNotText(this.matchFunc);
                    else
                        this.assertProvider.AlertText(this.matchFunc);
                }

                return this.assertSyntaxProvider;
            }
コード例 #3
0
            /// <summary>
            /// Enter text into the active prompt
            /// </summary>
            /// <param name="accessor"></param>
            public IActionSyntaxProvider In(Alert accessor)
            {
                if (accessor.Field != AlertField.Input)
                {
                    this.syntaxProvider.commandProvider.AlertClick(Alert.Cancel);
                    throw new FluentException("FluentAutomation only supports entering text in text input of a prompt.");
                }

                this.syntaxProvider.commandProvider.AlertEnterText(text);
                return this.syntaxProvider;
            }
コード例 #4
0
        public IActionSyntaxProvider Click(Alert alertAccessor)
        {
            if (alertAccessor.Field != AlertField.OKButton && alertAccessor.Field != AlertField.CancelButton)
            {
                this.Click(Alert.Cancel);
                throw new FluentException("FluentAutomation only supports clicking the OK or Cancel buttons of an alert/prompt.");
            }

            this.commandProvider.AlertClick(alertAccessor);
            return this;
        }
コード例 #5
0
 public void AlertClick(Alert accessor)
 {
     this.RepackExceptions(() => Parallel.ForEach(this.commandProviders, x => x.AlertClick(accessor)));
 }
コード例 #6
0
        public void AlertClick(Alert accessor)
        {
            this.SetActiveAlert();
            if (ActiveAlert == null)
                return;

            try
            {
                this.Act(CommandType.Action, () =>
                {
                    try
                    {
                        if (accessor == Alert.OK)
                            ActiveAlert.Accept();
                        else
                            ActiveAlert.Dismiss();
                    }
                    catch (NoAlertPresentException ex)
                    {
                        throw new FluentException(ex.Message, ex);
                    }
                });
            }
            finally
            {
                ActiveAlert = null;
            }
        }
コード例 #7
0
        public void AlertClick(Alert accessor)
        {
            if (accessor.Field == AlertField.OKButton)
            {
                this.AlertHandler.WaitUntilExists((int)this.Settings.WaitTimeout.TotalSeconds);
                this.AlertHandler.OKButton.Click();
            }
            else if (accessor.Field == AlertField.CancelButton)
            {
                this.ConfirmHandler.WaitUntilExists((int)this.Settings.WaitTimeout.TotalSeconds);
                this.ConfirmHandler.CancelButton.Click();
            }
            else
            {
                // attempt to close any dialogs to allow other tests to continue
                try
                {
                    this.AlertHandler.OKButton.Click();
                }
                catch (Exception) { }

                try
                {
                    this.ConfirmHandler.OKButton.Click();
                }
                catch (Exception) { }

                throw new FluentException("FluentAutomation only supports clicking on OK or Cancel in alerts or prompts.");
            }
        }