diff options
author | Ke Zou <ke.zou@windriver.com> | 2015-11-04 14:32:22 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-11-16 11:55:08 +0000 |
commit | 70465c717a4a9a8bd7407554d086d035eb6af6d4 (patch) | |
tree | f53cc6814d5a1ba7919f4208d0f139b251115bbb /bitbake | |
parent | 536b73f55f51fcea555338f9a557fe86c09d00cb (diff) | |
download | poky-70465c717a4a9a8bd7407554d086d035eb6af6d4.tar.gz |
bitbake: toaster: tests: Re-write some cases to make them more maintainable
(Bitbake rev: c3c7e94cadb3a3a2d8ef33ed456f439c106018c1)
Signed-off-by: Ke Zou <ke.zou@windriver.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py | 312 |
1 files changed, 89 insertions, 223 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py index eac167b2e5..8be9ce236d 100755 --- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py +++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py | |||
@@ -787,8 +787,6 @@ class toaster_cases(toaster_cases_base): | |||
787 | self.driver.get(self.base_url) | 787 | self.driver.get(self.base_url) |
788 | self.driver.find_element_by_partial_link_text("core-image").click() | 788 | self.driver.find_element_by_partial_link_text("core-image").click() |
789 | self.driver.find_element_by_link_text("Tasks").click() | 789 | self.driver.find_element_by_link_text("Tasks").click() |
790 | # self.driver.find_element_by_link_text("All builds").click() | ||
791 | # self.driver.back() | ||
792 | self.table_name = 'otable' | 790 | self.table_name = 'otable' |
793 | # This is how we find the "default" rows-number! | 791 | # This is how we find the "default" rows-number! |
794 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) | 792 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) |
@@ -821,14 +819,14 @@ class toaster_cases(toaster_cases_base): | |||
821 | 'Outcome':'outcome', 'Cache attempt':'cache_attempt', 'Time (secs)':'time_taken', 'CPU usage':'cpu_used', \ | 819 | 'Outcome':'outcome', 'Cache attempt':'cache_attempt', 'Time (secs)':'time_taken', 'CPU usage':'cpu_used', \ |
822 | 'Disk I/O (ms)':'disk_io'} | 820 | 'Disk I/O (ms)':'disk_io'} |
823 | for key in table_head_dict: | 821 | for key in table_head_dict: |
824 | # This is tricky here: we are doing so because there may be more than 1 | 822 | # This is tricky here: we are doing so because there may be more than 1 |
825 | # same-name link_text in one page. So we only find element inside the table | 823 | # same-name link_text in one page. So we only find element inside the table |
826 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 824 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
827 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 825 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
828 | # after 1st click, the list should be either sequenced or inverted, but we don't have a "default order" here | 826 | # after 1st click, the list should be either sequenced or inverted, but we don't have a "default order" here |
829 | # the point is, after another click, it should be another order | 827 | # the point is, after another click, it should be another order |
830 | # the first case is special:this means every item in column_list is the same, so | 828 | # the first case is special:this means every item in column_list is the same, so |
831 | # after one click, either sequenced or inverted will be fine | 829 | # after one click, either sequenced or inverted will be fine |
832 | if (is_list_inverted(column_list) and is_list_sequenced(column_list)) \ | 830 | if (is_list_inverted(column_list) and is_list_sequenced(column_list)) \ |
833 | or (not column_list) : | 831 | or (not column_list) : |
834 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 832 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
@@ -844,7 +842,7 @@ class toaster_cases(toaster_cases_base): | |||
844 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 842 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
845 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 843 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
846 | self.assertTrue(is_list_inverted(column_list), msg=("%s column not inverted" % key)) | 844 | self.assertTrue(is_list_inverted(column_list), msg=("%s column not inverted" % key)) |
847 | # step 8-10 | 845 | # step 8-10 |
848 | # filter dict: {link text name : filter table name in xpath} | 846 | # filter dict: {link text name : filter table name in xpath} |
849 | filter_dict = {'Executed':'filter_executed', 'Outcome':'filter_outcome', 'Cache attempt':'filter_cache_attempt'} | 847 | filter_dict = {'Executed':'filter_executed', 'Outcome':'filter_outcome', 'Cache attempt':'filter_cache_attempt'} |
850 | for key in filter_dict: | 848 | for key in filter_dict: |
@@ -868,7 +866,7 @@ class toaster_cases(toaster_cases_base): | |||
868 | temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click() | 866 | temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click() |
869 | avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]") | 867 | avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]") |
870 | self.browser_delay() | 868 | self.browser_delay() |
871 | # step 11 | 869 | # step 11 |
872 | for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']: | 870 | for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']: |
873 | try: | 871 | try: |
874 | self.find_element_by_xpath_in_table(self.table_name, "./tbody/tr[1]/*[@class='" + item + "']/a").click() | 872 | self.find_element_by_xpath_in_table(self.table_name, "./tbody/tr[1]/*[@class='" + item + "']/a").click() |
@@ -878,7 +876,7 @@ class toaster_cases(toaster_cases_base): | |||
878 | # insert screen shot here | 876 | # insert screen shot here |
879 | self.save_screenshot(screenshot_type='selenium', append_name='step11') | 877 | self.save_screenshot(screenshot_type='selenium', append_name='step11') |
880 | self.driver.back() | 878 | self.driver.back() |
881 | # step 12-14 | 879 | # step 12-14 |
882 | # about test_dict: please refer to testcase 904 requirement step 12-14 | 880 | # about test_dict: please refer to testcase 904 requirement step 12-14 |
883 | test_dict = { | 881 | test_dict = { |
884 | 'Time':{ | 882 | 'Time':{ |
@@ -926,14 +924,14 @@ class toaster_cases(toaster_cases_base): | |||
926 | # find "bash" in first column (Packages) | 924 | # find "bash" in first column (Packages) |
927 | self.driver.find_element_by_xpath("//*[@id='otable']//td[1]//*[text()='bash']").click() | 925 | self.driver.find_element_by_xpath("//*[@id='otable']//td[1]//*[text()='bash']").click() |
928 | # save sceen here to observe... | 926 | # save sceen here to observe... |
929 | # step 6 | 927 | # step 6 |
930 | self.driver.find_element_by_partial_link_text("Generated files").click() | 928 | self.driver.find_element_by_partial_link_text("Generated files").click() |
931 | head_list = self.get_table_head_text('otable') | 929 | head_list = self.get_table_head_text('otable') |
932 | for item in ['File', 'Size']: | 930 | for item in ['File', 'Size']: |
933 | self.assertTrue(item in head_list, msg=("%s not in head row" % item)) | 931 | self.assertTrue(item in head_list, msg=("%s not in head row" % item)) |
934 | c_list = self.get_table_column_text('class', 'path') | 932 | c_list = self.get_table_column_text('class', 'path') |
935 | self.assertTrue(is_list_sequenced(c_list), msg=("column not in order")) | 933 | self.assertTrue(is_list_sequenced(c_list), msg=("column not in order")) |
936 | # step 7 | 934 | # step 7 |
937 | self.driver.find_element_by_partial_link_text("Runtime dependencies").click() | 935 | self.driver.find_element_by_partial_link_text("Runtime dependencies").click() |
938 | # save sceen here to observe... | 936 | # save sceen here to observe... |
939 | # note that here table name is not 'otable' | 937 | # note that here table name is not 'otable' |
@@ -1049,7 +1047,7 @@ class toaster_cases(toaster_cases_base): | |||
1049 | self.assertTrue(is_list_sequenced(column_search_list)) | 1047 | self.assertTrue(is_list_sequenced(column_search_list)) |
1050 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1048 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
1051 | else: | 1049 | else: |
1052 | self.assertTrue(is_list_sequenced(column_list)) | 1050 | self.assertTrue(is_list_sequenced(column_list), msg=("list %s not sequenced" % key)) |
1053 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 1051 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
1054 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 1052 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
1055 | self.assertTrue(is_list_inverted(column_list)) | 1053 | self.assertTrue(is_list_inverted(column_list)) |
@@ -1102,20 +1100,19 @@ class toaster_cases(toaster_cases_base): | |||
1102 | self.driver.get(self.base_url) | 1100 | self.driver.get(self.base_url) |
1103 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1101 | self.driver.find_element_by_link_text("core-image-minimal").click() |
1104 | self.find_element_by_link_text_in_table('nav', 'Recipes').click() | 1102 | self.find_element_by_link_text_in_table('nav', 'Recipes').click() |
1105 | # step 3-5 | 1103 | # step 3-5 |
1106 | self.driver.find_element_by_id("search").clear() | 1104 | self.driver.find_element_by_id("search").clear() |
1107 | self.driver.find_element_by_id("search").send_keys("lib") | 1105 | self.driver.find_element_by_id("search").send_keys("lib") |
1108 | self.driver.find_element_by_id("search-button").click() | 1106 | self.driver.find_element_by_id("search-button").click() |
1109 | # save screen here for observation | 1107 | # save screen here for observation |
1110 | self.save_screenshot(screenshot_type='selenium', append_name='step5') | 1108 | self.save_screenshot(screenshot_type='selenium', append_name='step5') |
1111 | # step 6 | 1109 | # step 6 |
1112 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1110 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
1113 | self.driver.find_element_by_id("search").clear() | 1111 | self.driver.find_element_by_id("search").clear() |
1114 | # we deliberately want "no result" here | 1112 | # we deliberately want "no result" here |
1115 | self.driver.find_element_by_id("search").send_keys("no such input") | 1113 | self.driver.find_element_by_id("search").send_keys("no such input") |
1116 | self.driver.find_element_by_id("search-button").click() | 1114 | self.driver.find_element_by_id("search-button").click() |
1117 | self.find_element_by_text("Show all recipes").click() | 1115 | self.find_element_by_text("Show all recipes").click() |
1118 | self.driver.quit() | ||
1119 | 1116 | ||
1120 | 1117 | ||
1121 | ############## | 1118 | ############## |
@@ -1124,7 +1121,6 @@ class toaster_cases(toaster_cases_base): | |||
1124 | def test_912(self): | 1121 | def test_912(self): |
1125 | self.case_no = self.get_case_number() | 1122 | self.case_no = self.get_case_number() |
1126 | self.log.info(' CASE %s log: ' % str(self.case_no)) | 1123 | self.log.info(' CASE %s log: ' % str(self.case_no)) |
1127 | self.driver = self.setup_browser(self) | ||
1128 | self.driver.maximize_window() | 1124 | self.driver.maximize_window() |
1129 | self.driver.get(self.base_url) | 1125 | self.driver.get(self.base_url) |
1130 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1126 | self.driver.find_element_by_link_text("core-image-minimal").click() |
@@ -1187,179 +1183,42 @@ class toaster_cases(toaster_cases_base): | |||
1187 | def test_914(self): | 1183 | def test_914(self): |
1188 | self.case_no = self.get_case_number() | 1184 | self.case_no = self.get_case_number() |
1189 | self.log.info(' CASE %s log: ' % str(self.case_no)) | 1185 | self.log.info(' CASE %s log: ' % str(self.case_no)) |
1190 | image_type="core-image-minimal" | 1186 | self.driver.maximize_window() |
1191 | test_package1="busybox" | 1187 | self.driver.get(self.base_url) |
1192 | test_package2="gdbm" | 1188 | self.find_element_by_link_text_in_table('otable', "core-image-minimal").click() |
1193 | test_package3="gettext-native" | 1189 | self.find_element_by_link_text_in_table('nav', 'Recipes').click() |
1194 | driver = self.driver | 1190 | # step 4 |
1195 | driver.maximize_window() | 1191 | self.find_element_by_link_text_in_table('otable', "busybox").click() |
1196 | driver.get(self.base_url) | 1192 | # this step needs some observation here |
1197 | driver.find_element_by_link_text(image_type).click() | 1193 | self.save_screenshot(screenshot_type='selenium', append_name='step4') |
1198 | driver.find_element_by_link_text("Recipes").click() | 1194 | # step 5 |
1199 | driver.find_element_by_link_text(test_package1).click() | 1195 | self.driver.find_element_by_partial_link_text('Packages (').click() |
1200 | 1196 | head_list = self.get_table_head_text('otable') | |
1201 | self.table_name = 'information' | 1197 | head_checklist = ['Version', 'Size'] |
1202 | 1198 | for item in head_checklist: | |
1203 | tasks_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[1]/table/tbody/tr/td[1]")) | 1199 | self.assertTrue(item in head_list, msg=("%s should be in head list" % item)) |
1204 | tasks_column_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[1]/table/tbody/tr[1]/td")) | 1200 | # step 6 |
1205 | print tasks_row_count | 1201 | self.driver.find_element_by_partial_link_text('Build dependencies (').click() |
1206 | print tasks_column_count | 1202 | # the dependencies number may vary(even 0), so screenshot here |
1207 | 1203 | self.save_screenshot(screenshot_type='selenium', append_name='step6') | |
1208 | Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) | 1204 | self.driver.find_element_by_partial_link_text('Reverse build dependencies (').click() |
1209 | print ("Tasks_column=", Tasks_column) | 1205 | self.save_screenshot(screenshot_type='selenium', append_name='step7') |
1210 | 1206 | # step 8 | |
1211 | key_tasks=["do_fetch", "do_unpack", "do_patch", "do_configure", "do_compile", "do_install", "do_package", "do_build"] | 1207 | self.find_element_by_link_text_in_table('breadcrumb', "Recipes").click() |
1212 | i = 0 | 1208 | # in case that gdbm doesn't appear on the first page, we use "search" |
1213 | while i < len(key_tasks): | 1209 | self.driver.find_element_by_id("search").clear() |
1214 | if key_tasks[i] not in Tasks_column: | 1210 | self.driver.find_element_by_id("search").send_keys("gdbm") |
1215 | print ("Error! Missing key task: %s" % key_tasks[i]) | 1211 | self.driver.find_element_by_id("search-button").click() |
1216 | else: | 1212 | self.driver.find_element_by_link_text("gdbm").click() |
1217 | print ("%s is in tasks" % key_tasks[i]) | 1213 | # step 9 |
1218 | i = i + 1 | 1214 | self.driver.find_element_by_partial_link_text('Packages (').click() |
1219 | 1215 | # below are different from the contents described in testcase web | |
1220 | if Tasks_column.index(key_tasks[0]) != 0: | 1216 | # page, so .. screenshot again |
1221 | print ("Error! %s is not in the right position" % key_tasks[0]) | 1217 | self.save_screenshot(screenshot_type='selenium', append_name='step9') |
1222 | else: | 1218 | self.driver.find_element_by_partial_link_text('Build dependencies (').click() |
1223 | print ("%s is in right position" % key_tasks[0]) | 1219 | self.save_screenshot(screenshot_type='selenium', append_name='step10') |
1224 | 1220 | self.driver.find_element_by_partial_link_text('Reverse build dependencies (').click() | |
1225 | if Tasks_column[-1] != key_tasks[-1]: | 1221 | self.save_screenshot(screenshot_type='selenium', append_name='step11') |
1226 | print ("Error! %s is not in the right position" % key_tasks[-1]) | ||
1227 | else: | ||
1228 | print ("%s is in right position" % key_tasks[-1]) | ||
1229 | |||
1230 | driver.find_element_by_partial_link_text("Packages (").click() | ||
1231 | packages_name = driver.find_element_by_partial_link_text("Packages (").text | ||
1232 | print packages_name | ||
1233 | packages_num = string.atoi(filter(str.isdigit, repr(packages_name))) | ||
1234 | print packages_num | ||
1235 | |||
1236 | packages_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[2]/table/tbody/tr/td[1]")) | ||
1237 | print packages_row_count | ||
1238 | |||
1239 | if packages_num != packages_row_count: | ||
1240 | print ("Error! The packages number is not correct") | ||
1241 | else: | ||
1242 | print ("The pakcages number is correct") | ||
1243 | |||
1244 | driver.find_element_by_partial_link_text("Build dependencies (").click() | ||
1245 | depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text | ||
1246 | print depends_name | ||
1247 | depends_num = string.atoi(filter(str.isdigit, repr(depends_name))) | ||
1248 | print depends_num | ||
1249 | |||
1250 | if depends_num == 0: | ||
1251 | depends_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text) | ||
1252 | print depends_message | ||
1253 | if depends_message.find("has no build dependencies.") < 0: | ||
1254 | print ("Error! The message isn't expected.") | ||
1255 | else: | ||
1256 | print ("The message is expected") | ||
1257 | else: | ||
1258 | depends_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[3]/table/tbody/tr/td[1]")) | ||
1259 | print depends_row_count | ||
1260 | if depends_num != depends_row_count: | ||
1261 | print ("Error! The dependent packages number is not correct") | ||
1262 | else: | ||
1263 | print ("The dependent packages number is correct") | ||
1264 | |||
1265 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() | ||
1266 | rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text | ||
1267 | print rdepends_name | ||
1268 | rdepends_num = string.atoi(filter(str.isdigit, repr(rdepends_name))) | ||
1269 | print rdepends_num | ||
1270 | |||
1271 | if rdepends_num == 0: | ||
1272 | rdepends_message = repr(driver.find_element_by_css_selector("#brought-in-by > div.alert.alert-info").text) | ||
1273 | print rdepends_message | ||
1274 | if rdepends_message.find("has no reverse build dependencies.") < 0: | ||
1275 | print ("Error! The message isn't expected.") | ||
1276 | else: | ||
1277 | print ("The message is expected") | ||
1278 | else: | ||
1279 | print ("The reverse dependent packages number is correct") | ||
1280 | |||
1281 | driver.find_element_by_link_text("Recipes").click() | ||
1282 | driver.find_element_by_link_text(test_package2).click() | ||
1283 | driver.find_element_by_partial_link_text("Packages (").click() | ||
1284 | driver.find_element_by_partial_link_text("Build dependencies (").click() | ||
1285 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() | ||
1286 | |||
1287 | |||
1288 | driver.find_element_by_link_text("Recipes").click() | ||
1289 | driver.find_element_by_link_text(test_package3).click() | ||
1290 | |||
1291 | native_tasks_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[1]/table/tbody/tr/td[1]")) | ||
1292 | native_tasks_column_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[1]/table/tbody/tr[1]/td")) | ||
1293 | print native_tasks_row_count | ||
1294 | print native_tasks_column_count | ||
1295 | |||
1296 | Native_Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) | ||
1297 | print ("Native_Tasks_column=", Native_Tasks_column) | ||
1298 | |||
1299 | native_key_tasks=["do_fetch", "do_unpack", "do_patch", "do_configure", "do_compile", "do_install", "do_build"] | ||
1300 | i = 0 | ||
1301 | while i < len(native_key_tasks): | ||
1302 | if native_key_tasks[i] not in Native_Tasks_column: | ||
1303 | print ("Error! Missing key task: %s" % native_key_tasks[i]) | ||
1304 | else: | ||
1305 | print ("%s is in tasks" % native_key_tasks[i]) | ||
1306 | i = i + 1 | ||
1307 | |||
1308 | if Native_Tasks_column.index(native_key_tasks[0]) != 0: | ||
1309 | print ("Error! %s is not in the right position" % native_key_tasks[0]) | ||
1310 | else: | ||
1311 | print ("%s is in right position" % native_key_tasks[0]) | ||
1312 | |||
1313 | if Native_Tasks_column[-1] != native_key_tasks[-1]: | ||
1314 | print ("Error! %s is not in the right position" % native_key_tasks[-1]) | ||
1315 | else: | ||
1316 | print ("%s is in right position" % native_key_tasks[-1]) | ||
1317 | |||
1318 | driver.find_element_by_partial_link_text("Packages (").click() | ||
1319 | native_packages_name = driver.find_element_by_partial_link_text("Packages (").text | ||
1320 | print native_packages_name | ||
1321 | native_packages_num = string.atoi(filter(str.isdigit, repr(native_packages_name))) | ||
1322 | print native_packages_num | ||
1323 | |||
1324 | if native_packages_num != 0: | ||
1325 | print ("Error! Native task shouldn't have any packages.") | ||
1326 | else: | ||
1327 | native_package_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text) | ||
1328 | print native_package_message | ||
1329 | if native_package_message.find("does not build any packages.") < 0: | ||
1330 | print ("Error! The message for native task isn't expected.") | ||
1331 | else: | ||
1332 | print ("The message for native task is expected.") | ||
1333 | |||
1334 | driver.find_element_by_partial_link_text("Build dependencies (").click() | ||
1335 | native_depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text | ||
1336 | print native_depends_name | ||
1337 | native_depends_num = string.atoi(filter(str.isdigit, repr(native_depends_name))) | ||
1338 | print native_depends_num | ||
1339 | |||
1340 | native_depends_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[3]/table/tbody/tr/td[1]")) | ||
1341 | print native_depends_row_count | ||
1342 | |||
1343 | if native_depends_num != native_depends_row_count: | ||
1344 | print ("Error! The dependent packages number is not correct") | ||
1345 | else: | ||
1346 | print ("The dependent packages number is correct") | ||
1347 | |||
1348 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() | ||
1349 | native_rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text | ||
1350 | print native_rdepends_name | ||
1351 | native_rdepends_num = string.atoi(filter(str.isdigit, repr(native_rdepends_name))) | ||
1352 | print native_rdepends_num | ||
1353 | |||
1354 | native_rdepends_row_count = len(driver.find_elements_by_xpath("/html/body/div[2]/div/div[3]/div/div[4]/table/tbody/tr/td[1]")) | ||
1355 | print native_rdepends_row_count | ||
1356 | |||
1357 | if native_rdepends_num != native_rdepends_row_count: | ||
1358 | print ("Error! The reverse dependent packages number is not correct") | ||
1359 | else: | ||
1360 | print ("The reverse dependent packages number is correct") | ||
1361 | |||
1362 | driver.find_element_by_link_text("Recipes").click() | ||
1363 | 1222 | ||
1364 | 1223 | ||
1365 | ############## | 1224 | ############## |
@@ -1371,24 +1230,24 @@ class toaster_cases(toaster_cases_base): | |||
1371 | self.driver.maximize_window() | 1230 | self.driver.maximize_window() |
1372 | self.driver.get(self.base_url) | 1231 | self.driver.get(self.base_url) |
1373 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1232 | self.driver.find_element_by_link_text("core-image-minimal").click() |
1374 | # step 3 | 1233 | # step 3 |
1375 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() | 1234 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() |
1376 | self.driver.find_element_by_link_text("BitBake variables").click() | 1235 | self.driver.find_element_by_link_text("BitBake variables").click() |
1377 | # step 4 | 1236 | # step 4 |
1378 | self.driver.find_element_by_id("search").clear() | 1237 | self.driver.find_element_by_id("search").clear() |
1379 | self.driver.find_element_by_id("search").send_keys("lib") | 1238 | self.driver.find_element_by_id("search").send_keys("lib") |
1380 | self.driver.find_element_by_id("search-button").click() | 1239 | self.driver.find_element_by_id("search-button").click() |
1381 | # save screen to see result | 1240 | # save screen to see result |
1382 | self.browser_delay() | 1241 | self.browser_delay() |
1383 | self.save_screenshot(screenshot_type='selenium', append_name='step4') | 1242 | self.save_screenshot(screenshot_type='selenium', append_name='step4') |
1384 | # step 5 | 1243 | # step 5 |
1385 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1244 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
1386 | head_list = self.get_table_head_text('otable') | 1245 | head_list = self.get_table_head_text('otable') |
1387 | print head_list | 1246 | print head_list |
1388 | print len(head_list) | 1247 | print len(head_list) |
1389 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ | 1248 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ |
1390 | msg=("head row contents wrong")) | 1249 | msg=("head row contents wrong")) |
1391 | # step 8 | 1250 | # step 8 |
1392 | # search other string. and click "Variable" to re-sort, check if table | 1251 | # search other string. and click "Variable" to re-sort, check if table |
1393 | # head is still the same | 1252 | # head is still the same |
1394 | self.driver.find_element_by_id("search").clear() | 1253 | self.driver.find_element_by_id("search").clear() |
@@ -1413,17 +1272,17 @@ class toaster_cases(toaster_cases_base): | |||
1413 | self.driver.maximize_window() | 1272 | self.driver.maximize_window() |
1414 | self.driver.get(self.base_url) | 1273 | self.driver.get(self.base_url) |
1415 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1274 | self.driver.find_element_by_link_text("core-image-minimal").click() |
1416 | # step 2-3 | 1275 | # step 2-3 |
1417 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() | 1276 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() |
1418 | self.driver.find_element_by_link_text("BitBake variables").click() | 1277 | self.driver.find_element_by_link_text("BitBake variables").click() |
1419 | variable_list = self.get_table_column_text('class', 'variable_name') | 1278 | variable_list = self.get_table_column_text('class', 'variable_name') |
1420 | self.assertTrue(is_list_sequenced(variable_list), msg=("list not in order")) | 1279 | self.assertTrue(is_list_sequenced(variable_list), msg=("list not in order")) |
1421 | # step 4 | 1280 | # step 4 |
1422 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1281 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1423 | variable_list = self.get_table_column_text('class', 'variable_name') | 1282 | variable_list = self.get_table_column_text('class', 'variable_name') |
1424 | self.assertTrue(is_list_inverted(variable_list), msg=("list not inverted")) | 1283 | self.assertTrue(is_list_inverted(variable_list), msg=("list not inverted")) |
1425 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1284 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1426 | # step 5 | 1285 | # step 5 |
1427 | # searching won't change the sequentiality | 1286 | # searching won't change the sequentiality |
1428 | self.driver.find_element_by_id("search").clear() | 1287 | self.driver.find_element_by_id("search").clear() |
1429 | self.driver.find_element_by_id("search").send_keys("lib") | 1288 | self.driver.find_element_by_id("search").send_keys("lib") |
@@ -1489,12 +1348,12 @@ class toaster_cases(toaster_cases_base): | |||
1489 | self.driver.maximize_window() | 1348 | self.driver.maximize_window() |
1490 | self.driver.get(self.base_url) | 1349 | self.driver.get(self.base_url) |
1491 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1350 | self.driver.find_element_by_link_text("core-image-minimal").click() |
1492 | # Step 2-3 | 1351 | # Step 2-3 |
1493 | self.find_element_by_link_text_in_table('nav', 'Packages').click() | 1352 | self.find_element_by_link_text_in_table('nav', 'Packages').click() |
1494 | check_head_list = ['Package', 'Package version', 'Size', 'Recipe'] | 1353 | check_head_list = ['Package', 'Package version', 'Size', 'Recipe'] |
1495 | head_list = self.get_table_head_text('otable') | 1354 | head_list = self.get_table_head_text('otable') |
1496 | self.assertTrue(head_list == check_head_list, msg=("head row not as expected")) | 1355 | self.assertTrue(head_list == check_head_list, msg=("head row not as expected")) |
1497 | # Step 4 | 1356 | # Step 4 |
1498 | # pulldown menu | 1357 | # pulldown menu |
1499 | option_ids = ['recipe__layer_version__layer__name', 'recipe__layer_version__branch', \ | 1358 | option_ids = ['recipe__layer_version__layer__name', 'recipe__layer_version__branch', \ |
1500 | 'recipe__layer_version__layer__commit', 'license', 'recipe__version'] | 1359 | 'recipe__layer_version__layer__commit', 'license', 'recipe__version'] |
@@ -1626,8 +1485,8 @@ class toaster_cases(toaster_cases_base): | |||
1626 | self.driver.back() | 1485 | self.driver.back() |
1627 | self.driver.find_element_by_link_text("Configuration").click() | 1486 | self.driver.find_element_by_link_text("Configuration").click() |
1628 | otable_head_text = self.get_table_head_text() | 1487 | otable_head_text = self.get_table_head_text() |
1629 | for item in ["Layer", "Layer branch", "Layer commit"]: | 1488 | self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit"]), \ |
1630 | self.assertTrue(item not in otable_head_text, msg=("item %s should not be in head row" % item)) | 1489 | msg=("text not in web page")) |
1631 | 1490 | ||
1632 | 1491 | ||
1633 | ############## | 1492 | ############## |
@@ -1637,29 +1496,36 @@ class toaster_cases(toaster_cases_base): | |||
1637 | self.case_no = self.get_case_number() | 1496 | self.case_no = self.get_case_number() |
1638 | self.log.info(' CASE %s log: ' % str(self.case_no)) | 1497 | self.log.info(' CASE %s log: ' % str(self.case_no)) |
1639 | self.driver.maximize_window() | 1498 | self.driver.maximize_window() |
1640 | for items in ["Packages", "Recipes", "Tasks"]: | 1499 | for item in ["Packages", "Recipes", "Tasks"]: |
1641 | self.driver.get(self.base_url) | 1500 | self.driver.get(self.base_url) |
1642 | self.driver.find_element_by_link_text("core-image-minimal").click() | 1501 | self.find_element_by_link_text_in_table('otable', "core-image-minimal").click() |
1643 | self.driver.find_element_by_link_text(items).click() | 1502 | self.driver.find_element_by_link_text(item).click() |
1644 | 1503 | # step 3 | |
1645 | # this may be page specific. If future page content changes, try to replace it with new xpath | 1504 | options = Select(self.driver.find_element_by_css_selector("select.pagesize")).options |
1646 | xpath_showrows = "/html/body/div[2]/div/div[2]/div[2]/div[2]/div/div/div[2]/select" | 1505 | options_numbers = [] |
1647 | xpath_table = "/html/body/div[2]/div/div[2]/div[2]/table/tbody" | 1506 | for option in options: |
1648 | self.driver.find_element_by_xpath(xpath_showrows).click() | 1507 | options_numbers.append(int(option.text)) |
1649 | rows_displayed = int(self.driver.find_element_by_xpath(xpath_showrows + "/option[2]").text) | 1508 | # the default options are : 10 25 50 100 150 |
1650 | 1509 | self.assertTrue(options_numbers==[10, 25, 50, 100, 150], msg=("%s options not as expected" % item)) | |
1651 | # not sure if this is a Selenium Select bug: If page is not refreshed here, "select(by visible text)" operation will go back to 100-row page | 1510 | # step 4 |
1652 | # Sure we can use driver.get(url) to refresh page, but since page will vary, we use click link text here | 1511 | # in this case it's 50 |
1653 | self.driver.find_element_by_link_text(items).click() | 1512 | option_tobeselected = options_numbers[2] |
1654 | Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_visible_text(str(rows_displayed)) | 1513 | Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_index(2) |
1655 | self.assertTrue(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) | 1514 | xpath_otable=".//*[@id='otable']/tbody" |
1656 | self.assertFalse(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) | 1515 | # examine if the 50th row exists while 51th does not |
1657 | 1516 | self.assertTrue(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected) +"]"),\ | |
1517 | msg=("Row %d should exist" %option_tobeselected)) | ||
1518 | self.assertFalse(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected+1) +"]"),\ | ||
1519 | msg=("Row %d should not exist" %(option_tobeselected+1))) | ||
1658 | # click 1st package, then go back to check if it's still those rows shown. | 1520 | # click 1st package, then go back to check if it's still those rows shown. |
1659 | self.driver.find_element_by_xpath(xpath_table + "/tr[1]/td[1]").click() | 1521 | self.driver.find_element_by_xpath(xpath_otable + "/tr[1]/td[1]/a").click() |
1660 | self.driver.find_element_by_link_text(items).click() | 1522 | time.sleep(3) |
1661 | self.assertTrue(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) | 1523 | self.driver.find_element_by_link_text(item).click() |
1662 | self.assertFalse(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) | 1524 | self.assertTrue(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected) +"]"),\ |
1525 | msg=("Row %d should exist" %option_tobeselected)) | ||
1526 | self.assertFalse(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected+1) +"]"),\ | ||
1527 | msg=("Row %d should not exist" %(option_tobeselected+1))) | ||
1528 | |||
1663 | 1529 | ||
1664 | 1530 | ||
1665 | ############## | 1531 | ############## |