AAF ― Applicita LTD
  • Getting Started
  • Development
    • Key Objectives
    • Development Environment & OS
    • Architecture
    • Visual Studio Solution
    • Setup for Local Development
      • Docker & Kubernates
      • Visual Studio Host Builder
  • Web
    • Feature
      • Authentication and Authorization
        • Sign up
        • Sign In
        • Sign out
        • Remember me
        • Recovering password
      • Tenant management
        • Create tenant
        • Search tenant
        • Tenant page
          • Change basic information
          • Change administrator
          • Change branding
          • Change style
          • Change status
          • Assets
        • Delete tenant
      • User management
        • Create user
        • Search user
        • Send email
        • User page
          • Editing page sections
          • Change basic information
          • Change profile picture
          • Change role
          • Change status
        • Delete user
        • Reset users password
      • Role management
        • Create role
        • Search role
        • Role page
          • Change basic information
          • Change status
          • Revoke role
          • Change permissions
          • Interactive permissions button
        • Delete role
      • Bug reporting
  • Testing
    • Testing Environment
    • Atata
    • Architecture
      • Feature structure
      • Common
        • Attributes
        • Components
        • Controls
        • Fixtures
        • Generators
    • Example
Powered by GitBook
On this page

Was this helpful?

  1. Testing
  2. Architecture
  3. Common

Controls

PreviousComponentsNextFixtures

Last updated 5 years ago

Was this helpful?

Custom controls used by other features are defined in this section.

A good example is Hoverable control used in . Since many controls have to be hovered so that save, edit and cancel buttons become visible, we wrapped the behavior in this generic control.

Other components which need this behavior simply inherit from this control and define their own fields and subcomponents.

public enum RoleStatus
{
    Enabled = 1,
    Disabled
}

[ControlDefinition("role-edit-status")]
public class RoleStatusControl<TOwner> : Hoverable<TOwner> where TOwner : PageObject<TOwner>
{
    [FindByXPath(Constants.Components.RolePage.Status.State)]
    public Content<RoleStatus, TOwner> Text { get; private set; }

    [FindByXPath(Constants.Components.RolePage.Status.Toggle, Visibility = Visibility.Any)]
    public Clickable<TOwner> Toggle { get; private set; }
}

Then you can define this RoleStatusControl and use it on another page object:

namespace Applicita.AAF.WebApp.Tests.Roles.Components
{
    using _ = RolePage;

    [WaitForLoadingIndicator(on: TriggerEvents.Init)]
    public class RolePage : PageWithNavigation<_>
    {
        public RoleStatusControl<_> Status { get; private set; }
    }
}

After defining control on page object, we can test it:

[Test]
public void RolePage_Status_Edit()
{
    Pages.TestRolePage()
        .Status.Text.Should.Equal(RoleStatus.Enabled)
        .Status.Edit.Click()
        .Status.Toggle.Click()
        .Status.Save()
        .Status.Text.Should.Equal(RoleStatus.Disabled);
}

Here is a snippet demonstrating how to use Hoverable on :

role status control
most pages
Controls section
Role status control