@@ -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
0 commit comments