Upgrade to Atata 2

How to upgrade to Atata 2 considering breaking changes.

First steps

The first migration step is to ensure or upgrade your Atata to v1.14.0. Then fix all Atata warnings telling that some class/member is obsolete, as those items should be removed in v2.

Atata targeting only .NET Standard 2.0

The Atata package now targets .NET Standard 2.0, which supports .NET 5+, .NET Framework 4.6.1+ and .NET Core/Standard 2.0+. Dropped support of .NET 4.0 - .NET 4.6.

Thus, if your project uses the .NET Framework version prior to 4.6.1, either upgrade the project to the newer version or just stay with Atata v1.

Upgrade Selenium.WebDriver to v4

The biggest change in Atata 2 is the upgrade of Selenium.WebDriver to v4. Please check out the Upgrade to Selenium 4 to see what changed and make appropriate modifications after the upgrade to Atata v2. Pay attention to driver configuration changes. All WebDriver configuration changes are reflected in Atata and Atata.Configuration.Json. Check out the updated Atata.Configuration.Json / JSON Schema if you use Atata JSON configuration files.

IWebDriver is used instead of RemoteWebDriver

A usage of RemoteWebDriver was everywhere replaced with IWebDriver:

Driver usage changes

Most other properties and methods of RemoteWebDriver are also present in IWebDriver.

Default control Visibility is changed from Visible to Any

In Atata v1 when Visibility of control is not specified explicitly, Visibility.Visible is used by default to find the control’s element, which filters only visible elements. That is useful filtering in a case when you have hidden HTML elements on a page and don’t want Atata to find and interact with hidden elements. But a drawback of such filtering is performance decrease, as each element visibility check is a separate WebDriver command request.

Ensure that you want this feature to be enabled for your website under test. If you have a lot of hidden/invisible HTML elements (for example, check grey HTML tags in browser developer tools) and you still want Atata to filter them out, you may consider disabling this feature. Right after the upgrade to Atata v2, run all your tests and check out the test failures. If there are not many failures because of elements visibility, and they can be solved by setting Visibility.Visible to particular controls, then you are good to go with this feature. Otherwise, you can consider the ability to disable this feature globally.

Set Visible by default globally

Visibility.Any behavior can be easily reverted to the one with Visibility.Visible filter that was in Atata v1 by one of the following ways:

  1. Using UseDefaultControlVisibility configuration method:
    AtataContext.GlobalConfiguration.
        UseDefaultControlVisibility(Visibility.Visible);
    
  2. In Atata JSON config:
    {
      "defaultControlVisibility": "Visible"
    }
    

Set Visible to particular controls

Set in FindAttribute

[FindBy("some-id")]

->

[FindBy("some-id", Visibility = Visibility.Visible)]

Set in ControlDefinitionAttribute

[ControlDefinition("li")]

->

[ControlDefinition("li", Visibility = Visibility.Visible)]

Set in FindSettingsAttribute

[FindSettings(OuterXPath = "./")]

->

[FindSettings(OuterXPath = "./", Visibility = Visibility.Visible)]

Add FindOnlyVisibleAttribute

[FindBy("some-id")]
public TextInput<_> Name { get; private set; }

->

[FindBy("some-id")]
[FindOnlyVisible]
public TextInput<_> Name { get; private set; }

You can also declare [FindOnlyVisible(TargetAllChildren = true)] on page object or parent control to target it to all child controls.

Set for dynamic control

var input = page.Find<TextInput<SomePage>>(new FindByNameAttribute("name1"));

->

var input = page.Find<TextInput<SomePage>>(new FindByNameAttribute("name1").Visible());

The "" is returned instead of null as value of string-based field component

In Atata v1, when input or content field is empty, null is returned as a value. In Atata v2, an empty string is returned instead.

Take into account to change the assertions like:

SomeInput.Should.BeNull();

to:

SomeInput.Should.BeEmpty();

Renaming and changes of frequently used classes and members

Component finding

Configuration

Data/Object provider

Misc

All breaking changes

Feedback

Feel free to use any contact channel if you have problems with migration.