Atata 0.17.0 Released

May 31, 2018 by Yevgeniy Shunevych


Atata 0.17.0 has been released with various features and enhancements. Check the changelog.

Changelog

New Features

  • minor #140 Add access chain cache for UI component scope
  • minor #149 Add FrameSetPage<TOwner> base page object class
  • major #153 WaitingTimeout and WaitingRetryInterval
  • major #155 ElementFindTimeout and ElementFindRetryInterval
  • major #156 VerificationTimeout and VerificationRetryInterval
  • major #159 Add ClickAndGo method to Control<TOwner>
  • major #160 Add DoubleClickAndGo method to Control<TOwner>
  • major #161 Add WaitForScriptAttribute base trigger
  • minor #168 Add SetRandom(Action<T> callback) method to EditableField<T, TOwner>
  • minor #169 Add ContainingClasses property to ScopeDefinitionAttribute
  • minor #170 Add OnBuilding and OnBuilt methods to AtataContextBuilder
  • minor #171 Add OnDriverCreated methods to AtataContextBuilder
  • minor #175 Add WithHostName method to DriverAtataContextBuilder`3
  • major #177 Add ActiveControl property to PageObject<TOwner>
  • major #178 Add PerformActions method to PageObject<TOwner>

Changes and Enhancements

  • minor #144 Inherit CultureAttribute from MulticastAttribute
  • minor #145 Inherit FormatAttribute from MulticastAttribute and make FormatSettingsAttribute obsolete
  • minor #146 Add more specific exceptions to AtataMapper
  • minor #148 Add <frame> element support to Frame<TOwner> control in addition to <iframe>
  • minor #151 Set default format for path variables of DateTime type for FileScreenshotConsumer
  • minor #152 Add support of inner format of string path variables for FileScreenshotConsumer
  • major #154 BaseRetryTimeout and BaseRetryInterval
  • minor #162 Inherit WaitForAngularJSAjaxAttribute from WaitForScriptAttribute
  • minor #163 Inherit WaitForJQueryAjaxAttribute from WaitForScriptAttribute
  • minor #164 Inherit WaitForDocumentReadyStateAttribute from WaitForScriptAttribute
  • major #165 Use Selenium.WebDriver package v3.12.1
  • major #166 Use Atata.WebDriverExtras package v1.0.0
  • minor #172 Set "*" as default scopeXPath of ScopeDefinitionAttribute
  • minor #176 Update WithFixOfCommandExecutionDelay method of DriverAtataContextBuilder`3 to invoke WithHostName method

Fixes

  • fix #150 FileScreenshotConsumer doesn’t handle path variables
  • fix #157 NoSuchElementException can be thrown during verification before timeout
  • fix #167 Fails to work with NLog v4.5.0

Timeouts and Intervals

Previously there was ability to set common retry timeout and interval values. Now it is possible to set specific parameters for operations of different kind.

New methods of AtataContextBuilder:

  • UseBaseRetryTimeout and UseBaseRetryInterval - base values.
  • UseElementFindTimeout and UseElementFindRetryInterval - used in the process of element finding.
  • UseWaitingTimeout and UseWaitingRetryInterval - used by waiting operations.
  • UseVerificationTimeout and UseVerificationRetryInterval - used by verification operations like Should.Contain("some text").

Usage

AtataContext.Configure().
    UseBaseRetryTimeout(TimeSpan.FromSeconds(5)).
    UseBaseRetryInterval(TimeSpan.FromSeconds(0.5)).
    UseWaitingTimeout(TimeSpan.FromSeconds(30)).
    UseVerificationTimeout(TimeSpan.FromSeconds(10)).
    Build();

Generic ClickAndGo and DoubleClickAndGo methods

2 generic methods were added to Control<TOwner>:

public TNavigateTo ClickAndGo<TNavigateTo>(TNavigateTo navigateToPageObject = null, bool? temporarily = null)
    where TNavigateTo : PageObject<TNavigateTo>;

public TNavigateTo DoubleClickAndGo<TNavigateTo>(TNavigateTo navigateToPageObject = null, bool? temporarily = null)
    where TNavigateTo : PageObject<TNavigateTo>;

They allow to navigate to different target page objects.

Usage

Go.To<SomePage>().
    SomeButton.ClickAndGo<AnotherPage>();
Go.To<SomePage>().
    SomeButton.ClickAndGo(new AnotherPage("some parameter"));

WaitForScriptAttribute

New base trigger attribute for a waiting for script to be executed was added. An inherited class should override BuildScript method and optionally BuildReportMessage.

Example

public class WaitForJQueryAjaxAttribute : WaitForScriptAttribute
{
    public WaitForJQueryAjaxAttribute(TriggerEvents on = TriggerEvents.AfterClick, TriggerPriority priority = TriggerPriority.Medium)
        : base(on, priority)
    {
    }

    protected override string BuildReportMessage<TOwner>(TriggerContext<TOwner> context)
        => "Wait for jQuery AJAX execution";

    protected override string BuildScript<TOwner>(TriggerContext<TOwner> context)
        => "return jQuery.active == 0";
}

PerformActions method

New method of PageObject<TOwner>:

public TOwner PerformActions(Func<Actions, Actions> actionsBuilder);

Performs the specified set of WebDriver actions. Can be used for any complex actions, for example pressing a combination of keys.

Usage

Go.To<SomePage>().
    PerformActions(x => x.KeyDown(Keys.Control).SendKeys("a").KeyUp(Keys.Control));