Example #1
0
        /// <summary>
        /// Checks the widget value matches the specified string.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="value">The value to check.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param>
        public static void CheckValueIs(this WisejWebDriver driver, string path, string value,
                                        int timeoutInSeconds = 5)
        {
            IHaveValue iHaveValue = driver.WidgetGet <IHaveValue>(path, timeoutInSeconds);

            CheckValueCore(iHaveValue, path, value);
        }
Example #2
0
        /// <summary>
        /// Clicks a <see cref="Button"/>.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the Button (default is 5).</param>
        public static void ButtonClick(this WisejWebDriver driver, string path, long timeoutInSeconds = 5)
        {
            Button button = driver.WidgetGet <Button>(path, timeoutInSeconds);

            Assert.IsTrue(button.Enabled, string.Format("Button {0} isn't enabled.", path));
            button.Click();
        }
Example #3
0
        /// <summary>
        /// Closes a Form.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="name">The form name.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the Form (default is 5).</param>
        public static void FormClose(this WisejWebDriver driver, string name, long timeoutInSeconds = 5)
        {
            Form form = driver.WidgetGet <Form>(name, timeoutInSeconds);

            form.AssertIsDisplayed(name);
            form.Close();
            form.AssertIsDisposed(name);
        }
Example #4
0
        /// <summary>
        /// Sets the text of the widget with the given path, and waits until it matches.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="text">The text to match.</param>
        /// <param name="widgetType">The widget type name.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param>
        public static void SetTextCheckResult(this WisejWebDriver driver, string path, string text,
                                              string widgetType, int timeoutInSeconds = 5)
        {
            IHaveValue valueWidget = driver.WidgetGet(path, widgetType, timeoutInSeconds) as IHaveValue;

            if (valueWidget == null)
            {
                throw new ArgumentException("Widget does not support Value property", nameof(path));
            }

            valueWidget.Value = text;
            driver.Wait(() =>
            {
                IWidget waitWidget = driver.WidgetRefresh(path, widgetType, timeoutInSeconds);
                return(Equals(text, waitWidget.Text));
            }, false, timeoutInSeconds);

            IWidget widget = driver.WidgetGet(path, widgetType, timeoutInSeconds);

            CheckTextIsCore(widget, text);
        }
Example #5
0
        /// <summary>
        /// Asserts the text of the widget with the given path, matches the specified string.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="text">The text to match.</param>
        /// <param name="widgetType">The widget type name.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param>
        public static void WidgetWaitAssertTextIs(this WisejWebDriver driver, string path, string text,
                                                  string widgetType, long timeoutInSeconds = 5)
        {
            driver.Wait(() =>
            {
                IWidget waitWidget = driver.WidgetRefresh(path, widgetType, timeoutInSeconds);
                return(Equals(text, waitWidget.Text));
            }, false, timeoutInSeconds);

            IWidget widget = driver.WidgetGet(path, widgetType, timeoutInSeconds);

            WidgetAssertTextIsCore(widget, text);
        }
Example #6
0
        /// <summary>
        /// Restores a Form.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="name">The form name.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the Form (default is 5).</param>
        public static void FormRestore(this WisejWebDriver driver, string name, long timeoutInSeconds = 5)
        {
            Form form = driver.WidgetGet <Form>(name, timeoutInSeconds);

            form.Restore();
        }
Example #7
0
        /// <summary>
        /// Gets the widget value.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the widget (default is 5).</param>
        /// <returns>A <see cref="string"/> with the widget value.</returns>
        public static string GetValue(this WisejWebDriver driver, string path, int timeoutInSeconds = 5)
        {
            IHaveValue iHaveValue = driver.WidgetGet <IHaveValue>(path, timeoutInSeconds);

            return(GetValueCore(iHaveValue, path));
        }
Example #8
0
        /// <summary>
        /// Clicks a <see cref="Button"/>, even if not Enabled.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="path">The widget path.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the Button (default is 5).</param>
        public static void ButtonForceClick(this WisejWebDriver driver, string path, int timeoutInSeconds = 5)
        {
            Button button = driver.WidgetGet <Button>(path, timeoutInSeconds);

            button.ForceClick();
        }
Example #9
0
        /// <summary>
        /// Minimizes a Form.
        /// </summary>
        /// <param name="driver">The <see cref="WisejWebDriver"/> to use.</param>
        /// <param name="name">The form name.</param>
        /// <param name="timeoutInSeconds">The number of seconds to wait for the Form (default is 5).</param>
        public static void FormMinimize(this WisejWebDriver driver, string name, int timeoutInSeconds = 5)
        {
            Form form = driver.WidgetGet <Form>(name, timeoutInSeconds);

            form.Minimize();
        }