replaycli-py/api/chrome/features/steps/steps.py

44 lines
1.4 KiB
Python
Raw Normal View History

2022-01-05 13:30:34 +00:00
from behave import *
from cli import Chrome
2022-01-05 15:22:36 +00:00
# ========================== Chrome.start () ==========================
2022-01-05 13:30:34 +00:00
@given ("the Chrome client")
def step_impl (context):
context.client = Chrome()
2022-01-05 15:22:36 +00:00
@when ("the start method is called")
2022-01-05 13:30:34 +00:00
def step_impl (context):
2022-01-05 15:22:36 +00:00
context.start_return = context.client.start()
2022-01-05 13:30:34 +00:00
@then ("Google Chrome should open")
def step_impl (context):
2022-01-05 15:22:36 +00:00
assert context.start_return == "", "Google Chrome did not opened as expected."
context.client.stop()
# ========================== Chrome.start_headless () ==========================
@when ("the start_headless method is called")
def step_impl (context):
context.start_headless_return = context.client.start_headless()
@then ("Google Chrome should open headless")
def step_impl (context):
assert context.start_headless_return == "", "Google Chrome did not opened as expected."
context.client.stop()
# ========================== Chrome.stop () ==========================
@given ("a Chrome instance")
def step_impl (context):
context.start_return = context.client.start()
@when ("the stop method is called upon it")
def step_impl (context):
context.stop_return = context.client.stop()
@then ("this Google Chrome instance should close")
def step_impl (context):
assert context.stop_return == "", "Google Chrome did not closed as expected."
# ========================== Chrome.new () ==========================