quilla.steps package

All step-related classes and factories

Submodules

quilla.steps.base_steps module

class quilla.steps.base_steps.BaseStep(ctx, action_type, target=None, parameters=None, driver=None)

Bases: quilla.common.utils.DriverHolder, quilla.common.utils.EnumResolver

Base class for all step objects

Parameters
  • ctx (Context) – The runtime context for the application

  • action_type (UITestActions) – Enum defining which of the supported actions this class represents

  • driver (Optional[WebDriver]) – An optional argument to allow the driver to be bound at object creation.

  • target (Optional[str]) – Some form of locator for what this step will target. This is passed as a string, but what that string represents is specific to the step that is being performed. This can be a URL, XPath, or something else.

  • parameters (Optional[dict]) – A dictionary with any other auxiliary parameter that the step might require. Not all steps require extra data, but a specific step type could have some actions that require parameters and other actions that don’t.

ctx

The runtime context for the application

action

Enum defining which of the supported actions this class represents

target

Some form of locator for what this step will target. This is passed as a string, but what that string represents is specific to the step that is being performed. This can be a URL, XPath, or something else.

parameters

A dictionary with any other auxiliary parameter that the step might require. Not all steps require extra data, but a specific step type could have some actions that require parameters and other actions that don’t.

abstract copy()

Returns a copy of the current Step object

Return type

BaseStep

property element: selenium.webdriver.remote.webelement.WebElement

Located WebElement instance

Return type

WebElement

property locator

Locator for selenium to find web elements

property parameters

Parameters for an action, if applicable. Will resolve all context expressions before being returned

abstract perform()

Runs the necessary action. If the action is a Validate action, will return a ValidationReport

Return type

Optional[BaseReport]

Returns

A report produced by the step, or None if no report is required

property target

The target for an action, if applicable. Will resolve all context expressions before being returned

class quilla.steps.base_steps.BaseStepFactory

Bases: object

abstract classmethod from_dict(ctx, step, driver=None)

Given a context, step dictionary, and optionally a driver, return an appropriate subclass of BaseStep

Parameters
  • ctx (Context) – The runtime context of the application

  • step (Dict) – A dictionary defining the step

  • driver (Optional[WebDriver]) – Optionally, a driver to bind to the resulting step

Return type

BaseStep

Returns

The resulting step object

class quilla.steps.base_steps.BaseValidation(ctx, type_, target, state, selector, parameters, driver=None)

Bases: quilla.steps.base_steps.BaseStep

Base validation class with shared functionality for all validations

Parameters
  • ctx (Context) – The runtime context for the application

  • type – An enum describing the type of supported validation

  • target (str) – The general target that this validation will seek. What it means is specific to each subclass of this class

  • state (ValidationStates) – An enum describing the desired state of this validation. The specific enum is a subclass of the ValidationStates class specific to the subclass of BaseValidation being used

  • selector (Dict[ValidationStates, Callable[[], ValidationReport]]) – A dictionary that maps the state enum to the appropriate function

copy()

Returns a copy of the current Step object

Return type

BaseValidation

perform()

Performs the correct action based on what is defined within the selector, and returns the resulting report produced.

Return type

ValidationReport

Returns

A report summarizing the results of the executed validation

quilla.steps.steps module

Module containing all the requisite classes to perform test steps.

Adding new actions

Creating new simple actions in the code is designed to be fairly straightforward, and only requires three steps:

  1. Add an entry for the action on the enums module

  2. Create a function to perform the actual step under the TestStep class

  3. Add an entry to the selector with the enum as a key and the function as a value

Keep in mind that the step function should also validate any required data, and that updating the schema for proper json validation is essential.

If the parameters for the new action are expected to be enums, you must also add the logic for converting the parameter from string to enum in the UIValidation class.

class quilla.steps.steps.TestStep(ctx, action, target=None, parameters=None, driver=None)

Bases: quilla.steps.base_steps.BaseStep, quilla.steps.base_steps.BaseStepFactory

Class that contains the definition of a single test step. Used for setting up validations

Parameters
  • ctx (Context) – The runtime context of the application

  • action (UITestActions) – The action enum for this step

  • target (Optional[str]) – What the target for this step is, if applicable

  • parameters (Optional[dict]) – Extra options for certain actions

  • aggregator – The parent object holding this step

  • driver (Optional[WebDriver]) – The browser driver

selector

A dictionary that maps action enums to the action function

copy()

Creates a shallow copy of the TestStep object

This is used so that each browser can have an independent copy of the steps, in case any script would want to edit individual browser steps

Return type

TestStep

classmethod from_dict(ctx, action_dict, driver=None)

Factory method to extract needed parameters from a dictionary

Return type

TestStep

optional_params = ['target', 'parameters']
perform()

Runs the specified action. Wrapper for selecting proper inner method

required_params = ['action']