set the driver to headless, and add different tests for chrome and firefox
This commit is contained in:
parent
77dc32f142
commit
fc4cd7107c
@ -7,6 +7,6 @@ logging-level=ERROR
|
||||
|
||||
[behave.userdata]
|
||||
browser = chrome
|
||||
headless = True
|
||||
name = gmgauthier@protonmail.com
|
||||
platform = OSX
|
||||
|
||||
|
@ -22,6 +22,7 @@ class BrowserDriver:
|
||||
|
||||
def chrome():
|
||||
options = webdriver.ChromeOptions()
|
||||
options.headless = True
|
||||
options.add_argument('--ignore-certificate-errors')
|
||||
return webdriver.Chrome(ChromeDriverManager().install(), options=options)
|
||||
|
||||
@ -29,6 +30,7 @@ def chrome():
|
||||
def firefox():
|
||||
options = webdriver.FirefoxOptions()
|
||||
options.accept_insecure_certs = True
|
||||
options.headless = True
|
||||
gecko_driver = GeckoDriverManager().install()
|
||||
return webdriver.Firefox(executable_path=gecko_driver, firefox_options=options)
|
||||
|
||||
|
@ -12,7 +12,7 @@ def pytest_addoption(parser):
|
||||
action='store',
|
||||
default='staging',
|
||||
help='the name of the environment for which you need properties.')
|
||||
parser.addoption('--fixtures',
|
||||
parser.addoption('--fixture',
|
||||
action='store',
|
||||
default='default',
|
||||
help='the name of the environment for which you need fixture accounts.')
|
||||
@ -32,8 +32,8 @@ def fixture_data(pytestconfig):
|
||||
"""
|
||||
The fixture data items for the account under test
|
||||
"""
|
||||
env = pytestconfig.getoption("env")
|
||||
return _read_config_section(fixtures, env)
|
||||
#env = pytestconfig.getoption("env")
|
||||
return _read_config_section(fixtures, "env")
|
||||
|
||||
|
||||
def _read_config_section(source, section):
|
||||
|
@ -1,5 +1,10 @@
|
||||
Feature: Browser Demo
|
||||
Scenario: Load test.io web page
|
||||
Scenario: Load test.io web page with chrome
|
||||
Given I have a chrome driver
|
||||
When I navigate to test.io
|
||||
Then The page is displayed
|
||||
|
||||
Scenario: Load test.io web page with firefox
|
||||
Given I have a firefox driver
|
||||
When I navigate to test.io
|
||||
Then The page is displayed
|
@ -3,6 +3,11 @@ from behave import then, when, given
|
||||
from browserdriver import BrowserDriver
|
||||
|
||||
|
||||
@given('I have a firefox driver')
|
||||
def step_impl(context):
|
||||
context.driver = BrowserDriver.get("firefox")
|
||||
|
||||
|
||||
@given('I have a chrome driver')
|
||||
def step_impl(context):
|
||||
context.driver = BrowserDriver.get("chrome")
|
||||
@ -13,6 +18,7 @@ def step_impl(context):
|
||||
context.driver.get("https://test.io")
|
||||
print(context.driver.title)
|
||||
|
||||
|
||||
@then('The page is displayed')
|
||||
def step_impl(context):
|
||||
assert context.driver.title == "QA Testing as a Service | test IO"
|
||||
|
Loading…
Reference in New Issue
Block a user