Skip to content

Commit

Permalink
feat!: rename act/verify to do/check
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Nov 1, 2024
1 parent 9004cbf commit 6b3c9af
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions alumnium/alumni.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def quit(self):
self.driver.quit()

@retry(tries=2, delay=0.1)
def act(self, goal: str):
def do(self, goal: str):
self.actor_agent.invoke(goal)

def verify(self, statement: str, vision: bool = False):
def check(self, statement: str, vision: bool = False):
self.verifier_agent.invoke(statement, vision)
4 changes: 2 additions & 2 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Welcome to the Alumnium interactive console!
Use the `al` object to interact with Alumni. For example:
- al.act("search for selenium")
- al.verify("selenium.dev is present in the search results")
- al.do("search for selenium")
- al.check("selenium.dev is present in the search results")
You can also use the `driver` object to interact with the Selenium directly.
"""
Expand Down
26 changes: 13 additions & 13 deletions examples/behave/features/steps/todo_al.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,61 @@ def step_impl(context, url):

@when('I create a new task "{title}"')
def step_impl(context, title):
context.al.act(f"I create a new task '{title}'")
context.al.do(f"I create a new task '{title}'")


@when('I complete the "{title}" task')
def step_impl(context, title):
context.al.act(f'I mark the "{title}" task as completed')
context.al.do(f'I mark the "{title}" task as completed')


@when('I uncomplete the "{title}" task')
def step_impl(context, title):
context.al.act(f'I mark the "{title}" task as uncompleted')
context.al.do(f'I mark the "{title}" task as uncompleted')


@when('I delete the "{title}" task')
def step_impl(context, title):
context.al.act(f'I hover the "{title}" task')
context.al.act(f'I delete the "{title}" task')
context.al.do(f'I hover the "{title}" task')
context.al.do(f'I delete the "{title}" task')


@when("I complete all tasks")
def step_impl(context):
# Avoid attempting to complete tasks one by one.
context.al.act("I mark all tasks completed using 'Toggle All' button")
context.al.do("I mark all tasks completed using 'Toggle All' button")


@when('I show only "{filter}" tasks')
def step_impl(context, filter):
context.al.act(f'I show only "{filter}" tasks')
context.al.do(f'I show only "{filter}" tasks')


@when("I clear completed tasks")
def step_impl(context):
context.al.act("I clear completed tasks")
context.al.do("I clear completed tasks")


@then('I should see "{title}" in the list of tasks')
def step_impl(context, title):
context.al.verify(f'I should see "{title}" in the list of tasks')
context.al.check(f'I should see "{title}" in the list of tasks')


@then('I should not see "{title}" in the list of tasks')
def step_impl(context, title):
context.al.verify(f'I should not see "{title}" in the list of tasks')
context.al.check(f'I should not see "{title}" in the list of tasks')


@then('"{title}" task should be uncompleted')
def step_impl(context, title):
context.al.verify(f'"{title}" task is not marked as completed')
context.al.check(f'"{title}" task is not marked as completed')


@then('"{title}" task should be completed')
def step_impl(context, title):
context.al.verify(f'"{title}" task is marked as completed')
context.al.check(f'"{title}" task is marked as completed')


@then("tasks counter should be {count}")
def step_impl(context, count):
context.al.verify(f'tasks counter should be {count}")')
context.al.check(f'tasks counter should be {count}")')
6 changes: 3 additions & 3 deletions examples/pytest/calculator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def test_addition(al, driver):
driver.get("https://seleniumbase.io/apps/calculator")
al.act("1 + 1 =")
al.verify("calculator result is 2")
al.do("1 + 1 =")
al.check("calculator result is 2")
with pytest.raises(AssertionError):
al.verify("calculator result is 3")
al.check("calculator result is 3")
6 changes: 3 additions & 3 deletions examples/pytest/drag_and_drop_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def test_drag_and_drop(al, driver):
driver.get("https://the-internet.herokuapp.com/drag_and_drop")
al.verify("square A is positioned to the left from square B", vision=True)
al.act("move square A to square B")
al.verify("square B is positioned to the left from square A", vision=True)
al.check("square A is positioned to the left from square B", vision=True)
al.do("move square A to square B")
al.check("square B is positioned to the left from square A", vision=True)
6 changes: 3 additions & 3 deletions examples/pytest/google_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

def test_google_search(al, driver):
driver.get("https://www.google.com")
al.act("search for selenium")
al.verify("selenium in page title")
al.verify("selenium.dev is present in the search results")
al.do("search for selenium")
al.check("selenium in page title")
al.check("selenium.dev is present in the search results")
6 changes: 3 additions & 3 deletions examples/pytest/select_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def test_select_option(al, driver):
driver.get("https://the-internet.herokuapp.com/dropdown")
al.verify("no option is selected")
al.act("select Option 1")
al.verify("Option 1 is selected")
al.check("no option is selected")
al.do("select Option 1")
al.check("Option 1 is selected")

0 comments on commit 6b3c9af

Please sign in to comment.