Adding more tests for the implemented methods.
parent
6ffddd5dbc
commit
cd2fec2502
api/chrome/features
|
@ -3,15 +3,28 @@ Feature: The Chrome API client
|
||||||
Scenario: Using the Chrome.start method
|
Scenario: Using the Chrome.start method
|
||||||
Given the Chrome client
|
Given the Chrome client
|
||||||
When the start method is called
|
When the start method is called
|
||||||
Then Google Chrome should open
|
Then Google Chrome must open
|
||||||
|
|
||||||
Scenario: Using the Chrome.start_headless method
|
Scenario: Using the Chrome.start_headless method
|
||||||
Given the Chrome client
|
Given the Chrome client
|
||||||
When the start_headless method is called
|
When the start_headless method is called
|
||||||
Then Google Chrome should open headless
|
Then Google Chrome must open headless
|
||||||
|
|
||||||
Scenario: Using the Chrome.stop method
|
Scenario: Using the Chrome.stop method
|
||||||
Given the Chrome client
|
Given the Chrome client
|
||||||
And a Chrome instance
|
And a Chrome instance
|
||||||
When the stop method is called upon it
|
When the stop method is called upon it
|
||||||
Then this Google Chrome instance should close
|
Then this Google Chrome instance must close
|
||||||
|
|
||||||
|
Scenario: Using the Chrome.new method
|
||||||
|
Given the Chrome client
|
||||||
|
And a Chrome instance
|
||||||
|
When the new method is called
|
||||||
|
Then a new Google Chrome tab with the url given must open in the instance
|
||||||
|
|
||||||
|
Scenario: Using the Chrome.close method
|
||||||
|
Given the Chrome client
|
||||||
|
And a Chrome instance
|
||||||
|
And the id of a new Google Chrome tab opened
|
||||||
|
When the close method is called upon the tab id
|
||||||
|
Then the tab must close
|
|
@ -10,7 +10,7 @@ def step_impl (context):
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
context.start_return = context.client.start()
|
context.start_return = context.client.start()
|
||||||
|
|
||||||
@then ("Google Chrome should open")
|
@then ("Google Chrome must open")
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
assert context.start_return == "", "Google Chrome did not opened as expected."
|
assert context.start_return == "", "Google Chrome did not opened as expected."
|
||||||
context.client.stop()
|
context.client.stop()
|
||||||
|
@ -21,7 +21,7 @@ def step_impl (context):
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
context.start_headless_return = context.client.start_headless()
|
context.start_headless_return = context.client.start_headless()
|
||||||
|
|
||||||
@then ("Google Chrome should open headless")
|
@then ("Google Chrome must open headless")
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
assert context.start_headless_return == "", "Google Chrome did not opened as expected."
|
assert context.start_headless_return == "", "Google Chrome did not opened as expected."
|
||||||
context.client.stop()
|
context.client.stop()
|
||||||
|
@ -36,9 +36,33 @@ def step_impl (context):
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
context.stop_return = context.client.stop()
|
context.stop_return = context.client.stop()
|
||||||
|
|
||||||
@then ("this Google Chrome instance should close")
|
@then ("this Google Chrome instance must close")
|
||||||
def step_impl (context):
|
def step_impl (context):
|
||||||
assert context.stop_return == "", "Google Chrome did not closed as expected."
|
assert context.stop_return == "", "Google Chrome did not closed as expected."
|
||||||
|
|
||||||
|
|
||||||
# ========================== Chrome.new () ==========================
|
# ========================== Chrome.new () ==========================
|
||||||
|
@when("the new method is called")
|
||||||
|
def step_impl(context):
|
||||||
|
context.tab_id = context.client.new("https://www.youtube.com")
|
||||||
|
|
||||||
|
@then ("a new Google Chrome tab with the url given must open in the instance")
|
||||||
|
def step_impl(context):
|
||||||
|
assert len(context.tab_id) == 32, "The new Google Chrome tab did not opened correctly."
|
||||||
|
context.client.stop()
|
||||||
|
|
||||||
|
|
||||||
|
# ========================== Chrome.close () ==========================
|
||||||
|
@given ("the id of a new Google Chrome tab opened")
|
||||||
|
def step_impl(context):
|
||||||
|
context.tab_id1 = context.client.new("https://www.gmail.com")
|
||||||
|
context.tab_id2 = context.client.new("https://www.youtube.com")
|
||||||
|
|
||||||
|
@when ("the close method is called upon the tab id")
|
||||||
|
def step_impl(context):
|
||||||
|
context.close_return = context.client.close(context.tab_id1)
|
||||||
|
|
||||||
|
@then("the tab must close")
|
||||||
|
def step_impl(context):
|
||||||
|
assert context.close_return == "", "The tab did not closed correctly."
|
||||||
|
context.client.stop()
|
||||||
|
|
Loading…
Reference in New Issue