87b9e83041
Do not, I repeat, DO NOT enable these to run by default on the buildbot yet (Currently they do not run by default). I am checking this in in its raw state so that my fellow frog developers can start making fixes to frog for running in other browsers. You can run these test by running: Install WebDriver stuff by following these instructions: http://code.google.com/p/selenium/wiki/PythonBindings Then start the server: java -jar selenium-server-standalone-2.11.0.jar -browserSessionReuse ../tools/test.py --component=webdriver --report --timeout=10 --progress=color --mode=release language Frog generates code that fails in Firefox, but passes in Chrome (for example). We need to fix this eventually, but it shouldn't cause our entire tree to turn red. Note also that to run selenium, you will need to install the selenium python library, and ChromeDriver. Review URL: http://codereview.chromium.org//8469016 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1436 260f80e4-7a28-3924-810f-c04153c831b5
58 lines
1.7 KiB
Python
Executable File
58 lines
1.7 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
#
|
|
|
|
"""Script to actually open browsers and perform the test, and reports back with
|
|
the result"""
|
|
|
|
import platform
|
|
import selenium
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
import sys
|
|
|
|
|
|
def runTestInBrowser(browser):
|
|
browser.get("file://" + sys.argv[1])
|
|
element = 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
|
|
|
|
def Main():
|
|
browser = selenium.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 = selenium.webdriver.Chrome()
|
|
#chrome_source = runTestInBrowser(browser)
|
|
|
|
ie_source = ''
|
|
if platform.system() == 'Windows':
|
|
browser = selenium.webdriver.Ie()
|
|
ie_source = runTestInBrowser(browser)
|
|
|
|
#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'
|
|
return 0
|
|
else:
|
|
index = firefox_source.find('<body>')
|
|
index += len('<body>')
|
|
end_index = firefox_source.find('<script')
|
|
print firefox_source[index : end_index]
|
|
return 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(Main())
|