Testing some of the methods added.

anticaptcha
Pedro de Oliveira Guedes 2022-01-05 12:22:36 -03:00
parent c3d3403952
commit 6ffddd5dbc
2 changed files with 47 additions and 8 deletions

View File

@ -1,6 +1,17 @@
Feature: The Chrome API client
Scenario: Using the Chrome.Start method
Scenario: Using the Chrome.start method
Given the Chrome client
When the Start method is called
Then Google Chrome should open
When the start method is called
Then Google Chrome should open
Scenario: Using the Chrome.start_headless method
Given the Chrome client
When the start_headless method is called
Then Google Chrome should open headless
Scenario: Using the Chrome.stop method
Given the Chrome client
And a Chrome instance
When the stop method is called upon it
Then this Google Chrome instance should close

View File

@ -1,16 +1,44 @@
from behave import *
from cli import Chrome
# ========================== Chrome.start () ==========================
@given ("the Chrome client")
def step_impl (context):
context.client = Chrome()
@when ("the Start method is called")
@when ("the start method is called")
def step_impl (context):
# context._return = None
context._return = context.client.start()
context.start_return = context.client.start()
@then ("Google Chrome should open")
def step_impl (context):
print (f"\n-----------\n{context._return}\n------------\n")
assert context._return == "", "Google Chrome did not opened as expected."
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 () ==========================