Updating the eval tests.
parent
46d0b8a495
commit
7baf408c05
|
@ -29,9 +29,16 @@ Feature: The Chrome API client
|
||||||
When the close method is called upon the tab id
|
When the close method is called upon the tab id
|
||||||
Then the tab must close
|
Then the tab must close
|
||||||
|
|
||||||
Scenario: Using the Chrome.eval method
|
Scenario: Using the Chrome.eval method for arithmetics
|
||||||
Given the Chrome client
|
Given the Chrome client
|
||||||
And a Chrome instance
|
And a Chrome instance
|
||||||
And the id of a new Google Chrome tab opened
|
And the id of a new Google Chrome tab opened
|
||||||
When the eval method is called upon the tab id with a command
|
When the eval method is called upon the tab id with a arithmetic command
|
||||||
Then this command must give back a value
|
Then this command must give back the result as a value
|
||||||
|
|
||||||
|
Scenario: Using the Chrome.eval method for JavaScript commands
|
||||||
|
Given the Chrome client
|
||||||
|
And a Chrome instance
|
||||||
|
And the id of a new Google Chrome tab opened in google.com
|
||||||
|
When the eval method is called upon the tab id with a JS command
|
||||||
|
Then this command must give back the element requested as a value
|
|
@ -69,11 +69,24 @@ def step_impl(context):
|
||||||
|
|
||||||
|
|
||||||
# ========================== Chrome.eval () ==========================
|
# ========================== Chrome.eval () ==========================
|
||||||
@when("the eval method is called upon the tab id with a command")
|
@when ("the eval method is called upon the tab id with a arithmetic command")
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
context.eval_value = context.client.eval(context.tab_id1, "2+2")
|
context.eval_value = context.client.eval(context.tab_id1, "2+2")
|
||||||
|
|
||||||
@then("this command must give back a value")
|
@then ("this command must give back the result as a value")
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
assert context.eval_value != None, "The command did not worked as expected."
|
assert context.eval_value == 4, "The command did not worked as expected."
|
||||||
|
context.client.stop()
|
||||||
|
|
||||||
|
@given ("the id of a new Google Chrome tab opened in google.com")
|
||||||
|
def setp_impl(context):
|
||||||
|
context.tab_id = context.client.new()
|
||||||
|
|
||||||
|
@when ("the eval method is called upon the tab id with a JS command")
|
||||||
|
def step_impl(context):
|
||||||
|
context.eval_value = context.client.eval(context.tab_id, "document.getElementById('SIvCob').textContent")
|
||||||
|
|
||||||
|
@then ("this command must give back the element requested as a value")
|
||||||
|
def step_impl(context):
|
||||||
|
assert context.eval_value == 'Disponibilizado pelo Google em: English ', "The command did not worked as expected."
|
||||||
context.client.stop()
|
context.client.stop()
|
Loading…
Reference in New Issue