summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorMihail Stanciu <stanciux.mihail@intel.com>2015-12-07 15:53:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-07 17:39:08 +0000
commit2a8e970d42232aec359ed9fd2e7c55de09961622 (patch)
tree7ad9304599792ff2a68f52acb83730456d3e3b65 /bitbake/lib/toaster
parentfe8a0a3697a333d89fc087a6b22843771d0807be (diff)
downloadpoky-2a8e970d42232aec359ed9fd2e7c55de09961622.tar.gz
bitbake: toaster: tests Update UI tests to work with 2.0 changes
Update tests that were referencing items removed in 2.0. Update most xpath elements left to use IDs. (Bitbake rev: c4dda67dd3773d02b760d96dd9c6f26bff93533d) Signed-off-by: Mihail Stanciu <stanciux.mihail@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rwxr-xr-xbitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py335
1 files changed, 247 insertions, 88 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 3d3ebd8e3c..d975d48acb 100755
--- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
+++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py
@@ -597,7 +597,7 @@ class toaster_cases_base(unittest.TestCase):
597 def is_text_present (self, patterns): 597 def is_text_present (self, patterns):
598 for pattern in patterns: 598 for pattern in patterns:
599 if str(pattern) not in self.driver.page_source: 599 if str(pattern) not in self.driver.page_source:
600 print pattern 600 print 'Text "'+pattern+'" is missing'
601 return False 601 return False
602 return True 602 return True
603 603
@@ -606,6 +606,7 @@ class toaster_cases_base(unittest.TestCase):
606 try: 606 try:
607 self.driver.find_element(how, what) 607 self.driver.find_element(how, what)
608 except NoSuchElementException, e: 608 except NoSuchElementException, e:
609 print 'Could not find element '+str(what)+' by ' + str(how)
609 return False 610 return False
610 return True 611 return True
611 612
@@ -744,7 +745,7 @@ class toaster_cases(toaster_cases_base):
744 self.driver.find_element_by_id("started_on").click() 745 self.driver.find_element_by_id("started_on").click()
745 self.driver.find_element_by_id("edit-columns-button").click() 746 self.driver.find_element_by_id("edit-columns-button").click()
746 # step 4 747 # step 4
747 items = ["Outcome", "Completed on", "Started on", "Failed tasks", "Errors", "Warnings"] 748 items = ["Outcome", "Completed on", "Started on"]
748 for item in items: 749 for item in items:
749 try: 750 try:
750 temp_element = self.find_element_by_text_in_table('otable', item) 751 temp_element = self.find_element_by_text_in_table('otable', item)
@@ -810,10 +811,9 @@ class toaster_cases(toaster_cases_base):
810 self.driver.find_element_by_id("edit-columns-button").click() 811 self.driver.find_element_by_id("edit-columns-button").click()
811 self.driver.find_element_by_id("cpu_used").click() 812 self.driver.find_element_by_id("cpu_used").click()
812 self.driver.find_element_by_id("disk_io").click() 813 self.driver.find_element_by_id("disk_io").click()
813 self.driver.find_element_by_id("task_log").click()
814 self.driver.find_element_by_id("recipe_version").click() 814 self.driver.find_element_by_id("recipe_version").click()
815 self.driver.find_element_by_id("time_taken").click() 815 self.driver.find_element_by_id("time_taken").click()
816 self.driver.find_element_by_css_selector("edit-columns-button").click() 816 self.driver.find_element_by_id("edit-columns-button").click()
817 # The operation is the same as case901 817 # The operation is the same as case901
818 # dict: {lint text name : actual class name} 818 # dict: {lint text name : actual class name}
819 table_head_dict = {'Order':'order', 'Recipe':'recipe_name', 'Task':'task_name', 'Executed':'executed', \ 819 table_head_dict = {'Order':'order', 'Recipe':'recipe_name', 'Task':'task_name', 'Executed':'executed', \
@@ -863,9 +863,17 @@ class toaster_cases(toaster_cases_base):
863 self.save_screenshot(screenshot_type='selenium', append_name='step8') 863 self.save_screenshot(screenshot_type='selenium', append_name='step8')
864 # after the last option was clicked, we don't need operation below anymore 864 # after the last option was clicked, we don't need operation below anymore
865 if number < len(avail_options)-1: 865 if number < len(avail_options)-1:
866 temp_element = self.find_element_by_link_text_in_table(self.table_name, key) 866 try:
867 temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click() 867 temp_element = self.find_element_by_link_text_in_table(self.table_name, key)
868 avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]") 868 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)]")
870 except:
871 print "in exception"
872 self.find_element_by_text("Show all tasks").click()
873# self.driver.find_element_by_xpath("//*[@id='searchform']/button[2]").click()
874 temp_element = self.find_element_by_link_text_in_table(self.table_name, key)
875 temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click()
876 avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]")
869 self.browser_delay() 877 self.browser_delay()
870 # step 11 878 # step 11
871 for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']: 879 for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']:
@@ -942,11 +950,8 @@ class toaster_cases(toaster_cases_base):
942 c_list = self.get_table_column_text_by_column_number('dependencies', 1) 950 c_list = self.get_table_column_text_by_column_number('dependencies', 1)
943 self.assertTrue(is_list_sequenced(c_list), msg=("list not in order")) 951 self.assertTrue(is_list_sequenced(c_list), msg=("list not in order"))
944 texts = ['Size', 'License', 'Recipe', 'Recipe version', 'Layer', \ 952 texts = ['Size', 'License', 'Recipe', 'Recipe version', 'Layer', \
945 'Layer branch', 'Layer commit'] 953 'Layer commit']
946 time.sleep(1) 954 self.failUnless(self.is_text_present(texts))
947# for text in texts:
948# self.assertTrue(self.is_text_present(text), msg=("text %s not in page" % text))
949 self.assertTrue(self.is_text_present(texts), msg=("text not in page"))
950 955
951 956
952 ############## 957 ##############
@@ -1113,8 +1118,10 @@ class toaster_cases(toaster_cases_base):
1113 # we deliberately want "no result" here 1118 # we deliberately want "no result" here
1114 self.driver.find_element_by_id("search").send_keys("no such input") 1119 self.driver.find_element_by_id("search").send_keys("no such input")
1115 self.driver.find_element_by_id("search-button").click() 1120 self.driver.find_element_by_id("search-button").click()
1116 self.find_element_by_text("Show all recipes").click() 1121 try:
1117 1122 self.find_element_by_text("Show all recipes").click()
1123 except:
1124 self.fail(msg='Could not identify blank page elements')
1118 1125
1119 ############## 1126 ##############
1120 # CASE 912 # 1127 # CASE 912 #
@@ -1184,42 +1191,184 @@ class toaster_cases(toaster_cases_base):
1184 def test_914(self): 1191 def test_914(self):
1185 self.case_no = self.get_case_number() 1192 self.case_no = self.get_case_number()
1186 self.log.info(' CASE %s log: ' % str(self.case_no)) 1193 self.log.info(' CASE %s log: ' % str(self.case_no))
1187 self.driver.maximize_window() 1194 image_type="core-image-minimal"
1188 self.driver.get(self.base_url) 1195 test_package1="busybox"
1189 self.find_element_by_link_text_in_table('otable', "core-image-minimal").click() 1196 test_package2="gdbm"
1190 self.find_element_by_link_text_in_table('nav', 'Recipes').click() 1197 test_package3="gettext-native"
1191 # step 4 1198 driver = self.driver
1192 self.find_element_by_link_text_in_table('otable', "busybox").click() 1199 driver.maximize_window()
1193 # this step needs some observation here 1200 driver.get(self.base_url)
1194 self.save_screenshot(screenshot_type='selenium', append_name='step4') 1201 driver.find_element_by_link_text(image_type).click()
1195 # step 5 1202 driver.find_element_by_link_text("Recipes").click()
1196 self.driver.find_element_by_partial_link_text('Packages (').click() 1203 driver.find_element_by_link_text(test_package1).click()
1197 head_list = self.get_table_head_text('otable') 1204
1198 head_checklist = ['Version', 'Size'] 1205 self.table_name = 'information'
1199 for item in head_checklist: 1206
1200 self.assertTrue(item in head_list, msg=("%s should be in head list" % item)) 1207 tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr/td[1]"))
1201 # step 6 1208 tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr[1]/td"))
1202 self.driver.find_element_by_partial_link_text('Build dependencies (').click() 1209 print 'rows: '+str(tasks_row_count)
1203 # the dependencies number may vary(even 0), so screenshot here 1210 print 'columns: '+str(tasks_column_count)
1204 self.save_screenshot(screenshot_type='selenium', append_name='step6') 1211
1205 self.driver.find_element_by_partial_link_text('Reverse build dependencies (').click() 1212 Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2)
1206 self.save_screenshot(screenshot_type='selenium', append_name='step7') 1213 print ("Tasks_column=", Tasks_column)
1207 # step 8 1214
1208 self.find_element_by_link_text_in_table('breadcrumb', "Recipes").click() 1215 key_tasks=["do_fetch", "do_unpack", "do_patch", "do_configure", "do_compile", "do_install", "do_package", "do_build"]
1209 # in case that gdbm doesn't appear on the first page, we use "search" 1216 i = 0
1210 self.driver.find_element_by_id("search").clear() 1217 while i < len(key_tasks):
1211 self.driver.find_element_by_id("search").send_keys("gdbm") 1218 if key_tasks[i] not in Tasks_column:
1212 self.driver.find_element_by_id("search-button").click() 1219 print ("Error! Missing key task: %s" % key_tasks[i])
1213 self.driver.find_element_by_link_text("gdbm").click() 1220 else:
1214 # step 9 1221 print ("%s is in tasks" % key_tasks[i])
1215 self.driver.find_element_by_partial_link_text('Packages (').click() 1222 i = i + 1
1216 # below are different from the contents described in testcase web 1223
1217 # page, so .. screenshot again 1224 if Tasks_column.index(key_tasks[0]) != 0:
1218 self.save_screenshot(screenshot_type='selenium', append_name='step9') 1225 print ("Error! %s is not in the right position" % key_tasks[0])
1219 self.driver.find_element_by_partial_link_text('Build dependencies (').click() 1226 else:
1220 self.save_screenshot(screenshot_type='selenium', append_name='step10') 1227 print ("%s is in right position" % key_tasks[0])
1221 self.driver.find_element_by_partial_link_text('Reverse build dependencies (').click() 1228
1222 self.save_screenshot(screenshot_type='selenium', append_name='step11') 1229 if Tasks_column[-1] != key_tasks[-1]:
1230 print ("Error! %s is not in the right position" % key_tasks[-1])
1231 else:
1232 print ("%s is in right position" % key_tasks[-1])
1233
1234 driver.find_element_by_partial_link_text("Packages (").click()
1235 packages_name = driver.find_element_by_partial_link_text("Packages (").text
1236 print packages_name
1237 packages_num = int(filter(str.isdigit, repr(packages_name)))
1238 print packages_num
1239
1240 #switch the table to show more than 10 rows at a time
1241 self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").click()
1242 Select(driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select")).select_by_value('150')
1243 self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").send_keys(Keys.ENTER)
1244
1245 packages_row_count = len(driver.find_elements_by_xpath("//*[@id='otable']/tbody/tr/td[1]"))
1246 print packages_row_count
1247
1248 if packages_num != packages_row_count:
1249 print ("Error! The packages number is not correct")
1250 else:
1251 print ("The packages number is correct")
1252
1253 driver.find_element_by_partial_link_text("Build dependencies (").click()
1254 depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text
1255 print depends_name
1256 depends_num = int(filter(str.isdigit, repr(depends_name)))
1257 print depends_num
1258
1259 if depends_num == 0:
1260 depends_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text)
1261 print depends_message
1262 if depends_message.find("has no build dependencies.") < 0:
1263 print ("Error! The message isn't expected.")
1264 else:
1265 print ("The message is expected")
1266 else:
1267 depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]"))
1268 print depends_row_count
1269 if depends_num != depends_row_count:
1270 print ("Error! The dependent packages number is not correct")
1271 else:
1272 print ("The dependent packages number is correct")
1273
1274 driver.find_element_by_partial_link_text("Reverse build dependencies (").click()
1275 rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text
1276 print rdepends_name
1277 rdepends_num = int(filter(str.isdigit, repr(rdepends_name)))
1278 print rdepends_num
1279
1280 if rdepends_num == 0:
1281 rdepends_message = repr(driver.find_element_by_css_selector("#brought-in-by > div.alert.alert-info").text)
1282 print rdepends_message
1283 if rdepends_message.find("has no reverse build dependencies.") < 0:
1284 print ("Error! The message isn't expected.")
1285 else:
1286 print ("The message is expected")
1287 else:
1288 print ("The reverse dependent packages number is correct")
1289
1290 driver.find_element_by_link_text("Recipes").click()
1291 driver.find_element_by_link_text(test_package2).click()
1292 driver.find_element_by_partial_link_text("Packages (").click()
1293 driver.find_element_by_partial_link_text("Build dependencies (").click()
1294 driver.find_element_by_partial_link_text("Reverse build dependencies (").click()
1295
1296
1297 driver.find_element_by_link_text("Recipes").click()
1298 driver.find_element_by_link_text(test_package3).click()
1299
1300 native_tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr/td[1]"))
1301 native_tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr[1]/td"))
1302 print native_tasks_row_count
1303 print native_tasks_column_count
1304
1305 Native_Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2)
1306 print ("Native_Tasks_column=", Native_Tasks_column)
1307
1308 native_key_tasks=["do_fetch", "do_unpack", "do_patch", "do_configure", "do_compile", "do_install", "do_build"]
1309 i = 0
1310 while i < len(native_key_tasks):
1311 if native_key_tasks[i] not in Native_Tasks_column:
1312 print ("Error! Missing key task: %s" % native_key_tasks[i])
1313 else:
1314 print ("%s is in tasks" % native_key_tasks[i])
1315 i = i + 1
1316
1317 if Native_Tasks_column.index(native_key_tasks[0]) != 0:
1318 print ("Error! %s is not in the right position" % native_key_tasks[0])
1319 else:
1320 print ("%s is in right position" % native_key_tasks[0])
1321
1322 if Native_Tasks_column[-1] != native_key_tasks[-1]:
1323 print ("Error! %s is not in the right position" % native_key_tasks[-1])
1324 else:
1325 print ("%s is in right position" % native_key_tasks[-1])
1326
1327 driver.find_element_by_partial_link_text("Packages (").click()
1328 native_packages_name = driver.find_element_by_partial_link_text("Packages (").text
1329 print native_packages_name
1330 native_packages_num = int(filter(str.isdigit, repr(native_packages_name)))
1331 print native_packages_num
1332
1333 if native_packages_num != 0:
1334 print ("Error! Native task shouldn't have any packages.")
1335 else:
1336 native_package_message = repr(driver.find_element_by_css_selector("#packages-built > div.alert.alert-info").text)
1337 print native_package_message
1338 if native_package_message.find("does not build any packages.") < 0:
1339 print ("Error! The message for native task isn't expected.")
1340 else:
1341 print ("The message for native task is expected.")
1342
1343 driver.find_element_by_partial_link_text("Build dependencies (").click()
1344 native_depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text
1345 print native_depends_name
1346 native_depends_num = int(filter(str.isdigit, repr(native_depends_name)))
1347 print native_depends_num
1348
1349 native_depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]"))
1350 print native_depends_row_count
1351
1352 if native_depends_num != native_depends_row_count:
1353 print ("Error! The dependent packages number is not correct")
1354 else:
1355 print ("The dependent packages number is correct")
1356
1357 driver.find_element_by_partial_link_text("Reverse build dependencies (").click()
1358 native_rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text
1359 print native_rdepends_name
1360 native_rdepends_num = int(filter(str.isdigit, repr(native_rdepends_name)))
1361 print native_rdepends_num
1362
1363 native_rdepends_row_count = len(driver.find_elements_by_xpath("//*[@id='brought-in-by']/table/tbody/tr/td[1]"))
1364 print native_rdepends_row_count
1365
1366 if native_rdepends_num != native_rdepends_row_count:
1367 print ("Error! The reverse dependent packages number is not correct")
1368 else:
1369 print ("The reverse dependent packages number is correct")
1370
1371 driver.find_element_by_link_text("Recipes").click()
1223 1372
1224 1373
1225 ############## 1374 ##############
@@ -1307,12 +1456,11 @@ class toaster_cases(toaster_cases_base):
1307 # step 3 1456 # step 3
1308 self.driver.find_element_by_id("edit-columns-button").click() 1457 self.driver.find_element_by_id("edit-columns-button").click()
1309 self.driver.find_element_by_id("started_on").click() 1458 self.driver.find_element_by_id("started_on").click()
1310 self.driver.find_element_by_id("log").click()
1311 self.driver.find_element_by_id("time").click() 1459 self.driver.find_element_by_id("time").click()
1312 self.driver.find_element_by_id("edit-columns-button").click() 1460 self.driver.find_element_by_id("edit-columns-button").click()
1313 head_list = self.get_table_head_text('otable') 1461 head_list = self.get_table_head_text('otable')
1314 for item in ['Outcome', 'Recipe', 'Machine', 'Started on', 'Completed on', 'Failed tasks', 'Errors', 'Warnings', 'Warnings', 'Time']: 1462 for item in ['Outcome', 'Recipe', 'Machine', 'Started on', 'Completed on', 'Failed tasks', 'Errors', 'Warnings', 'Time', "Image files", "Project"]:
1315 self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) 1463 self.failUnless(item in head_list, msg=item+' is missing from table head.')
1316 1464
1317 1465
1318 ############## 1466 ##############
@@ -1330,10 +1478,11 @@ class toaster_cases(toaster_cases_base):
1330 # Step 4 1478 # Step 4
1331 # click Errors , order in "Completed on" should be disturbed. Then hide 1479 # click Errors , order in "Completed on" should be disturbed. Then hide
1332 # error column to check if order in "Completed on" can be restored 1480 # error column to check if order in "Completed on" can be restored
1333 self.find_element_by_link_text_in_table('otable', 'Errors').click() 1481#THIS TEST IS NO LONGER VALID DUE TO DESIGN CHANGES. LEAVING IN PENDING UPDATES TO DESIGN
1334 self.driver.find_element_by_id("edit-columns-button").click() 1482 #self.find_element_by_link_text_in_table('otable', 'Errors').click()
1335 self.driver.find_element_by_id("errors_no").click() 1483 #self.driver.find_element_by_id("edit-columns-button").click()
1336 self.driver.find_element_by_id("edit-columns-button").click() 1484 #self.driver.find_element_by_id("errors_no").click()
1485 #self.driver.find_element_by_id("edit-columns-button").click()
1337 # Note: without time.sleep here, there'll be unpredictable error..TBD 1486 # Note: without time.sleep here, there'll be unpredictable error..TBD
1338 time.sleep(1) 1487 time.sleep(1)
1339 c_list = self.get_table_column_text('class', 'completed_on') 1488 c_list = self.get_table_column_text('class', 'completed_on')
@@ -1443,7 +1592,7 @@ class toaster_cases(toaster_cases_base):
1443 # otable is the recipes table here 1592 # otable is the recipes table here
1444 otable_head_text = self.get_table_head_text('otable') 1593 otable_head_text = self.get_table_head_text('otable')
1445 for item in ["Layer", "Layer branch", "Layer commit"]: 1594 for item in ["Layer", "Layer branch", "Layer commit"]:
1446 self.assertFalse(item not in otable_head_text, msg=("item %s should be in head row" % item)) 1595 self.failIf(item not in otable_head_text, msg=item+' not in table head.')
1447 # click the fist recipe, whatever it is 1596 # click the fist recipe, whatever it is
1448 self.get_table_element("otable", 1, 1).click() 1597 self.get_table_element("otable", 1, 1).click()
1449 self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit", "Recipe file"]), \ 1598 self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit", "Recipe file"]), \
@@ -1499,25 +1648,22 @@ class toaster_cases(toaster_cases_base):
1499 self.driver.maximize_window() 1648 self.driver.maximize_window()
1500 for item in ["Packages", "Recipes", "Tasks"]: 1649 for item in ["Packages", "Recipes", "Tasks"]:
1501 self.driver.get(self.base_url) 1650 self.driver.get(self.base_url)
1502 self.find_element_by_link_text_in_table('otable', "core-image-minimal").click() 1651 self.driver.find_element_by_link_text("core-image-minimal").click()
1503 self.driver.find_element_by_link_text(item).click() 1652 self.driver.find_element_by_link_text(items).click()
1504 # step 3 1653
1505 options = Select(self.driver.find_element_by_css_selector("select.pagesize")).options 1654 # this may be page specific. If future page content changes, try to replace it with new xpath
1506 options_numbers = [] 1655 xpath_showrows = "/html/body/div[4]/div/div/div[2]/div[2]/div[2]/div/div/div[2]/select"
1507 for option in options: 1656 xpath_table = "html/body/div[4]/div/div/div[2]/div[2]/table/tbody"#"id=('otable')/tbody"
1508 options_numbers.append(int(option.text)) 1657 self.driver.find_element_by_xpath(xpath_showrows).click()
1509 # the default options are : 10 25 50 100 150 1658 rows_displayed = int(self.driver.find_element_by_xpath(xpath_showrows + "/option[2]").text)
1510 self.assertTrue(options_numbers==[10, 25, 50, 100, 150], msg=("%s options not as expected" % item)) 1659
1511 # step 4 1660 # 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
1512 # in this case it's 50 1661 # Sure we can use driver.get(url) to refresh page, but since page will vary, we use click link text here
1513 option_tobeselected = options_numbers[2] 1662 self.driver.find_element_by_link_text(items).click()
1514 Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_index(2) 1663 Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_visible_text(str(rows_displayed))
1515 xpath_otable=".//*[@id='otable']/tbody" 1664 self.failUnless(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]"))
1516 # examine if the 50th row exists while 51th does not 1665 self.failIf(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]"))
1517 self.assertTrue(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected) +"]"),\ 1666
1518 msg=("Row %d should exist" %option_tobeselected))
1519 self.assertFalse(self.is_element_present(By.XPATH, xpath_otable + "/tr[" + str(option_tobeselected+1) +"]"),\
1520 msg=("Row %d should not exist" %(option_tobeselected+1)))
1521 # click 1st package, then go back to check if it's still those rows shown. 1667 # click 1st package, then go back to check if it's still those rows shown.
1522 self.driver.find_element_by_xpath(xpath_otable + "/tr[1]/td[1]/a").click() 1668 self.driver.find_element_by_xpath(xpath_otable + "/tr[1]/td[1]/a").click()
1523 time.sleep(3) 1669 time.sleep(3)
@@ -1811,9 +1957,10 @@ class toaster_cases(toaster_cases_base):
1811 # step 2-3 need to run manually 1957 # step 2-3 need to run manually
1812 self.log.info("step 2-3: checking the help message when you hover on help icon of target,\ 1958 self.log.info("step 2-3: checking the help message when you hover on help icon of target,\
1813 tasks, recipes, packages need to run manually") 1959 tasks, recipes, packages need to run manually")
1814 self.driver.find_element_by_partial_link_text("Toaster manual").click() 1960 self.driver.find_element_by_partial_link_text("Manual").click()
1815 if not self.is_text_present("Toaster Manual"): 1961 if not self.is_text_present("Manual"):
1816 self.assertFalse(True, msg=("please check [Toaster manual] link on page")) 1962 self.log.error("please check [Toaster manual] link on page")
1963 self.failIf(True)
1817 1964
1818#################################################################################################### 1965####################################################################################################
1819# Starting backend tests ########################################################################### 1966# Starting backend tests ###########################################################################
@@ -1929,10 +2076,16 @@ class toaster_cases(toaster_cases_base):
1929 query = "select name from orm_branch where layer_source_id=1;" 2076 query = "select name from orm_branch where layer_source_id=1;"
1930 cursor.execute(query) 2077 cursor.execute(query)
1931 data = cursor.fetchall() 2078 data = cursor.fetchall()
1932 for i in range(0,4): 2079 lenght = len(data)
1933 data[i] = data[i][0] 2080 try:
2081 for i in range(0,lenght):
2082 data[i] = data[i][0]
2083 except:
2084 pass
1934 print data 2085 print data
1935 json_parse = json.loads(open('toasterconf.json').read()) 2086 json_parse = json.loads(open('toasterconf.json').read())
2087 json_location = json_parse['layersources'][0]['name']
2088 print json_location
1936 json_data = json_parse['layersources'][0]['branches'] 2089 json_data = json_parse['layersources'][0]['branches']
1937 print json_data 2090 print json_data
1938 self.failUnless(set(data) == set(json_data)) 2091 self.failUnless(set(data) == set(json_data))
@@ -1940,13 +2093,16 @@ class toaster_cases(toaster_cases_base):
1940 print 'Checking branches for "OpenEmbedded"' 2093 print 'Checking branches for "OpenEmbedded"'
1941 con=sqlite.connect('toaster.sqlite') 2094 con=sqlite.connect('toaster.sqlite')
1942 cursor = con.cursor() 2095 cursor = con.cursor()
1943 query = "select name from orm_branch where layer_source_id=2;" 2096 query = "select name from orm_branch where layer_source_id=3;"
1944 cursor.execute(query) 2097 cursor.execute(query)
1945 data = cursor.fetchall() 2098 data = cursor.fetchall()
1946 for i in range(0,3): 2099 lenght = len(data)
2100 for i in range(0,lenght):
1947 data[i] = data[i][0] 2101 data[i] = data[i][0]
1948 print data 2102 print data
1949 json_parse = json.loads(open('toasterconf.json').read()) 2103 json_parse = json.loads(open('toasterconf.json').read())
2104 json_location = json_parse['layersources'][1]['name']
2105 print json_location
1950 json_data = json_parse['layersources'][1]['branches'] 2106 json_data = json_parse['layersources'][1]['branches']
1951 print json_data 2107 print json_data
1952 self.failUnless(set(data) == set(json_data)) 2108 self.failUnless(set(data) == set(json_data))
@@ -1954,13 +2110,16 @@ class toaster_cases(toaster_cases_base):
1954 print 'Checking branches for "Imported layers"' 2110 print 'Checking branches for "Imported layers"'
1955 con=sqlite.connect('toaster.sqlite') 2111 con=sqlite.connect('toaster.sqlite')
1956 cursor = con.cursor() 2112 cursor = con.cursor()
1957 query = "select name from orm_branch where layer_source_id=3;" 2113 query = "select name from orm_branch where layer_source_id=2;"
1958 cursor.execute(query) 2114 cursor.execute(query)
1959 data = cursor.fetchall() 2115 data = cursor.fetchall()
1960 for i in range(0,4): 2116 lenght = len(data)
2117 for i in range(0,lenght):
1961 data[i] = data[i][0] 2118 data[i] = data[i][0]
1962 print data 2119 print data
1963 json_parse = json.loads(open('toasterconf.json').read()) 2120 json_parse = json.loads(open('toasterconf.json').read())
2121 json_location = json_parse['layersources'][2]['name']
2122 print json_location
1964 json_data = json_parse['layersources'][2]['branches'] 2123 json_data = json_parse['layersources'][2]['branches']
1965 print json_data 2124 print json_data
1966 self.failUnless(set(data) == set(json_data)) 2125 self.failUnless(set(data) == set(json_data))
@@ -2066,7 +2225,7 @@ class toaster_cases(toaster_cases_base):
2066 self.driver.find_element_by_id('change-machine-toggle').click() 2225 self.driver.find_element_by_id('change-machine-toggle').click()
2067 self.driver.find_element_by_id('machine-change-input').clear() 2226 self.driver.find_element_by_id('machine-change-input').clear()
2068 self.driver.find_element_by_id('machine-change-input').send_keys('qemuarm64') 2227 self.driver.find_element_by_id('machine-change-input').send_keys('qemuarm64')
2069 self.driver.find_element_by_id('machine-change-input').send_keys(Keys.RETURN) 2228# self.driver.find_element_by_id('machine-change-input').send_keys(Keys.RETURN)
2070 self.driver.find_element_by_id('machine-change-btn').click() 2229 self.driver.find_element_by_id('machine-change-btn').click()
2071 con=sqlite.connect('toaster.sqlite') 2230 con=sqlite.connect('toaster.sqlite')
2072 cursor = con.cursor() 2231 cursor = con.cursor()
@@ -2093,7 +2252,7 @@ class toaster_cases(toaster_cases_base):
2093 cursor.execute(query) 2252 cursor.execute(query)
2094 data = cursor.fetchall() 2253 data = cursor.fetchall()
2095 try: 2254 try:
2096 data = data[0] 2255 data = data[0][0]
2097 except: 2256 except:
2098 pass 2257 pass
2099 print data 2258 print data