Atata 1.12.0 is Released

September 1, 2021 by Yevgeniy Shunevych


Atata 1.12.0 is released with significant improvement of behavior attribute system and other useful features.

Changelog

New Features

  • minor #511 Add Names property to DirectoryEnumerableProvider<TOwner> and FileEnumerableProvider<TOwner>
  • minor #513 Add extra overload of verification Contain extension method
  • major #514 Add verification extension methods for DirectorySubject: Exist, ContainFile, ContainFiles, ContainDirectory and ContainDirectories
  • major #515 Add Exist verification extension method for FileSubject
  • minor #516 Add DisposableSubject<T>
  • major #518 Should.Throw and Should.Not.Throw verification functionality
  • minor #520 Add ExecuteBehavior methods to UIComponent
  • major #524 Focus behavior functionality
  • major #525 Hover behavior functionality
  • major #526 Drag and drop to offset behavior functionality
  • major #527 New SetsValueUsingClearAndTypeBehaviorsAttribute
  • minor #529 Add AddValue(string value) and AddValueAndDispatchChangeEvent(string value) methods to UIComponentScriptExecutor<TOwner>
  • major #530 New TypesTextUsingScriptAttribute
  • major #531 New TypesTextUsingSendKeysCharByCharAttribute
  • major #532 New TypesTextUsingFocusBehaviorAndSendKeysCharByCharAttribute
  • major #533 Add Satisfy(Expression<Predicate<TData>> predicateExpression) verification extension method
  • major #534 Add Satisfy(Expression<Predicate<IEnumerable<TData>>> predicateExpression) verification extension method
  • major #538 Add BePresent verification method analogical to Exist
  • minor #539 Add DriverInitializationStage property to AtataContext

Changes and Enhancements

  • minor #512 Change enumerable argument types of extension methods of IDataVerificationProviderExtensions
  • minor #519 Update ClearValueAttribute trigger to invoke Clear method of a component
  • minor #521 Update SetValue method of CheckBox<TOwner>
  • minor #522 Update base component classes to execute behaviors through ExecuteBehavior methods
  • major #523 Rename behavior attributes
  • major #528 Use SetsValueUsingClearAndTypeBehaviorsAttribute as a default value set behavior of EditableTextField<T, TOwner>
  • minor #535 Change ControlDefinition of Input<T, TOwner> to consider elements without type attribute
  • minor #536 Update Exist verification method to handle NoSuchElementException and NotMissingElementException as actual message
  • minor #537 Update BeVisible and BeHidden verification methods to work similarly to Exist method

Fixes

  • fix #510 Exception occurs when referencing non-existent subdirectories of DirectorySubject through indexer

Behaviors

One of the top changes of this release is a set of changes and additions to behavior attribute system.

Behaviors Renaming

All existing behavior implementation attribute classes were “renamed” to sound in a more appropriate form.

Renaming was done the following way:

  1. Create a copy of attribute class with renaming, e.g. ClickUsingActionsAttribute -> ClicksUsingActionsAttribute, ValueSetUsingScriptAttribute -> SetsValueUsingScriptAttribute.
  2. The old attribute class should inherit a new one.
  3. The old attribute is marked with [Obsolete] attribute.

So after update to v1.12.0 you might get warnings telling to use newer behavior attribute versions. The warning message contains exact name of new attribute to replace an old one with. So update should be pretty simple. Nevertheless, you can safely continue to use the old attribute versions.

Added Behavior Implementations

  • SetsValueUsingClearAndTypeBehaviorsAttribute - the behavior for control value set by executing ValueClearBehaviorAttribute behavior first; then, if value to set is not null or empty, executes TextTypeBehaviorAttribute behavior.
  • TypesTextUsingScriptAttribute - the behavior for control text typing by executing HTMLElement.value += '{value}'; HTMLElement.dispatchEvent(new Event('change')); JavaScript.
  • TypesTextUsingSendKeysCharByCharAttribute - the behavior for control text typing by invoking IWebElement.SendKeys(string) method for character by character with interval defined in TypingIntervalInSeconds property.
  • TypesTextUsingFocusBehaviorAndSendKeysCharByCharAttribute - the behavior for control text typing by executing FocusBehaviorAttribute behavior and then invoking IWebElement.SendKeys(string) method for character by character with interval defined in TypingIntervalInSeconds property.

Default Bahavior Change

SetsValueUsingClearAndTypeBehaviorsAttribute became the default value set behavior of EditableTextField<T, TOwner>. Basically, this should not be a breaking change, as under the hood, by default the same actions are executed.

New Behavior Types

There were 3 new types of behaviors added. Each of them contains a single implementation behavior. But now you are able to implement and use custom ones.

Focus

Changes the way how Control<TOwner>.Focus() method works.

FocusBehaviorAttribute - the base behavior class for control focus implementation.

FocusesUsingScriptAttribute - the behavior for control focusing by executing HTMLElement.focus() JavaScript. The default behavior.

Hover

Changes the way how Control<TOwner>.Hover() method works.

HoverBehaviorAttribute the base behavior class for control hover implementation.

HoversUsingActionsAttribute - the behavior for control hovering using WebDriver’s Actions. Performs Actions.MoveToElement(IWebElement) action. The default behavior.

Drag and Drop to Offset

Changes the way how Control<TOwner>.DragAndDropToOffset() method works.

DragAndDropToOffsetBehaviorAttribute - the base behavior class for implementation of control drag and drop to offset.

DragsAndDropsToOffsetUsingActionsAttribute - the behavior for control dragging and dropping to offset using WebDriver’s Actions. Performs Actions.DragAndDropToOffset(IWebElement, int, int) action. The default behavior.

New Universal Verification Method

Added an extra overload of Satisfy verification extension method with Expression parameter:

public static TOwner Satisfy<TData, TOwner>(
    this IDataVerificationProvider<TData, TOwner> verifier,
    Expression<Predicate<TData>> predicateExpression);

Now you can perform custom verifications like below:

SomeIntProperty.Should.Satisfy(x => x > 10 && x <= 20);

In case of assertion failure, the exception message will contain the text of expression.

Should.Throw and Should.Not.Throw Verification Functionality

Added functionality to verify exception throwing on non-UI method invoking.

Usage

Instance classes

_subject.Invoking(x => x.ContainsKey(null))
    .Should.Throw<ArgumentNullException>()
        .ValueOf(x => x.ParamName).Should.Equal("key")
        .ValueOf(x => x.Message).Should.Contain("key");
_subject.Invoking(x => x.ContainsKey("a"))
    .Should.NotThrow();

Static classes

Subject.Invoking(() => TestClass.GetEntity(null))
    .Should.Throw<ArgumentNullException>();
Subject.Invoking(() => TestClass.GetEntity(10))
    .Should.Not.Throw();