/// <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); }
/// <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 WidgetSetTextAssertSync(this WisejWebDriver driver, string path, string text, string widgetType, long timeoutInSeconds = 5) { IHaveValue valueWidget = driver.WidgetRefresh(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); WidgetAssertTextIsCore(widget, text); }