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 toDirectoryEnumerableProvider<TOwner>
andFileEnumerableProvider<TOwner>
- minor
#513 Add extra overload of verification
Contain
extension method - major
#514 Add verification extension methods for
DirectorySubject
:Exist
,ContainFile
,ContainFiles
,ContainDirectory
andContainDirectories
- major
#515 Add
Exist
verification extension method forFileSubject
- minor
#516 Add
DisposableSubject<T>
- major
#518
Should.Throw
andShould.Not.Throw
verification functionality - minor
#520 Add
ExecuteBehavior
methods toUIComponent
- 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)
andAddValueAndDispatchChangeEvent(string value)
methods toUIComponentScriptExecutor<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 toExist
- minor
#539 Add
DriverInitializationStage
property toAtataContext
Changes and Enhancements
- minor
#512 Change enumerable argument types of extension methods of
IDataVerificationProviderExtensions
- minor
#519 Update
ClearValueAttribute
trigger to invokeClear
method of a component - minor
#521 Update
SetValue
method ofCheckBox<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 ofEditableTextField<T, TOwner>
- minor
#535 Change
ControlDefinition
ofInput<T, TOwner>
to consider elements without type attribute - minor
#536 Update
Exist
verification method to handleNoSuchElementException
andNotMissingElementException
as actual message - minor
#537 Update
BeVisible
andBeHidden
verification methods to work similarly toExist
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:
- Create a copy of attribute class with renaming, e.g.
ClickUsingActionsAttribute
->ClicksUsingActionsAttribute
,ValueSetUsingScriptAttribute
->SetsValueUsingScriptAttribute
. - The old attribute class should inherit a new one.
- 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 executingValueClearBehaviorAttribute
behavior first; then, if value to set is not null or empty, executesTextTypeBehaviorAttribute
behavior.TypesTextUsingScriptAttribute
- the behavior for control text typing by executingHTMLElement.value += '{value}'; HTMLElement.dispatchEvent(new Event('change'));
JavaScript.TypesTextUsingSendKeysCharByCharAttribute
- the behavior for control text typing by invokingIWebElement.SendKeys(string)
method for character by character with interval defined inTypingIntervalInSeconds
property.TypesTextUsingFocusBehaviorAndSendKeysCharByCharAttribute
- the behavior for control text typing by executingFocusBehaviorAttribute
behavior and then invokingIWebElement.SendKeys(string)
method for character by character with interval defined inTypingIntervalInSeconds
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();