diff --git a/features/environment.py b/features/environment.py index 81552e5..22bb37d 100644 --- a/features/environment.py +++ b/features/environment.py @@ -36,6 +36,10 @@ def before_scenario(context, scenario): options = EdgeOptions() options.browser_version = desired_cap.get("version", "latest") options.platform_name = "Windows 8" + elif 'SmartUI' in scenario.tags: + options = ChromeOptions() + options.browser_version = desired_cap.get("version", "latest") + options.set_capability('smartUI.project','Python-Behave-sample') else: raise ValueError("Unsupported browser tag") diff --git a/features/steps/steps.py b/features/steps/steps.py index 3ede1d6..3cbf40f 100644 --- a/features/steps/steps.py +++ b/features/steps/steps.py @@ -40,4 +40,8 @@ def step(context, text): @then('click the "{button}"') def step(context, button): element = wait_for_element(context, By.ID, button) - element.click() \ No newline at end of file + element.click() + +@then('take smartui snapshot') +def step(context): + context.browser.execute_script("smartui.takeScreenshot= to-do") \ No newline at end of file diff --git a/features/test.feature b/features/test.feature index c6a475c..c4deac4 100644 --- a/features/test.feature +++ b/features/test.feature @@ -25,4 +25,10 @@ Feature: Automate a website When field with name "First Item" is present check the box When field with name "Second Item" is present check the box When select the textbox add "Let's add new to do item for Edge" in the box - Then click the "addbutton" \ No newline at end of file + Then click the "addbutton" + + @SmartUI + Scenario: Capture smartui snapshot + When visit url "https://lambdatest.github.io/sample-todo-app" + When check if title is "Sample page - lambdatest.com" + Then take smartui snapshot \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 61e3cf2..3205a40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ Paver==1.3.4 selenium>4.23.0 behave==1.2.6 -behavex==1.6.0 \ No newline at end of file +behavex>1.6.0 \ No newline at end of file