Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: chrome/test/chromedriver/run_py_tests.py

Issue 12616009: [chromedriver] Disable testAlert, it is flaky. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """End to end tests for ChromeDriver.""" 6 """End to end tests for ChromeDriver."""
7 7
8 import base64 8 import base64
9 import ctypes 9 import ctypes
10 import optparse 10 import optparse
11 import os 11 import os
12 import sys 12 import sys
13 import time 13 import time
14 import unittest 14 import unittest
15 15
16 import chromedriver 16 import chromedriver
17 import webserver 17 import webserver
18 from webelement import WebElement 18 from webelement import WebElement
19 19
20 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) 20 _THIS_DIR = os.path.abspath(os.path.dirname(__file__))
21 sys.path.insert(0, os.path.join(_THIS_DIR, os.pardir, 'pylib')) 21 sys.path.insert(0, os.path.join(_THIS_DIR, os.pardir, 'pylib'))
22 22
23 _TEST_DATA_DIR = os.path.join(_THIS_DIR, os.pardir, 'data', 'chromedriver') 23 _TEST_DATA_DIR = os.path.join(_THIS_DIR, os.pardir, 'data', 'chromedriver')
24 24
25 from common import chrome_paths 25 from common import chrome_paths
26 from common import unittest_util 26 from common import unittest_util
27 27
28 28
29 def Skip(func):
30 pass
31
32
29 class ChromeDriverBaseTest(unittest.TestCase): 33 class ChromeDriverBaseTest(unittest.TestCase):
30 """Base class for testing chromedriver functionalities.""" 34 """Base class for testing chromedriver functionalities."""
31 35
32 def setUp(self): 36 def setUp(self):
33 self._driver = None 37 self._driver = None
34 38
35 def tearDown(self): 39 def tearDown(self):
36 if self._driver: 40 if self._driver:
37 self._driver.Quit() 41 self._driver.Quit()
38 42
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 'div.style["height"] = "100px";' 340 'div.style["height"] = "100px";'
337 'div.addEventListener("dblclick", function() {' 341 'div.addEventListener("dblclick", function() {'
338 ' var div = document.getElementsByTagName("div")[0];' 342 ' var div = document.getElementsByTagName("div")[0];'
339 ' div.innerHTML="new<br>";' 343 ' div.innerHTML="new<br>";'
340 '});' 344 '});'
341 'return div;') 345 'return div;')
342 self._driver.MouseMoveTo(div, 1, 1) 346 self._driver.MouseMoveTo(div, 1, 1)
343 self._driver.MouseDoubleClick() 347 self._driver.MouseDoubleClick()
344 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br'))) 348 self.assertEquals(1, len(self._driver.FindElements('tag name', 'br')))
345 349
350 # TODO(kkania): This test is flaky since it uses setTimeout.
351 # Re-enable once crbug.com/177511 is fixed and we can remove setTimeout.
352 @Skip
346 def testAlert(self): 353 def testAlert(self):
347 self.assertFalse(self._driver.IsAlertOpen()) 354 self.assertFalse(self._driver.IsAlertOpen())
348 # TODO(kkania): Don't use setTimeout once crbug.com/177511 is fixed.
349 div = self._driver.ExecuteScript( 355 div = self._driver.ExecuteScript(
350 'window.setTimeout(' 356 'window.setTimeout('
351 ' function() { window.confirmed = confirm(\'HI\'); },' 357 ' function() { window.confirmed = confirm(\'HI\'); },'
352 ' 0);') 358 ' 0);')
353 self.assertTrue(self._driver.IsAlertOpen()) 359 self.assertTrue(self._driver.IsAlertOpen())
354 self.assertEquals('HI', self._driver.GetAlertMessage()) 360 self.assertEquals('HI', self._driver.GetAlertMessage())
355 self._driver.HandleAlert(False) 361 self._driver.HandleAlert(False)
356 self.assertFalse(self._driver.IsAlertOpen()) 362 self.assertFalse(self._driver.IsAlertOpen())
357 self.assertEquals(False, 363 self.assertEquals(False,
358 self._driver.ExecuteScript('return window.confirmed')) 364 self._driver.ExecuteScript('return window.confirmed'))
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 global _ANDROID_PACKAGE 429 global _ANDROID_PACKAGE
424 _ANDROID_PACKAGE = options.android_package 430 _ANDROID_PACKAGE = options.android_package
425 431
426 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 432 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
427 sys.modules[__name__]) 433 sys.modules[__name__])
428 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) 434 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
429 ChromeDriverTest.GlobalSetUp() 435 ChromeDriverTest.GlobalSetUp()
430 result = unittest.TextTestRunner(stream=sys.stdout).run(tests) 436 result = unittest.TextTestRunner(stream=sys.stdout).run(tests)
431 ChromeDriverTest.GlobalTearDown() 437 ChromeDriverTest.GlobalTearDown()
432 sys.exit(len(result.failures) + len(result.errors)) 438 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698