Cheat Sheet#
A fast reference guide for building tests using the ArgoBEAST framework.
π· Architecture Overview#
Feature β Steps β Actions β Pages β WebDriver What Describe Decide Do Execute
Features = High-level behaviour descriptions written in Gherkin.
Steps = Logical instructions (Given/When/Then). Contains branching & decisions.
Actions = Workflow orchestrators. Chain Page interactions; no branching.
Pages = UI element definitions + single UI interactions (βmicro-actionsβ).
BasePage = Provides interaction helpers (click, type, waitβ¦).
π Directory Structure#
my-tests/
βββ pages/
βββ actions/
βββ features/
β βββ steps/
βββ docs/
β βββ source/
β βββ beast_docs/ <-- Auto-generated RST lands here
βββ config/
βββ driver.yml
π CLI Quick Commands#
argobeast init
argobeast create page <name>
argobeast create actions <name>
argobeast create steps <name>
argobeast create feature <name>
argobeast generate-docs <-- NEW!
π Living Documentation#
Convert Gherkin features into Sphinx-ready RST files.
argobeast generate-docs [-y]
Source: Scans
./featuresTarget: Wipes & populates
./docs/source/beast_docs/Flag -y: Skips confirmation (Use for CI/CD pipelines)
Warning: This command is destructive to the target folder.
π Locators (Pages)#
Define at the top of the Page class:
from selenium.webdriver.common.by import By
USERNAME = (By.ID, "username")
SUBMIT = (By.CSS_SELECTOR, "button.submit")
Best practices: - Prefer ID, CSS, NAME. - Avoid long brittle XPATHs. - Use ALL_CAPS names.
π§© Page Methods#
Pages should expose single UI interactions:
def enter_username(self, value):
return self.type_text(self.USERNAME, value)
def click_submit(self):
return self.click(self.SUBMIT)
β Pages should NOT: - chain workflows - contain branching logic - decide why or when something happens
π¬ Actions#
Actions chain page interactions to form workflows:
class LoginActions(CommonActions):
PageClass = LoginPage
def login(self, username, password):
self.page.enter_username(username)
self.page.enter_password(password)
self.page.click_submit()
β Actions should NOT: - contain branching logic - interact with WebDriver directly
π§ Steps#
Steps are where logic, branching, and scenario-specific decisions live.
@when("I login using {username} and {password}")
def step_login(context, username, password):
ctx = BaseStepContext(context)
actions = ctx.get_actions(LoginActions)
actions.login(username, password)
β Steps SHOULD: - contain ifβ¦else logic - choose which Actions to run - supply test data
β Steps should NOT: - call WebDriver methods - call Page methods directly - store business logic inside Actions
π Feature Files#
You can add a @skip tag to any scenario to automatically skip a test during a run. This wonβt count as failure but will show on the report as a skipped scenario.
Written in Gherkin:
Feature: Login
Scenario: Successful login
Given I am on the login page
When I login using correct_user and correct_pass
Then I should see the home page welcome message
Scenario Outline:
Scenario Outline: Login attempts
Given I am on the login page
When I login using <username> and <password>
Then I should see the home page welcome message
Examples:
| username | password |
| argobeast | sup3rs3cr3t! |
| argoadmin | password123! |
π BaseStepContext#
Your helper for accessing Page + Actions inside steps:
ctx = BaseStepContext(context)
page = ctx.get_page(LoginPage)
actions = ctx.get_actions(LoginActions)
Think of it as a magic backpack that gives Steps everything they need.
π CommonActions (helpers)#
Includes frequently used patterns like:
wait_for_text
click_element_with_text
retry_click
scroll_to_bottom
wait_for_url_contains
Documented automatically via:
.. automodule:: argo_beast.common_actions.common_actions
:members:
π§ͺ Writing Tests β Rule of Thumb#
Feature β βWhat user story are we checking?β
Scenario β βWhat path are we testing?β
Steps β βUnder these conditions, run these workflows.β
Actions β βPerform workflow X using low-level interactions.β
Pages β βClick/type/wait on this specific element.β
π§Ή Golden Rules#
Pages = micro-actions
Actions = linear workflows
Steps = branching & decisions
Features = purely descriptive
β Never call WebDriver directly except inside BasePage β Never mix Page + Actions logic β Never put branching logic in Actions β Never put workflow logic in Pages
βοΈ Always use BaseStepContext inside steps βοΈ Always name locators clearly βοΈ Always split steps logically by page