OLD | NEW |
---|---|
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 """Performance tests for Chrome Endure (long-running perf tests on Chrome). | 6 """Performance tests for Chrome Endure (long-running perf tests on Chrome). |
7 | 7 |
8 This module accepts the following environment variable inputs: | 8 This module accepts the following environment variable inputs: |
9 TEST_LENGTH: The number of seconds in which to run each test. | 9 TEST_LENGTH: The number of seconds in which to run each test. |
10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling | 10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
960 | 960 |
961 def testDocsAlternatelyClickLists(self): | 961 def testDocsAlternatelyClickLists(self): |
962 """Alternates between two different document lists. | 962 """Alternates between two different document lists. |
963 | 963 |
964 This test alternately clicks the "Shared with me" and "My Drive" buttons in | 964 This test alternately clicks the "Shared with me" and "My Drive" buttons in |
965 Google Docs, and periodically gathers performance stats that may reveal | 965 Google Docs, and periodically gathers performance stats that may reveal |
966 memory bloat. | 966 memory bloat. |
967 """ | 967 """ |
968 test_description = 'AlternateLists' | 968 test_description = 'AlternateLists' |
969 | 969 |
970 def sort_menu_setup(): | |
971 # Open and close the "Sort" menu to get some DOM nodes to appear that are | |
972 # used by the scenario in this test. | |
973 sort_xpath = '//div[text()="Sort"]' | |
974 self.WaitForDomNode(sort_xpath) | |
975 sort_button = self._GetElement(self._driver.find_element_by_xpath, | |
976 sort_xpath) | |
977 sort_button.click() | |
978 sort_button.click() | |
Nirnimesh
2012/08/02 23:11:34
twice?
dennis_jeffrey
2012/08/02 23:26:55
yes, once to open the sort menu and once to close
| |
979 | |
970 def scenario(): | 980 def scenario(): |
971 # Click the "Shared with me" button, wait for 1 second, click the | 981 # Click the "Shared with me" button, wait for 1 second, click the |
972 # "My Drive" button, wait for 1 second. | 982 # "My Drive" button, wait for 1 second. |
973 | 983 |
974 # Click the "Shared with me" button and wait for a div to appear. | 984 # Click the "Shared with me" button and wait for a div to appear. |
975 if not self._ClickElementByXpath( | 985 if not self._ClickElementByXpath( |
976 self._driver, '//span[starts-with(text(), "Shared with me")]'): | 986 self._driver, '//span[starts-with(text(), "Shared with me")]'): |
977 self._num_errors += 1 | 987 self._num_errors += 1 |
978 self.WaitForDomNode('//div[text()="Share date"]') | 988 try: |
989 self.WaitForDomNode('//div[text()="Share date"]') | |
990 except pyauto_errors.JSONInterfaceError: | |
991 # This case can occur when the page reloads; set things up again. | |
992 sort_menu_setup() | |
979 time.sleep(1) | 993 time.sleep(1) |
980 | 994 |
981 # Click the "My Drive" button and wait for a resulting div to appear. | 995 # Click the "My Drive" button and wait for a resulting div to appear. |
982 if not self._ClickElementByXpath( | 996 if not self._ClickElementByXpath( |
983 self._driver, '//span[starts-with(text(), "My Drive")]'): | 997 self._driver, '//span[starts-with(text(), "My Drive")]'): |
984 self._num_errors += 1 | 998 self._num_errors += 1 |
985 self.WaitForDomNode('//div[text()="Quota used"]') | 999 try: |
1000 self.WaitForDomNode('//div[text()="Quota used"]') | |
1001 except pyauto_errors.JSONInterfaceError: | |
1002 # This case can occur when the page reloads; set things up again. | |
1003 sort_menu_setup() | |
986 time.sleep(1) | 1004 time.sleep(1) |
987 | 1005 |
988 # Open and close the "Sort" menu to get some DOM nodes to appear that are | 1006 sort_menu_setup() |
989 # used by the scenario in this test. | |
990 sort_xpath = '//div[text()="Sort"]' | |
991 self.WaitForDomNode(sort_xpath) | |
992 sort_button = self._GetElement(self._driver.find_element_by_xpath, | |
993 sort_xpath) | |
994 sort_button.click() | |
995 sort_button.click() | |
996 | 1007 |
997 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, | 1008 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, |
998 test_description, scenario) | 1009 test_description, scenario) |
999 | 1010 |
1000 | 1011 |
1001 class ChromeEndurePlusTest(ChromeEndureBaseTest): | 1012 class ChromeEndurePlusTest(ChromeEndureBaseTest): |
1002 """Long-running performance tests for Chrome using Google Plus.""" | 1013 """Long-running performance tests for Chrome using Google Plus.""" |
1003 | 1014 |
1004 _WEBAPP_NAME = 'Plus' | 1015 _WEBAPP_NAME = 'Plus' |
1005 _TAB_TITLE_SUBSTRING = 'Google+' | 1016 _TAB_TITLE_SUBSTRING = 'Google+' |
(...skipping 29 matching lines...) Expand all Loading... | |
1035 # button, wait for 1 second. | 1046 # button, wait for 1 second. |
1036 | 1047 |
1037 # Click the "Friends" button and wait for a resulting div to appear. | 1048 # Click the "Friends" button and wait for a resulting div to appear. |
1038 if not self._ClickElementByXpath( | 1049 if not self._ClickElementByXpath( |
1039 self._driver, | 1050 self._driver, |
1040 '//div[text()="Friends" and ' | 1051 '//div[text()="Friends" and ' |
1041 'starts-with(@data-dest, "stream/circles")]'): | 1052 'starts-with(@data-dest, "stream/circles")]'): |
1042 self._num_errors += 1 | 1053 self._num_errors += 1 |
1043 | 1054 |
1044 try: | 1055 try: |
1045 self.WaitForDomNode('//div[text()="Friends"]') | 1056 self.WaitForDomNode('//span[contains(., "in Friends")]') |
1046 except (pyauto_errors.JSONInterfaceError, | 1057 except (pyauto_errors.JSONInterfaceError, |
1047 pyauto_errors.JavascriptRuntimeError): | 1058 pyauto_errors.JavascriptRuntimeError): |
1048 self._num_errors += 1 | 1059 self._num_errors += 1 |
1049 | 1060 |
1050 time.sleep(1) | 1061 time.sleep(1) |
1051 | 1062 |
1052 # Click the "Family" button and wait for a resulting div to appear. | 1063 # Click the "Family" button and wait for a resulting div to appear. |
1053 if not self._ClickElementByXpath( | 1064 if not self._ClickElementByXpath( |
1054 self._driver, | 1065 self._driver, |
1055 '//div[text()="Family" and ' | 1066 '//div[text()="Family" and ' |
1056 'starts-with(@data-dest, "stream/circles")]'): | 1067 'starts-with(@data-dest, "stream/circles")]'): |
1057 self._num_errors += 1 | 1068 self._num_errors += 1 |
1058 | 1069 |
1059 try: | 1070 try: |
1060 self.WaitForDomNode('//div[text()="Family"]') | 1071 self.WaitForDomNode('//span[contains(., "in Family")]') |
1061 except (pyauto_errors.JSONInterfaceError, | 1072 except (pyauto_errors.JSONInterfaceError, |
1062 pyauto_errors.JavascriptRuntimeError): | 1073 pyauto_errors.JavascriptRuntimeError): |
1063 self._num_errors += 1 | 1074 self._num_errors += 1 |
1064 | 1075 |
1065 time.sleep(1) | 1076 time.sleep(1) |
1066 | 1077 |
1067 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, | 1078 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, |
1068 test_description, scenario) | 1079 test_description, scenario) |
1069 | 1080 |
1070 | 1081 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 self._num_errors += 1 | 1130 self._num_errors += 1 |
1120 | 1131 |
1121 time.sleep(1) | 1132 time.sleep(1) |
1122 | 1133 |
1123 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, | 1134 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, |
1124 test_description, scenario) | 1135 test_description, scenario) |
1125 | 1136 |
1126 | 1137 |
1127 if __name__ == '__main__': | 1138 if __name__ == '__main__': |
1128 pyauto_functional.Main() | 1139 pyauto_functional.Main() |
OLD | NEW |