Atata 1.13.0 is Released

October 21, 2021 by Yevgeniy Shunevych


Atata 1.13.0 is released with new dynamic controls functionality, caching and other useful improvements.

Changelog

New Features

  • minor #542 New TypesTextUsingFocusBehaviorAndSendKeysAttribute
  • minor #543 New FocusAttribute trigger
  • major #547 Add Find and FindAll methods to UIComponent<TOwner>
  • major #550 Add Be verification extension method
  • major #554 Scope cache functionality
  • major #557 Table column header texts cache functionality
  • minor #559 Clear cache functionality
  • minor #560 Add GetOption method to Select<T, TOwner>
  • major #561 New UsesCacheAttribute
  • major #562 Value cache functionality
  • major #564 Control blur functionality
  • minor #565 New BlurAttribute trigger
  • minor #567 Add AtataContext Context property to UIComponent

Changes and Enhancements

  • minor #548 Verification trigger attributes to inherit from WaitingTriggerAttribute
  • minor #549 Add two spaces before “Actual” text in verification exception message
  • minor #552 Shorten equality expected condition text in verification exception message
  • minor #553 Add ability to MulticastAttribute to target self and children components together
  • minor #558 Add ability to use offsets in HoversUsingActionsAttribute

Fixes

  • fix #545 Select<T, TOwner> doesn’t handle options with empty text or value for enum
  • fix #556 PageObject<TOwner>.Init method is invoked when AtataContext.Current.PageObject holds previous page object instance
  • fix #566 Exists property of FileSubject and DirectorySubject doesn’t update dynamically

Dynamic Controls

New methods are added to UIComponent<TOwner> and IUIComponent<TOwner>:

public TControl Find<TControl>(params Attribute[] attributes)
    where TControl : Control<TOwner>;

public TControl Find<TControl>(string name, params Attribute[] attributes)
    where TControl : Control<TOwner>;

public ControlList<TControl, TOwner> FindAll<TControl>(params Attribute[] attributes)
    where TControl : Control<TOwner>;

public ControlList<TControl, TOwner> FindAll<TControl>(string name, params Attribute[] attributes)
    where TControl : Control<TOwner>;

Find - creates a control of the specified TControl type, optionally with name and additional attributes, that is a descendant of the current component. The control’s element will be found using either FindAttribute specified in attributes parameter, or the default/applied FindAttribute associated with the TControl type.

FindAll - creates a control list of the specified TControl type, optionally with name and additional attributes, that are descendants of the current component. Use ControlDefinitionAttribute to specialize the control element definition, instead of FindAttribute that doesn’t utilize here.

Usage

New methods can be used directly in tests:

Go.To<SomePage>()
    .Find<H1<SomePage>>().Should.Equal("Some Title")
    .FindAll<TextInput<SomePage>>().Should.HaveCount(4);

But it is recommended to use them inside page object methods, because the basic usage purpose of the new methods is to allow a search of control by dynamic identifier/parameter.

public TextInput<_> FindTextInputByLabel(string label) =>
    Find<TextInput<_>>(new FindByLabelAttribute(label));

Caching

There was added caching functionality of component scope element, value and table column headers. This set of features is aimed to increase performance of subsequent component scope/value access requests, especially for ControlList items and Table rows.

Find out more details in caching issues: #554, #557, #559, #561 and #562.

Usage

Apply Scope Cache to Certain Control

[UsesScopeCache]
public TextInput<_> SomeInput { get; private set; }

Apply Scope and Value Cache to Certain Control

[UsesCache]
public H1<_> Header { get; private set; }

Apply Scope Cache to Page Object Children

[UsesScopeCache(TargetChildren = true)]
public class SomePage : Page<_>
{
    //...
}

Apply Cache to Table Row and Clear on “Remove” Button Click

[UsesCache(TargetSelfAndChildren = true)]
public class UserTableRow : TableRow<_>
{
    public Text<_> FirstName { get; private set; }

    public Text<_> LastName { get; private set; }

    [ClearCache(Of = ClearCacheTarget.Parent)]
    public Button<_> Remove { get; private set; }
}

Caching Attributes

UsesScopeCacheAttribute - specifies whether the component scope cache mechanic should be used. Caches a scope element of a component when it is requested at first time, then returns the cached element instance on further scope requests.

UsesValueCacheAttribute - specifies whether the component value cache mechanic should be used. Caches a value of a component when it is requested at first time, then returns the cached value on further scope requests.

UsesColumnHeaderTextsCacheAttribute - specifies whether the column header texts cache of the Table control should be used. Caches a value when it is requested at first time, then returns the cached value on further requests.

This caching is enabled by default in Table<THeader, TRow, TOwner> control. Use [UsesColumnHeaderTextsCache(false)] to disable this caching.

UsesCacheAttribute - specifies whether the component caching mechanics should be used. Use it to enable/disable all caching mechanics of component.

Clear Cache

Cache can be cleared by using new ClearCache() method of UIComponent<TOwner> and ControlList<TItem, TOwner>. Also new ClearCacheAttribute trigger can be used.

New Triggers

FocusAttribute - indicates that the focusing on the control should be performed on the specified event. By default occurs before set.

BlurAttribute - indicates that the control blurring (removing focus) should be performed on the specified event. By default occurs after set.

ClearCacheAttribute - indicates that the component’s cache should be cleared on the specified event. By default occurs after click or set.