Table of Contents

Generated automation ids

To make it easier to write end-to-end tests, particularly when these are carried out with an external tool that only has access to the HTML page, Neos, since version 1.21, auto-generates automation ids whenever possible.

These are only default values and their uniqueness is not guaranteed. If a search is performed on a duplicate identifier, the first element found will be returned. The rules for generating them have been written to avoid producing long-lasting identifiers and to make them as stable as possible (e.g. the identifier will not change if an element binded to a field is rebinded to a computed of the same name).

All the examples below show the xml with the auto-generated identifier. In Neos Studio, you can view these auto-generated identifiers by clicking on the ID button in the template editor.

Naming rules

On a form field or on a bound input, the automation id is the property-name attribute value:

<form-field property-name="FirstName" automation:id="FirstName" />
<input-date property-name="FirstName" automation:id="FirstName" />

On a label, the automation id is the property-name attribute value:

<label property-name="OrderDate" automation:id="OrderDate" />

On an unbound input, the automation id is generated from the text after the first dot in the value attribute:

<input-date value="@Fields.StartStart" automation:id="StartStart" />

On a tab item, the automation id is generated from the caption if the value is bound:

<tabs>
    <tab-item caption="@Resources.Parties.Tab1" automation:id="Tab1" />
    <tab-item caption="Tab 2" />
</tabs>

On an image, the automation id is generated from the name attribute value:

<image name="Dog" automation:id="Dog" />
<image name="@Fields.PartyType" automation:id="PartyType" />

On a html viewer, the automation id is generated from the html attribute value:

<html-viewer html="@Computeds.HtmlViewer" automation:id="HtmlViewer" />

On a button of type method, the automation id is generated from the method-name attribute value ('Async' is removed from the end of the method name if it is present):

<button type="method" method-name="Add" automation:id="Add" />
<button type="method" method-name="AddAsync" automation:id="Add" />

On a button of type action, the automation id is generated from the action-name attribute value:

<button type="action" action-name="Generate" automation:id="Generate" />

On other buttons, the automation id is generated from the type attribute value:

<button type="refresh" automation:id="Refresh" />

On text elements with content, the automation id is generated from the first bound value in the content:

<text automation:id="NewCustomer">
    @Resources.Parties.NewCustomer
</text>
<text automation:id="Text1">
    - @Resources.Parties.Text1 @Resources.Parties.Text2
</text>
<text>
    Orders
</text>
<text property-name="LastName" automation:id="LastName" />

On a tree view, the automation id is generated from the source attribute value:

<tree-view source="@Computeds.ExplorerTreeNodes" automation:id="ExplorerTreeNodes" />

Some elements have a constant identifier because there is generally only one in a given context:

<global-search-button automation:id="GlobalSearchButton" />
<global-search-input automation:id="GlobalSearchInput" />
<quick-search automation:id="QuickSearch" />
<filter-bar automation:id="FilterBar" />
<datagrid automation:id="Datagrid" />
<pagination-bar automation:id="PaginationBar" />

On a ui view element, the automation id is generated from relation-property-name, name, source and id attributes. id attribute always has priority.

<ui-view relation-property-name="Details" automation:id="Details" />
<ui-view relation-property-name="Details" id="OrderDetails" automation:id="OrderDetails" />
<ui-view name="OrderDetailUI" automation:id="OrderDetailUI" />
<ui-view name="OrderDetailUI" id="OrderDetails" automation:id="OrderDetails" />
<ui-view name="OrderDetailUI" source="@Computeds.FilteredDetails" automation:id="FilteredDetails" />
<ui-view name="OrderDetailUI" source="@Computeds.FilteredDetails" id="OrderDetails" automation:id="OrderDetails" />

Context switch

All the rules described above are affected by the context switch.

The relation-property-name attribute is used recursively as a prefix:

<datagrid automation:id="Datagrid" />
  <context relation-property-name="Details">
      <datagrid automation:id="Details.Datagrid" />
      <context relation-property-name="Comments">
          <datagrid automation:id="Details.Comments.Datagrid" />
      </context>
  </context>

The source attribute is used as a prefix, but without recursion:

<datagrid automation:id="Datagrid" />
<context source="@Computeds.AllDetails">
    <datagrid automation:id="AllDetails.Datagrid" />
    <context source="@Computeds.AllComments">
        <datagrid automation:id="AllComments.Datagrid" />
    </context>
</context>