Atata 0.14.0 Released

September 22, 2017 by Yevgeniy Shunevych


Atata 0.14.0 has been released. Check the changelog and major features. Release mostly contains a set of configuration enhancements including the changes for upcoming Atata.Configuration.Json package.

Changelog

Breaking Changes

  • break #67 Remove obsolete screenshot consumer extension methods

New Features

  • minor #58 Resolve log consumer by type name or alias
  • minor #60 Add AtataMapper class
  • minor #62 Resolve screenshot consumer by type name or alias
  • major #64 Add RemoteDriverAtataContextBuilder
  • major #72 Multi-driver configuration
  • major #74 AtataContext global configuration
  • minor #76 Add Clear method to AtataContextBuilder
  • minor #78 AtataContext static mode
  • major #79 Add ScrollTo method to Control<TOwner>

Changes and Enhancements

  • minor #57 Add LoggerName property to NLogConsumer
  • minor #59 Add WithProperties method to AtataContextBuilder<TContext>
  • minor #61 Enhance FileScreenshotConsumer
  • minor #63 Enhance AtataContext driver builders
  • minor #65 Test name configuration enhancement
  • minor #66 Move screenshot consumer extension methods from AtataContextBuilderExtensions
  • minor #68 Move log consumer extension methods from AtataContextBuilderExtensions
  • minor #69 Move NUnit related extension methods from AtataContextBuilderExtensions
  • minor #70 Add WithLoggerName extension method for AtataContextBuilder<NLogConsumer>
  • minor #71 Move driver extension methods from AtataContextBuilderExtensions
  • minor #73 Rename Build method of AtataContext to Configure
  • minor #75 Rename SetUp method of AtataContextBuilder to Build
  • minor #80 Add DriverAlias property to LogEventInfo
  • minor #81 Add “driver-alias” NLog event property in NLogConsumer
  • minor #82 Use Atata.WebDriverExtras package v0.12.0
  • major #83 Use Selenium.WebDriver and Selenium.Support packages v3.5.2
  • major #84 Set default retry timeout to 5 seconds

Remote Driver Configuration

Added enhancement for RemoteWebDriver configuraton.

Example

AtataContext.Configure().
    UseRemoteDriver().
        WithRemoteAddress("http://127.0.0.1:4444/wd/hub").
        WithOptions(new ChromeOptions()).
    // Other configuration.
    Build();

Check #64 Add RemoteDriverAtataContextBuilder for more configuration options.

Global Configuration

Added property to AtataContext class:

public static AtataContextBuilder GlobalConfiguration { get; }

Global configuration is static and applied as a base configuration settings to all other test-specific configurations. When AtataContext.Configure() method is invoked, BuildingContext of GlobalConfiguration is copied to new AtataContextBuilder instance. It is good to set up common AtataContext settings as a global configuration once in one-time set-up method.

Example

[OneTimeSetUp]
public void GlobalSetUp()
{
    AtataContext.GlobalConfiguration.
        AddNUnitTestContextLogging().
        UseNUnitTestName();
}
[SetUp]
public void SetUp()
{
    AtataContext.Configure().
        UseChrome().
        Build();
}

Multi-Driver Configuration

Added ability to set multiple driver builders using AtataContextBuilder. Each driver configuration can have an alias. Also added method to specify (choose) which driver configuration to use.

Example #1

[OneTimeSetUp]
public void GlobalSetUp()
{
    AtataContext.GlobalConfiguration.
        UseChrome().
            WithArguments("disable-extensions", "no-sandbox", "start-maximized").
        UseInternetExplorer().
            WithOptions(x => x.EnableNativeEvents = true).
        UseRemoteDriver().
            WithAlias("chrome_remote").
            WithRemoteAddress("http://127.0.0.1:4444/wd/hub").
            WithOptions(new ChromeOptions());
}
[SetUp]
public void SetUp()
{
    AtataContext.Configure().
        UseDriver(DriverAliases.Chrome).
        // Or UseDriver("chrome_remote").
        Build();
}

Example #2

For multi-browser testing you can specify driver aliases using fixture arguments.

[TestFixture(DriverAliases.Chrome)]
[TestFixture(DriverAliases.InternetExplorer)]
public class MultiDriverTests
{
    private readonly string driverAlias;

    public MultiDriverTests(string driverAlias)
    {
        this.driverAlias = driverAlias;
    }

    [SetUp]
    public void SetUp()
    {
        AtataContext.Configure().
            UseDriver(driverAlias).
            UseTestName(() => $"[{driverAlias}]{TestContext.CurrentContext.Test.Name}").
            Build();
    }

    [TearDown]
    public void TearDown()
    {
        AtataContext.Current.CleanUp();
    }
}

Check #72 Multi-driver configuration for more information.

Scrolling to Control

Added ScrollTo method which scrolls to the control. By default uses ScrollUsingMoveToElementAttribute behavior. Also executes new TriggerEvents.BeforeScroll and TriggerEvents.AfterScroll triggers.

Usage

page.SomeControl.ScrollTo();

Behaviors

  • ScrollBehaviorAttribute (base) - can be inherited for custom scrolling behavior.
  • ScrollUsingMoveToElementAttribute (used by default) - performs Actions.MoveToElement(IWebElement) action.
  • ScrollUsingScrollIntoViewAttribute - performs JavaScript element.scrollIntoView(true) function.
[ScrollUsingScrollIntoView]
public TextInput<_> SomeInput { get; private set; }