Skip to content

Commit

Permalink
One test against multiple browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
ElSnoMan committed Mar 6, 2021
1 parent c0502f4 commit e261a48
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ci/run_lambdatest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ REMOTE_URL="https://$LT_USERNAME:$LT_ACCESS_KEY@hub.lambdatest.com/wd/hub"
# > config settings
# > if/else conditionals
# > and so much more!
FILTER="tests/test_cross_browser.py" # change/override this as needed!
FILTER="tests/test_one_test_against_many_browsers.py" # change/override this as needed!

# 3. Execute the command
python -m pytest $FILTER --remote_url=$REMOTE_URL -n 2
2 changes: 1 addition & 1 deletion pylenium.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"page_load_wait_time": 0,
"options": [],
"capabilities": {
"build": "pytest build 3",
"build": "pytest build 4",
"name": "pytest tutorial",
"platform": "macOS Sierra",
"browserName": "Edge",
Expand Down
31 changes: 31 additions & 0 deletions tests/test_one_test_against_many_browsers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest
from pylenium.driver import Pylenium


def search(py, query):
py.visit('https://google.com')
py.get('[name="q"]').type(query)
py.get('[name="btnK"]').submit()
return py.should().contain_title(query)


browser_targets = [
{
"platform": "Windows 10",
"browserName": "Chrome",
"version": "85",
"resolution": "1280x1024"
},
{
"platform": "Windows 10",
"browserName": "Firefox",
"version": "81",
"resolution": "1280x1024"
}
]


@pytest.mark.parametrize('browser', browser_targets)
def test_google_search(py: Pylenium, browser):
py.config.driver.capabilities.update(browser)
assert search(py, 'puppies')

0 comments on commit e261a48

Please sign in to comment.