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 representsdriver (
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.
- 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
- 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 classstate (
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 usedselector (
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
- perform()¶
Performs the correct action based on what is defined within the selector, and returns the resulting report produced.
- Return type
- 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:
Add an entry for the action on the
enums
moduleCreate a function to perform the actual step under the
TestStep
classAdd 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 applicationaction (
UITestActions
) – The action enum for this steptarget (
Optional
[str
]) – What the target for this step is, if applicableparameters (
Optional
[dict
]) – Extra options for certain actionsaggregator – 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
- classmethod from_dict(ctx, action_dict, driver=None)¶
Factory method to extract needed parameters from a dictionary
- Return type
- optional_params = ['target', 'parameters']¶
- perform()¶
Runs the specified action. Wrapper for selecting proper inner method
- required_params = ['action']¶