add all four tests, and skip the edge test

This commit is contained in:
Greg Gauthier 2020-10-14 23:24:01 +01:00
parent c06e5ab66d
commit da1f39f5f7
5 changed files with 35 additions and 8 deletions

View File

@ -1,9 +1,10 @@
[behave] [behave]
default_format = pretty default_format = pretty
show_skipped = false show_skipped = true
show_timings = true show_timings = true
stdout_capture = yes stdout_capture = yes
logging-level = ERROR logging-level = ERROR
default_tags = ~@skip
[behave.userdata] [behave.userdata]
browser = chrome browser = chrome

View File

@ -8,3 +8,15 @@ Feature: Browser Demo
Given I have a firefox driver Given I have a firefox driver
When I navigate to test.io When I navigate to test.io
Then The page is displayed Then The page is displayed
@skip
Scenario: Load test.io web page with edge
Given I have an edge driver
When I navigate to test.io
Then The page is displayed
Scenario: Load test.io web page with safari
Given I have a safari driver
When I navigate to test.io
Then The page is displayed

View File

@ -1,7 +1,5 @@
def before_all(context): def before_all(context):
# -- SET LOG LEVEL: behave --logging-level=ERROR ... # -- SET LOG LEVEL: behave --logging-level=ERROR ...
# on behave command-line or in "behave.ini". # on behave command-line or in "behave.ini".
context.config.setup_logging() context.config.setup_logging()
# -- ALTERNATIVE: Setup logging with a configuration file.
# context.config.setup_logging(configfile="behave_logging.ini")

View File

@ -13,6 +13,16 @@ def step_impl(context):
context.driver = BrowserDriver.get("chrome") context.driver = BrowserDriver.get("chrome")
@given(u'I have an edge driver')
def step_impl(context):
context.driver = BrowserDriver.get("edge")
@given(u'I have a safari driver')
def step_impl(context):
context.driver = BrowserDriver.get("safari")
@when('I navigate to test.io') @when('I navigate to test.io')
def step_impl(context): def step_impl(context):
context.driver.get("https://test.io") context.driver.get("https://test.io")

View File

@ -1,10 +1,10 @@
from browserdriver import BrowserDriver from browserdriver import BrowserDriver
import pytest import pytest
def test_firefox_browser(headless): def test_firefox_browser(headless):
bd = BrowserDriver().get("firefox", headless=headless) bd = BrowserDriver().get("firefox", headless=headless)
bd.get('https://test.io') bd.get('https://test.io')
print(bd.current_url, bd.title)
assert "QA Testing as a Service | test IO" == bd.title assert "QA Testing as a Service | test IO" == bd.title
bd.quit() bd.quit()
@ -12,14 +12,20 @@ def test_firefox_browser(headless):
def test_chrome_browser(headless): def test_chrome_browser(headless):
bd = BrowserDriver().get("chrome", headless=headless) bd = BrowserDriver().get("chrome", headless=headless)
bd.get('https://test.io') bd.get('https://test.io')
print(bd.current_url, bd.title)
assert "QA Testing as a Service | test IO" == bd.title assert "QA Testing as a Service | test IO" == bd.title
bd.quit() bd.quit()
def test_safari_browser(headless):
bd = BrowserDriver().get("safari", headless=False)
bd.get('https://test.io')
assert "QA Testing as a Service | test IO" == bd.title
bd.quit()
@pytest.mark.skip(reason="inconsistent implementations across platforms") @pytest.mark.skip(reason="inconsistent implementations across platforms")
def test_edge_browser(headless): def test_edge_browser(headless):
bd = BrowserDriver().get("edge", headless=headless) bd = BrowserDriver().get("edge", headless=headless)
bd.get('https://test.io') bd.get('https://test.io')
print(bd.current_url, bd.title)
assert "QA Testing as a Service | test IO" == bd.title assert "QA Testing as a Service | test IO" == bd.title
bd.quit() bd.quit()