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 ./features

  • Target: 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