From 739b21ddd11433314c2cda833d1adace4402f988 Mon Sep 17 00:00:00 2001 From: Pedro de Oliveira Guedes Date: Wed, 5 Jan 2022 15:04:25 -0300 Subject: [PATCH] Test for the new method. --- api/chrome/features/chrome.feature | 9 ++++++++- api/chrome/features/steps/steps.py | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/api/chrome/features/chrome.feature b/api/chrome/features/chrome.feature index fe2d27e..566f534 100644 --- a/api/chrome/features/chrome.feature +++ b/api/chrome/features/chrome.feature @@ -27,4 +27,11 @@ Feature: The Chrome API 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 \ No newline at end of file + Then the tab must close + + Scenario: Using the Chrome.eval method + Given the Chrome client + And a Chrome instance + And the id of a new Google Chrome tab opened + When the eval method is called upon the tab id with a command + Then this command must give back a value \ No newline at end of file diff --git a/api/chrome/features/steps/steps.py b/api/chrome/features/steps/steps.py index 6d485e6..c762d2b 100644 --- a/api/chrome/features/steps/steps.py +++ b/api/chrome/features/steps/steps.py @@ -66,3 +66,14 @@ def step_impl(context): def step_impl(context): assert context.close_return == "", "The tab did not closed correctly." context.client.stop() + + +# ========================== Chrome.eval () ========================== +@when("the eval method is called upon the tab id with a command") +def step_impl(context): + context.eval_value = context.client.eval(context.tab_id1, "2+2") + +@then("this command must give back a value") +def step_impl(context): + assert 'value' in context.eval_value['result']['result'], "The command did not worked as expected." + context.client.stop() \ No newline at end of file