Index: tools/testing/runSelenium.py |
=================================================================== |
--- tools/testing/runSelenium.py (revision 0) |
+++ tools/testing/runSelenium.py (revision 0) |
@@ -0,0 +1,38 @@ |
+#!/usr/bin/python |
Siggi Cherem (dart-lang)
2011/11/10 23:04:37
a few nits:
- add license
- rename the file to fit
|
+ |
+from selenium import webdriver |
+import sys |
+ |
+browser = webdriver.Firefox() # Get local session of firefox |
+firefox_source = runTestInBrowser(browser) |
+ |
+# Note: you need ChromeDriver in your path to run chrome, in addition to |
+#installing Chrome. |
+# TODO(efortuna): Currently disabled for ease of setup for running on other |
+# developer machines. Uncomment when frog is robust enough to be tested on |
+# multiple platforms at once. |
+#browser = webdriver.Chrome() |
+#chrome_source = runTestInBrowser(browser) |
+ |
+ie_source = '' |
+if platform.system() == 'Windows': |
+ browser = webdriver.Ie() |
+ ie_source = runTestInBrowser(browser) |
+ |
+def runTestInBrowser(browser): |
+ browser.get("file://" + sys.argv[1]) |
+ element = webdriver.support.ui.WebDriverWait(browser, 10).until( \ |
+ lambda driver : ('PASS' in driver.page_source) or \ |
+ ('FAIL' in driver.page_source)) |
+ source = browser.page_source |
+ browser.close() |
+ return source |
+ |
+ |
+#TODO(efortuna): Test if all three return correct responses. If not, throw error |
+# particular to that browser. |
+if ('PASS' in firefox_source): |
+ print 'Content-Type: text/plain\nPASS' |
+else: |
+ print firefox_source |
+ |
Property changes on: tools/testing/runSelenium.py |
___________________________________________________________________ |
Added: svn:executable |
+ * |