Permalink
Browse files

Cleaned up command-line messages

  • Loading branch information...
1 parent b99b22b commit 1f418e0c719299cf2fdb864fe3638e4e77b8d50e @eromba committed Oct 13, 2011
Showing with 13 additions and 11 deletions.
  1. +13 −11 jtd-android-init.py
View
@@ -108,23 +108,24 @@ def AndroidBrowserIsCaptured():
try:
print("Detecting JsTestDriver server on port " + JTD_PORT + "...")
f = openUrl("http://localhost:" + JTD_PORT)
- print("JsTestDriver server already running\n")
+ print("Server detected")
newServerInstance = False
except (urlError):
- print("JsTestDriver not detected\nStarting JsTestDriver server...\n")
+ print("Server not detected\nStarting JsTestDriver server...")
newServerInstance = True
if os.name == 'nt':
subprocess.Popen(["cmd", "/c", "start", "java", "-jar", JTD_PATH, "--port", JTD_PORT])
else:
subprocess.Popen(["xterm", "-e", "java", "-jar", JTD_PATH, "--port", JTD_PORT])
+ print("JsTestDriver started")
#
# Launch the given Android emulator if it is not already running
#
-print("Detecting Android emulator...")
+print("\nDetecting Android emulator...")
adbProc = subprocess.Popen([ADB_PATH, "devices"], stdout=subprocess.PIPE)
@@ -133,30 +134,29 @@ def AndroidBrowserIsCaptured():
if output.find("emulator") == -1:
- print("Android emulator not detected")
+ print("Emulator not detected")
# If we are starting a new emulator instance but have an existing server instance,
# we must restart the server in order to flush any previously-captured browsers.
if not newServerInstance:
print("\nPlease close JsTestDriver to flush any existing captured browsers.")
sys.exit(1)
- print("Starting emulator...\n")
+ print("Starting emulator...")
newEmulatorInstance = True
emulatorProc = subprocess.Popen([EMULATOR_PATH, "-avd", AVD_NAME], stdout=subprocess.PIPE)
+ print("Emulator started\n")
else:
- print("Emulator already running\n")
+ print("Emulator detected\n")
# If the emulator's browser is NOT already captured, we treat this as a new
# emulator instance.
print
if AndroidBrowserIsCaptured():
- print("Android browser already captured")
newEmulatorInstance = False
else:
- print("Android browser not yet captured")
newEmulatorInstance = True
# If we are starting a new server instance but have an existing emulator
@@ -193,16 +193,18 @@ def AndroidBrowserIsCaptured():
# We check the server's status page every second until it reports that there
# is at least 1 captured Android browser.
if newEmulatorInstance:
- print("Capturing browser...")
+ print("Capturing Android browser...")
while not AndroidBrowserIsCaptured():
time.sleep(1)
- print("Browser captured!")
+ print("Browser captured")
+else:
+ print("Browser already captured")
# If the browser is newly-captured, we must wait for the JavaScript on the
# JsTestDriver page to initialize.
if newServerInstance or newEmulatorInstance:
print("Waiting " + DELAY + " seconds for the browser to finish loading...")
time.sleep(float(DELAY))
-print("\nReady for testing!")
+print("\nInitialization complete")

0 comments on commit 1f418e0

Please sign in to comment.