Skip to content

Commit 2333c50

Browse files
cleaning up desired caps and updated sauce connect to 4.x
1 parent fb6521d commit 2333c50

7 files changed

Lines changed: 26 additions & 11 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ build/
2020
/doc/
2121
/rdoc/
2222

23+
##Pycharm config
24+
/.idea/
25+
2326
## Environment normalisation:
2427
/.bundle/
2528
/lib/bundler/man/

sample-code/examples/java/junit/src/test/java/com/saucelabs/appium/SauceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void setUp() throws Exception {
7373
capabilities.setCapability("platformVersion", "6.0");
7474
capabilities.setCapability("deviceName", "iPhone Simulator");
7575
capabilities.setCapability("platformName", "iOS");
76-
capabilities.setCapability("appium-version", "1.0.0");
76+
capabilities.setCapability("appiumVersion", "1.2.2");
7777
capabilities.setCapability("app", "http://appium.s3.amazonaws.com/TestApp6.0.app.zip");
7878

7979
driver = new AppiumDriver(new URL(MessageFormat.format("http://{0}:{1}@ondemand.saucelabs.com:80/wd/hub", sauceUserName, sauceAccessKey)),

sample-code/examples/python/android_sauce.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def setUp(self):
2222
self.driver = webdriver.Remote(
2323
command_executor='http://%s:%[email protected]:80/wd/hub' % (SAUCE_USERNAME, SAUCE_ACCESS_KEY),
2424
desired_capabilities={
25-
'appium-version': '1.0.0-beta.2',
25+
'appiumVersion': '1.2.2',
2626
'platformName': 'Android',
2727
'deviceName': 'Android Emulator',
28-
'platformVersion': '4.2',
28+
'platformVersion': '4.4',
2929
'app': app,
3030
'name': 'Appium Python Android Test',
3131
'appPackage': 'com.example.android.notepad',

sample-code/examples/python/ios_sauce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def setUp(self):
2727
self.driver = webdriver.Remote(
2828
command_executor = 'http://%s:%[email protected]:80/wd/hub' % (SAUCE_USERNAME, SAUCE_ACCESS_KEY),
2929
desired_capabilities = {
30-
'appium-version': '1.0.0-beta.2',
30+
'appiumVersion': '1.2.2',
3131
'name': 'Appium Python iOS Test',
3232
'platformName': 'iOS',
3333
'deviceName': 'iPhone Simulator',

sample-code/examples/python/ios_sauce_webview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setUp(self):
3030
self.driver = webdriver.Remote(
3131
command_executor = 'http://%s:%[email protected]:80/wd/hub' % (SAUCE_USERNAME, SAUCE_ACCESS_KEY),
3232
desired_capabilities = {
33-
'appium-version': '1.1.0',
33+
'appiumVersion': '1.2.2',
3434
'name': 'Appium iOS WebView Test',
3535
'platformName': 'iOS',
3636
'deviceName': 'iPhone Simulator',

sample-code/examples/python/sauce_connect.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ def setUpWebServer(self):
6868

6969
def setUpTunnel(self):
7070
# Setting up Sauce Connect tunnel
71-
self.process = subprocess.Popen(["java -jar Sauce-Connect.jar %s %s" % (SAUCE_USERNAME, SAUCE_ACCESS_KEY)], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
71+
# self.process = subprocess.Popen(["java -jar Sauce-Connect.jar %s %s" % (SAUCE_USERNAME, SAUCE_ACCESS_KEY)],
72+
# shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
73+
self.process = subprocess.Popen(['./sc/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY'],
74+
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
7275
p = self.process
7376
print "[Sauce Connect]: Waiting for tunnel setup, this make take up to 30s"
77+
print "For detailed documentation on Sauce Connect please refer to " \
78+
"http://https://docs.saucelabs.com/reference/sauce-connect/"
7479
is_ready = False
7580
while True:
7681
reads = [p.stdout.fileno(), p.stderr.fileno()]
@@ -81,15 +86,16 @@ def setUpTunnel(self):
8186
read = p.stdout.readline()
8287
sys.stdout.write("[Sauce Connect]: %s" % read)
8388

84-
if "Connected! You may start your tests." in read:
89+
#if "Connected! You may start your tests." in read:
90+
if "Sauce Connect is up, you may start your tests." in read:
8591
print "[Sauce Connect]: Tunnel ready, running the test"
8692
is_ready = True
8793
break
8894

8995
if fd == p.stderr.fileno():
9096
read = p.stderr.readline()
9197
sys.stderr.write("[Sauce Connect]: %s" % read)
92-
if "Unable to access jarfile" in read:
98+
if "Finished! Deleting tunnel." in read:
9399
self.process.terminate()
94100
raise Exception("Sauce Connect could not start!")
95101

@@ -100,13 +106,13 @@ def setUp(self):
100106
self.setUpWebServer()
101107
self.setUpTunnel()
102108

103-
desired_capabilities={
109+
desired_capabilities = {
104110
'platformName': 'iOS',
105111
'platformVersion': '7.1',
106112
'deviceName': 'iPhone Simulator',
107113
'browserName': 'safari',
108114
'appiumVersion': '1.2.2',
109-
'name': 'Appium Python iOS Test (Connect)'
115+
'name': 'Appium Python iOS Test (Sauce Connect)'
110116
}
111117

112118
self.driver = webdriver.Remote(
@@ -117,7 +123,7 @@ def setUp(self):
117123

118124
def test_basic(self):
119125
driver = self.driver
120-
driver.get("http://127.0.0.1:9999/")
126+
driver.get("http://localhost:9999/")
121127
body = self.driver.find_element_by_tag_name("body")
122128
self.assertTrue("Welcome to the flipside!" in body.text)
123129

sample-code/examples/python/sub.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import subprocess
2+
3+
p1 = subprocess.Popen(['./sc/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -i AppiumTest'],
4+
shell=True, stdout=subprocess.PIPE)
5+
6+
print p1.stdout.readlines()

0 commit comments

Comments
 (0)