Skip to content

Commit 346b545

Browse files
committed
Fixing driver creation for web tests in RDC
1 parent d766766 commit 346b545

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

.github/workflows/mobile_web.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ jobs:
88
python-tests:
99
name: Tests
1010
runs-on: ubuntu-latest
11-
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
test: [ best-practice-mobile-web-vdc-us, best-practice-mobile-web-rdc-us]
1215
steps:
1316
- uses: actions/checkout@v4
1417
- name: Setup Python
@@ -23,4 +26,4 @@ jobs:
2326
env:
2427
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
2528
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
26-
run: pipenv run best-practice-mobile-web-vdc-us
29+
run: pipenv run ${{ matrix.test }}

best_practice/conftest.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -174,25 +174,27 @@ def desktop_web_driver(request, data_center):
174174
@pytest.fixture
175175
def rdc_browser(request, data_center):
176176

177-
username_cap = environ['SAUCE_USERNAME']
178-
access_key_cap = environ['SAUCE_ACCESS_KEY']
179-
180-
caps = {
181-
'username': username_cap,
182-
'accessKey': access_key_cap,
183-
'deviceName': 'iPhone.*',
184-
'platformName': 'iOS',
177+
username = environ['SAUCE_USERNAME']
178+
access_key = environ['SAUCE_ACCESS_KEY']
179+
180+
sauce_options = {
181+
'username': username,
182+
'accessKey': access_key,
185183
'build': 'RDC-Android-Web-Python-Best-Practice',
186184
'name': request.node.name,
187-
'browserName': 'Safari'
188185
}
186+
options = XCUITestOptions()
187+
options.set_capability('sauce:options', sauce_options)
188+
options.platform_name = 'iOS'
189+
options.browser_name = 'Safari'
190+
options.device_name = 'iPhone.*'
189191

190192
if data_center and data_center.lower() == 'eu':
191-
sauce_url = 'http://ondemand.eu-central-1.saucelabs.com/wd/hub'
193+
sauce_url = 'https://ondemand.eu-central-1.saucelabs.com/wd/hub'
192194
else:
193-
sauce_url = 'http://ondemand.us-west-1.saucelabs.com/wd/hub'
195+
sauce_url = 'https://ondemand.us-west-1.saucelabs.com/wd/hub'
194196

195-
driver = appiumdriver.Remote(sauce_url, desired_capabilities=caps)
197+
driver = appiumdriver.Remote(sauce_url, options=options)
196198
yield driver
197199
sauce_result = "failed" if request.node.rep_call.failed else "passed"
198200
driver.execute_script("sauce:job-result={}".format(sauce_result))

0 commit comments

Comments
 (0)