Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saucelabs integration #561

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ jobs:
run: pip install tox coveralls requests

- name: Set env
run: echo "USE_SAUCE_LABS=True" >> $GITHUB_ENV
run: |
echo "USE_SAUCE_LABS=True" >> $GITHUB_ENV;
echo "SAUCE_USERNAME=${{secrets.SAUCE_USERNAME}}" >> $GITHUB_ENV;
echo "SAUCE_ACCESS_KEY=${{secrets.SAUCE_ACCESS_KEY}}" >> $GITHUB_ENV;

- name: Run lint
run: tox run -e lint;
Expand All @@ -68,7 +71,7 @@ jobs:
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
run: |
python scripts/upload_ios_app.py;
tox run -e ${{matrix.PY_VER}}-splinter -- --splinter-webdriver=remote --sauce-remote-url=http://${{secrets.SAUCE_USERNAME}}:${{secrets.SAUCE_ACCESS_KEY}}@ondemand.us-west-1.saucelabs.com/wd/hub;
tox run -e ${{matrix.PY_VER}}-splinter -- --splinter-webdriver=remote --sauce-remote-url=https://ondemand.us-west-1.saucelabs.com/wd/hub;
tox run -e ${{matrix.PY_VER}}-appium -- --sauce-remote-url=http://${{secrets.SAUCE_USERNAME}}:${{secrets.SAUCE_ACCESS_KEY}}@ondemand.us-west-1.saucelabs.com/wd/hub;

- name: "Upload coverage to Codecov"
Expand Down
17 changes: 9 additions & 8 deletions tests/splinter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,23 @@ def splinter_driver_kwargs(
github_run_id = os.getenv('GITHUB_RUN_ID')
testrun_name = f"{github_run_id}: {browser_name}"

if os.environ.get('USE_SAUCE_LABS') == "True":
if os.environ.get('USE_SAUCE_LABS') == 'True':
# Sauce Labs settings
current_options.browser_version = version
current_options.platform_name = "Windows 10"
current_options.platform_name = 'Windows 10'

sauce_options = {
"name": testrun_name,
"tunnelIdentifier": "github-action-tunnel",
"seleniumVersion": "4.1.0",
'username': os.environ['SAUCE_USERNAME'],
'accessKey': os.environ['SAUCE_ACCESS_KEY'],
'name': testrun_name,
'tunnelIdentifier': 'github-action-tunnel',
'seleniumVersion': '4.1.0',
}
current_options.set_capability("sauce:options", sauce_options)
current_options.set_capability('sauce:options', sauce_options)

# Weird sauce labs issue
if browser_name == 'chrome':
sauce_options["browserName"] = "chrome"
return {"desired_capabilities": sauce_options}
sauce_options['browserName'] = 'chrome'

return {}

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ commands =
# Tests for splinter implementation
[testenv:{py38, py39, py310, py311}-splinter]
package=wheel
passenv = USE_SAUCE_LABS,GITHUB_RUN_ID
passenv = USE_SAUCE_LABS,GITHUB_RUN_ID,SAUCE_USERNAME,SAUCE_ACCESS_KEY
deps = -rrequirements/tests.txt
commands =
py.test -s -vv -n 4 {posargs} --splinter-remote-name=firefox --cov={envsitepackagesdir}/stere --cov-append tests/splinter
Expand All @@ -40,7 +40,7 @@ commands =
# Tests for appium implementation
[testenv:{py38, py39, py310, py311}-appium]
package=wheel
passenv = USE_SAUCE_LABS,GITHUB_RUN_ID
passenv = USE_SAUCE_LABS,GITHUB_RUN_ID,SAUCE_USERNAME,SAUCE_ACCESS_KEY
deps = -rrequirements/tests.txt
commands =
py.test -s -vv {posargs} --browser-name=ios --cov={envsitepackagesdir}/stere --cov-append tests/appium
Expand Down
Loading