Chrome python client tests first version finished.

anticaptcha
Pedro de Oliveira Guedes 2022-01-06 12:38:21 -03:00
parent fa7f825621
commit 95052905c5
2 changed files with 35 additions and 5 deletions

View File

@ -57,8 +57,8 @@ Feature: The Chrome API client
Then this method must return the string 'ok'
# ======================== Chrome.send() ========================
# This method cannot be tested, given it's return cannot be predicted.
# Therefore, there will be no testes for this method, at least for now.
# This method cannot be tested, given it's return cannot be predicted.
# Therefore, there will be no testes for this method, at least for now.
# ======================== Chrome.open_tabs() ========================
Scenario: Using the Chrome.open_tabs method
@ -66,4 +66,16 @@ Feature: The Chrome API client
And a Chrome instance
And at least one Google Chrome tab is opened
When the open_tabs method is called
Then it must return a list of dictionaries containing the tabs data
Then it must return a list of dictionaries containing the tabs data
# ======================== Chrome.find_tab_by_url() ========================
# This method is currently broken.
# Therefore, there will be no testes for it, at least for now.
# ======================== Chrome.find_tab_by_title() ========================
Scenario: Using the Chrome.find_tab_by_title method
Given the Chrome client
And a Chrome instance
And at least one Google Chrome tab is opened
When the find_tab_by_title method is called
Then the id that this method returned must match the id of the tab searched

View File

@ -123,8 +123,26 @@ def step_impl(context):
assert context.open_tabs_return[1]["id"] == context.tab_id1, f"""
----------
Google id: {context.tab_id1}
Primeiro obj id: {context.open_tabs_return[1]['id']}
{context.open_tabs_return[1]['id'] == context.tab_id1}
First obj id: {context.open_tabs_return[1]['id']}
Match: {context.open_tabs_return[1]['id'] == context.tab_id1}
----------
"""
context.client.stop()
# ======================== Chrome.find_tab_by_url() ========================
# This method is currently broken.
# Therefore, there will be no testes for it, at least for now.
# ======================== Chrome.find_tab_by_title() ========================
@when("the find_tab_by_title method is called")
def step_impl(context):
context.ftbt_return = context.client.find_tab_by_title()
@then("the id that this method returned must match the id of the tab searched")
def step_impl(context):
assert context.ftbt_return == context.tab_id1, f"""
First tab id: {context.tab_id1}
Returned id: {context.ftbt_return}
Match: {context.ftbt_return == context.tab_id1}
"""
context.client.stop()