diff options
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py | 270 |
1 files changed, 167 insertions, 103 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 edd699bd3d..eac167b2e5 100755 --- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py +++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py | |||
@@ -221,6 +221,68 @@ def extract_number_from_string(s): | |||
221 | """ | 221 | """ |
222 | return re.findall(r'([0-9]+)', s) | 222 | return re.findall(r'([0-9]+)', s) |
223 | 223 | ||
224 | # Below is decorator derived from toaster backend test code | ||
225 | class NoParsingFilter(logging.Filter): | ||
226 | def filter(self, record): | ||
227 | return record.levelno == 100 | ||
228 | |||
229 | def LogResults(original_class): | ||
230 | orig_method = original_class.run | ||
231 | |||
232 | #rewrite the run method of unittest.TestCase to add testcase logging | ||
233 | def run(self, result, *args, **kws): | ||
234 | orig_method(self, result, *args, **kws) | ||
235 | passed = True | ||
236 | testMethod = getattr(self, self._testMethodName) | ||
237 | |||
238 | #if test case is decorated then use it's number, else use it's name | ||
239 | try: | ||
240 | test_case = testMethod.test_case | ||
241 | except AttributeError: | ||
242 | test_case = self._testMethodName | ||
243 | |||
244 | #create custom logging level for filtering. | ||
245 | custom_log_level = 100 | ||
246 | logging.addLevelName(custom_log_level, 'RESULTS') | ||
247 | caller = os.path.basename(sys.argv[0]) | ||
248 | |||
249 | def results(self, message, *args, **kws): | ||
250 | if self.isEnabledFor(custom_log_level): | ||
251 | self.log(custom_log_level, message, *args, **kws) | ||
252 | logging.Logger.results = results | ||
253 | |||
254 | logging.basicConfig(filename=os.path.join(os.getcwd(),'results-'+caller+'.log'), | ||
255 | filemode='w', | ||
256 | format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | ||
257 | datefmt='%H:%M:%S', | ||
258 | level=custom_log_level) | ||
259 | for handler in logging.root.handlers: | ||
260 | handler.addFilter(NoParsingFilter()) | ||
261 | # local_log = logging.getLogger(caller) | ||
262 | local_log = logging.getLogger() | ||
263 | |||
264 | #check status of tests and record it | ||
265 | for (name, msg) in result.errors: | ||
266 | if self._testMethodName == str(name).split(' ')[0]: | ||
267 | local_log.results("Testcase "+str(test_case)+": ERROR") | ||
268 | local_log.results("Testcase "+str(test_case)+":\n"+msg+"\n\n\n") | ||
269 | passed = False | ||
270 | for (name, msg) in result.failures: | ||
271 | if self._testMethodName == str(name).split(' ')[0]: | ||
272 | local_log.results("Testcase "+str(test_case)+": FAILED") | ||
273 | local_log.results("Testcase "+str(test_case)+":\n"+msg+"\n\n\n") | ||
274 | passed = False | ||
275 | for (name, msg) in result.skipped: | ||
276 | if self._testMethodName == str(name).split(' ')[0]: | ||
277 | local_log.results("Testcase "+str(test_case)+": SKIPPED"+"\n\n\n") | ||
278 | passed = False | ||
279 | if passed: | ||
280 | local_log.results("Testcase "+str(test_case)+": PASSED"+"\n\n\n") | ||
281 | |||
282 | original_class.run = run | ||
283 | return original_class | ||
284 | |||
285 | |||
224 | 286 | ||
225 | 287 | ||
226 | ########################################### | 288 | ########################################### |
@@ -534,6 +596,7 @@ class toaster_cases_base(unittest.TestCase): | |||
534 | def is_text_present (self, patterns): | 596 | def is_text_present (self, patterns): |
535 | for pattern in patterns: | 597 | for pattern in patterns: |
536 | if str(pattern) not in self.driver.page_source: | 598 | if str(pattern) not in self.driver.page_source: |
599 | print pattern | ||
537 | return False | 600 | return False |
538 | return True | 601 | return True |
539 | 602 | ||
@@ -595,7 +658,7 @@ class toaster_cases_base(unittest.TestCase): | |||
595 | # Note: to comply with the unittest framework, we call these test_xxx functions | 658 | # Note: to comply with the unittest framework, we call these test_xxx functions |
596 | # from run_toastercases.py to avoid calling setUp() and tearDown() multiple times | 659 | # from run_toastercases.py to avoid calling setUp() and tearDown() multiple times |
597 | 660 | ||
598 | 661 | @LogResults | |
599 | class toaster_cases(toaster_cases_base): | 662 | class toaster_cases(toaster_cases_base): |
600 | ############## | 663 | ############## |
601 | # CASE 901 # | 664 | # CASE 901 # |
@@ -630,12 +693,12 @@ class toaster_cases(toaster_cases_base): | |||
630 | if is_list_inverted(column_list): | 693 | if is_list_inverted(column_list): |
631 | self.driver.find_element_by_link_text(key).click() | 694 | self.driver.find_element_by_link_text(key).click() |
632 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 695 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
633 | self.failUnless(is_list_sequenced(column_list)) | 696 | self.assertTrue(is_list_sequenced(column_list), msg=("%s column not in order" % key)) |
634 | else: | 697 | else: |
635 | self.failUnless(is_list_sequenced(column_list)) | 698 | self.assertTrue(is_list_sequenced(column_list), msg=("%s column not sequenced" % key)) |
636 | self.driver.find_element_by_link_text(key).click() | 699 | self.driver.find_element_by_link_text(key).click() |
637 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 700 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
638 | self.failUnless(is_list_inverted(column_list)) | 701 | self.assertTrue(is_list_inverted(column_list), msg=("%s column not inverted" % key)) |
639 | self.log.info("case passed") | 702 | self.log.info("case passed") |
640 | 703 | ||
641 | 704 | ||
@@ -659,10 +722,10 @@ class toaster_cases(toaster_cases_base): | |||
659 | # if nothing found, we still count it as "pass" | 722 | # if nothing found, we still count it as "pass" |
660 | if new_target_column_texts: | 723 | if new_target_column_texts: |
661 | for text in new_target_column_texts: | 724 | for text in new_target_column_texts: |
662 | self.failUnless(text.find(pattern)) | 725 | self.assertTrue(text.find(pattern), msg=("%s item doesn't exist " % pattern)) |
663 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 726 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
664 | target_column_texts = self.get_table_column_text("class", "target") | 727 | target_column_texts = self.get_table_column_text("class", "target") |
665 | self.failUnless(ori_target_column_texts == target_column_texts) | 728 | self.assertTrue(ori_target_column_texts == target_column_texts, msg=("builds changed after operations")) |
666 | 729 | ||
667 | 730 | ||
668 | ############## | 731 | ############## |
@@ -685,10 +748,9 @@ class toaster_cases(toaster_cases_base): | |||
685 | try: | 748 | try: |
686 | temp_element = self.find_element_by_text_in_table('otable', item) | 749 | temp_element = self.find_element_by_text_in_table('otable', item) |
687 | # this is how we find "filter icon" in the same level as temp_element(where "a" means clickable, "i" means icon) | 750 | # this is how we find "filter icon" in the same level as temp_element(where "a" means clickable, "i" means icon) |
688 | self.failUnless(temp_element.find_element_by_xpath("..//*/a/i[@class='icon-filter filtered']")) | 751 | self.assertTrue(temp_element.find_element_by_xpath("..//*/a/i[@class='icon-filter filtered']")) |
689 | except Exception,e: | 752 | except Exception,e: |
690 | self.log.error(" %s cannot be found! %s" % (item, e)) | 753 | self.assertFalse(True, msg=(" %s cannot be found! %s" % (item, e))) |
691 | self.failIf(True) | ||
692 | raise | 754 | raise |
693 | # step 5-6 | 755 | # step 5-6 |
694 | temp_element = self.find_element_by_link_text_in_table('otable', 'Outcome') | 756 | temp_element = self.find_element_by_link_text_in_table('otable', 'Outcome') |
@@ -731,10 +793,12 @@ class toaster_cases(toaster_cases_base): | |||
731 | # This is how we find the "default" rows-number! | 793 | # This is how we find the "default" rows-number! |
732 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) | 794 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) |
733 | print rows_displayed | 795 | print rows_displayed |
734 | self.failUnless(self.get_table_element(self.table_name, rows_displayed)) | 796 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed), msg=("not enough rows displayed")) |
735 | self.failIf(self.get_table_element(self.table_name, rows_displayed + 1)) | 797 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1), \ |
798 | msg=("more rows displayed than expected")) | ||
736 | # Search text box background text is "Search tasks" | 799 | # Search text box background text is "Search tasks" |
737 | self.failUnless(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search tasks']")) | 800 | self.assertTrue(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search tasks']"),\ |
801 | msg=("background text doesn't exist")) | ||
738 | 802 | ||
739 | self.driver.find_element_by_id("search").clear() | 803 | self.driver.find_element_by_id("search").clear() |
740 | self.driver.find_element_by_id("search").send_keys("busybox") | 804 | self.driver.find_element_by_id("search").send_keys("busybox") |
@@ -763,22 +827,23 @@ class toaster_cases(toaster_cases_base): | |||
763 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 827 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
764 | # after 1st click, the list should be either sequenced or inverted, but we don't have a "default order" here | 828 | # after 1st click, the list should be either sequenced or inverted, but we don't have a "default order" here |
765 | # the point is, after another click, it should be another order | 829 | # the point is, after another click, it should be another order |
766 | # the fist case is special:this means every item in column_list is the same, so | 830 | # the first case is special:this means every item in column_list is the same, so |
767 | # after one click, either sequenced or inverted will be fine | 831 | # after one click, either sequenced or inverted will be fine |
768 | if (is_list_inverted(column_list) and is_list_sequenced(column_list)) \ | 832 | if (is_list_inverted(column_list) and is_list_sequenced(column_list)) \ |
769 | or (not column_list) : | 833 | or (not column_list) : |
770 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 834 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
771 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 835 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
772 | self.failUnless(is_list_sequenced(column_list) or is_list_inverted(column_list)) | 836 | self.assertTrue(is_list_sequenced(column_list) or is_list_inverted(column_list), \ |
837 | msg=("%s column not in any order" % key)) | ||
773 | elif is_list_inverted(column_list): | 838 | elif is_list_inverted(column_list): |
774 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 839 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
775 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 840 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
776 | self.failUnless(is_list_sequenced(column_list)) | 841 | self.assertTrue(is_list_sequenced(column_list), msg=("%s column not in order" % key)) |
777 | else: | 842 | else: |
778 | self.failUnless(is_list_sequenced(column_list)) | 843 | self.assertTrue(is_list_sequenced(column_list), msg=("%s column not in order" % key)) |
779 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 844 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
780 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 845 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
781 | self.failUnless(is_list_inverted(column_list)) | 846 | self.assertTrue(is_list_inverted(column_list), msg=("%s column not inverted" % key)) |
782 | # step 8-10 | 847 | # step 8-10 |
783 | # filter dict: {link text name : filter table name in xpath} | 848 | # filter dict: {link text name : filter table name in xpath} |
784 | filter_dict = {'Executed':'filter_executed', 'Outcome':'filter_outcome', 'Cache attempt':'filter_cache_attempt'} | 849 | filter_dict = {'Executed':'filter_executed', 'Outcome':'filter_outcome', 'Cache attempt':'filter_cache_attempt'} |
@@ -837,9 +902,9 @@ class toaster_cases(toaster_cases_base): | |||
837 | self.find_element_by_link_text_in_table('nav', key).click() | 902 | self.find_element_by_link_text_in_table('nav', key).click() |
838 | head_list = self.get_table_head_text('otable') | 903 | head_list = self.get_table_head_text('otable') |
839 | for item in test_dict[key]['check_head_list']: | 904 | for item in test_dict[key]['check_head_list']: |
840 | self.failUnless(item in head_list) | 905 | self.assertTrue(item in head_list, msg=("%s not in head row" % item)) |
841 | column_list = self.get_table_column_text('class', test_dict[key]['class']) | 906 | column_list = self.get_table_column_text('class', test_dict[key]['class']) |
842 | self.failUnless(is_list_inverted(column_list)) | 907 | self.assertTrue(is_list_inverted(column_list), msg=("%s column not inverted" % key)) |
843 | 908 | ||
844 | self.driver.find_element_by_id("edit-columns-button").click() | 909 | self.driver.find_element_by_id("edit-columns-button").click() |
845 | for item2 in test_dict[key]['check_column_list']: | 910 | for item2 in test_dict[key]['check_column_list']: |
@@ -865,21 +930,24 @@ class toaster_cases(toaster_cases_base): | |||
865 | self.driver.find_element_by_partial_link_text("Generated files").click() | 930 | self.driver.find_element_by_partial_link_text("Generated files").click() |
866 | head_list = self.get_table_head_text('otable') | 931 | head_list = self.get_table_head_text('otable') |
867 | for item in ['File', 'Size']: | 932 | for item in ['File', 'Size']: |
868 | self.failUnless(item in head_list) | 933 | self.assertTrue(item in head_list, msg=("%s not in head row" % item)) |
869 | c_list = self.get_table_column_text('class', 'path') | 934 | c_list = self.get_table_column_text('class', 'path') |
870 | self.failUnless(is_list_sequenced(c_list)) | 935 | self.assertTrue(is_list_sequenced(c_list), msg=("column not in order")) |
871 | # step 7 | 936 | # step 7 |
872 | self.driver.find_element_by_partial_link_text("Runtime dependencies").click() | 937 | self.driver.find_element_by_partial_link_text("Runtime dependencies").click() |
873 | # save sceen here to observe... | 938 | # save sceen here to observe... |
874 | # note that here table name is not 'otable' | 939 | # note that here table name is not 'otable' |
875 | head_list = self.get_table_head_text('dependencies') | 940 | head_list = self.get_table_head_text('dependencies') |
876 | for item in ['Package', 'Version', 'Size']: | 941 | for item in ['Package', 'Version', 'Size']: |
877 | self.failUnless(item in head_list) | 942 | self.assertTrue(item in head_list, msg=("%s not in head row" % item)) |
878 | c_list = self.get_table_column_text_by_column_number('dependencies', 1) | 943 | c_list = self.get_table_column_text_by_column_number('dependencies', 1) |
879 | self.failUnless(is_list_sequenced(c_list)) | 944 | self.assertTrue(is_list_sequenced(c_list), msg=("list not in order")) |
880 | texts = ['Size', 'License', 'Recipe', 'Recipe version', 'Layer', \ | 945 | texts = ['Size', 'License', 'Recipe', 'Recipe version', 'Layer', \ |
881 | 'Layer branch', 'Layer commit', 'Layer directory'] | 946 | 'Layer branch', 'Layer commit'] |
882 | self.failUnless(self.is_text_present(texts)) | 947 | time.sleep(1) |
948 | # for text in texts: | ||
949 | # self.assertTrue(self.is_text_present(text), msg=("text %s not in page" % text)) | ||
950 | self.assertTrue(self.is_text_present(texts), msg=("text not in page")) | ||
883 | 951 | ||
884 | 952 | ||
885 | ############## | 953 | ############## |
@@ -901,8 +969,8 @@ class toaster_cases(toaster_cases_base): | |||
901 | # This is how we find the "default" rows-number! | 969 | # This is how we find the "default" rows-number! |
902 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) | 970 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) |
903 | print rows_displayed | 971 | print rows_displayed |
904 | self.failUnless(self.get_table_element(self.table_name, rows_displayed)) | 972 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed)) |
905 | self.failIf(self.get_table_element(self.table_name, rows_displayed + 1)) | 973 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1)) |
906 | 974 | ||
907 | # Check the default table is sorted by Recipe | 975 | # Check the default table is sorted by Recipe |
908 | tasks_column_count = len(self.driver.find_elements_by_xpath("/html/body/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]")) | 976 | tasks_column_count = len(self.driver.find_elements_by_xpath("/html/body/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]")) |
@@ -910,10 +978,10 @@ class toaster_cases(toaster_cases_base): | |||
910 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) | 978 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) |
911 | #print default_column_list | 979 | #print default_column_list |
912 | 980 | ||
913 | self.failUnless(is_list_sequenced(default_column_list)) | 981 | self.assertTrue(is_list_sequenced(default_column_list)) |
914 | 982 | ||
915 | # Search text box background text is "Search recipes" | 983 | # Search text box background text is "Search recipes" |
916 | self.failUnless(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) | 984 | self.assertTrue(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) |
917 | 985 | ||
918 | self.driver.find_element_by_id("search").clear() | 986 | self.driver.find_element_by_id("search").clear() |
919 | self.driver.find_element_by_id("search").send_keys(test_package1) | 987 | self.driver.find_element_by_id("search").send_keys(test_package1) |
@@ -940,7 +1008,7 @@ class toaster_cases(toaster_cases_base): | |||
940 | 1008 | ||
941 | #self.driver.find_element_by_partial_link_text("zlib").click() | 1009 | #self.driver.find_element_by_partial_link_text("zlib").click() |
942 | #self.driver.back() | 1010 | #self.driver.back() |
943 | #self.failUnless(is_list_inverted(inverted_column_list)) | 1011 | #self.assertTrue(is_list_inverted(inverted_column_list)) |
944 | #self.find_element_by_link_text_in_table(self.table_name, 'Recipe').click() | 1012 | #self.find_element_by_link_text_in_table(self.table_name, 'Recipe').click() |
945 | 1013 | ||
946 | table_head_dict = {'Recipe':'recipe__name', 'Recipe file':'recipe_file', 'Section':'recipe_section', \ | 1014 | table_head_dict = {'Recipe':'recipe__name', 'Recipe file':'recipe_file', 'Section':'recipe_section', \ |
@@ -953,52 +1021,52 @@ class toaster_cases(toaster_cases_base): | |||
953 | or (not column_list) : | 1021 | or (not column_list) : |
954 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 1022 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
955 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 1023 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
956 | self.failUnless(is_list_sequenced(column_list) or is_list_inverted(column_list)) | 1024 | self.assertTrue(is_list_sequenced(column_list) or is_list_inverted(column_list)) |
957 | self.driver.find_element_by_partial_link_text("acl").click() | 1025 | self.driver.find_element_by_partial_link_text("acl").click() |
958 | self.driver.back() | 1026 | self.driver.back() |
959 | self.failUnless(is_list_sequenced(column_list) or is_list_inverted(column_list)) | 1027 | self.assertTrue(is_list_sequenced(column_list) or is_list_inverted(column_list)) |
960 | # Search text box background text is "Search recipes" | 1028 | # Search text box background text is "Search recipes" |
961 | self.failUnless(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) | 1029 | self.assertTrue(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) |
962 | self.driver.find_element_by_id("search").clear() | 1030 | self.driver.find_element_by_id("search").clear() |
963 | self.driver.find_element_by_id("search").send_keys(test_package2) | 1031 | self.driver.find_element_by_id("search").send_keys(test_package2) |
964 | self.driver.find_element_by_id("search-button").click() | 1032 | self.driver.find_element_by_id("search-button").click() |
965 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) | 1033 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) |
966 | self.failUnless(is_list_sequenced(column_search_list) or is_list_inverted(column_search_list)) | 1034 | self.assertTrue(is_list_sequenced(column_search_list) or is_list_inverted(column_search_list)) |
967 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1035 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
968 | elif is_list_inverted(column_list): | 1036 | elif is_list_inverted(column_list): |
969 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 1037 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
970 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 1038 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
971 | self.failUnless(is_list_sequenced(column_list)) | 1039 | self.assertTrue(is_list_sequenced(column_list)) |
972 | self.driver.find_element_by_partial_link_text("acl").click() | 1040 | self.driver.find_element_by_partial_link_text("acl").click() |
973 | self.driver.back() | 1041 | self.driver.back() |
974 | self.failUnless(is_list_sequenced(column_list)) | 1042 | self.assertTrue(is_list_sequenced(column_list)) |
975 | # Search text box background text is "Search recipes" | 1043 | # Search text box background text is "Search recipes" |
976 | self.failUnless(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) | 1044 | self.assertTrue(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) |
977 | self.driver.find_element_by_id("search").clear() | 1045 | self.driver.find_element_by_id("search").clear() |
978 | self.driver.find_element_by_id("search").send_keys(test_package2) | 1046 | self.driver.find_element_by_id("search").send_keys(test_package2) |
979 | self.driver.find_element_by_id("search-button").click() | 1047 | self.driver.find_element_by_id("search-button").click() |
980 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) | 1048 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) |
981 | self.failUnless(is_list_sequenced(column_search_list)) | 1049 | self.assertTrue(is_list_sequenced(column_search_list)) |
982 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1050 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
983 | else: | 1051 | else: |
984 | self.failUnless(is_list_sequenced(column_list)) | 1052 | self.assertTrue(is_list_sequenced(column_list)) |
985 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 1053 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
986 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 1054 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
987 | self.failUnless(is_list_inverted(column_list)) | 1055 | self.assertTrue(is_list_inverted(column_list)) |
988 | try: | 1056 | try: |
989 | self.driver.find_element_by_partial_link_text("acl").click() | 1057 | self.driver.find_element_by_partial_link_text("acl").click() |
990 | except: | 1058 | except: |
991 | self.driver.find_element_by_partial_link_text("zlib").click() | 1059 | self.driver.find_element_by_partial_link_text("zlib").click() |
992 | self.driver.back() | 1060 | self.driver.back() |
993 | self.failUnless(is_list_inverted(column_list)) | 1061 | self.assertTrue(is_list_inverted(column_list)) |
994 | # Search text box background text is "Search recipes" | 1062 | # Search text box background text is "Search recipes" |
995 | self.failUnless(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) | 1063 | self.assertTrue(self.driver.find_element_by_xpath("//*[@id='searchform']/*[@placeholder='Search recipes']")) |
996 | self.driver.find_element_by_id("search").clear() | 1064 | self.driver.find_element_by_id("search").clear() |
997 | self.driver.find_element_by_id("search").send_keys(test_package2) | 1065 | self.driver.find_element_by_id("search").send_keys(test_package2) |
998 | self.driver.find_element_by_id("search-button").click() | 1066 | self.driver.find_element_by_id("search-button").click() |
999 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) | 1067 | column_search_list = self.get_table_column_text("class", table_head_dict[key]) |
1000 | #print column_search_list | 1068 | #print column_search_list |
1001 | self.failUnless(is_list_inverted(column_search_list)) | 1069 | self.assertTrue(is_list_inverted(column_search_list)) |
1002 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1070 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
1003 | 1071 | ||
1004 | # Bug 5919 | 1072 | # Bug 5919 |
@@ -1014,7 +1082,7 @@ class toaster_cases(toaster_cases_base): | |||
1014 | #print tasks_column_count | 1082 | #print tasks_column_count |
1015 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) | 1083 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) |
1016 | #print default_column_list | 1084 | #print default_column_list |
1017 | self.failUnless(is_list_sequenced(default_column_list)) | 1085 | self.assertTrue(is_list_sequenced(default_column_list)) |
1018 | 1086 | ||
1019 | self.driver.find_element_by_id("edit-columns-button").click() | 1087 | self.driver.find_element_by_id("edit-columns-button").click() |
1020 | self.driver.find_element_by_id("recipe_file").click() | 1088 | self.driver.find_element_by_id("recipe_file").click() |
@@ -1064,31 +1132,31 @@ class toaster_cases(toaster_cases_base): | |||
1064 | # step 3 | 1132 | # step 3 |
1065 | head_list = self.get_table_head_text('otable') | 1133 | head_list = self.get_table_head_text('otable') |
1066 | for item in ['Recipe', 'Recipe version', 'Recipe file', 'Section', 'License', 'Layer']: | 1134 | for item in ['Recipe', 'Recipe version', 'Recipe file', 'Section', 'License', 'Layer']: |
1067 | self.failUnless(item in head_list) | 1135 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1068 | self.driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() | 1136 | self.driver.find_element_by_id("edit-columns-button").click() |
1069 | self.driver.find_element_by_id("depends_on").click() | 1137 | self.driver.find_element_by_id("depends_on").click() |
1070 | self.driver.find_element_by_id("layer_version__branch").click() | 1138 | self.driver.find_element_by_id("layer_version__branch").click() |
1071 | self.driver.find_element_by_id("layer_version__layer__commit").click() | 1139 | self.driver.find_element_by_id("layer_version__layer__commit").click() |
1072 | self.driver.find_element_by_id("depends_by").click() | 1140 | self.driver.find_element_by_id("depends_by").click() |
1073 | self.driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() | 1141 | self.driver.find_element_by_id("edit-columns-button").click() |
1074 | # check if columns selected above is shown | 1142 | # check if columns selected above is shown |
1075 | check_list = ['Dependencies', 'Layer branch', 'Layer commit', 'Layer directory', 'Reverse dependencies'] | 1143 | check_list = ['Dependencies', 'Layer branch', 'Layer commit', 'Reverse dependencies'] |
1076 | head_list = self.get_table_head_text('otable') | 1144 | head_list = self.get_table_head_text('otable') |
1077 | time.sleep(2) | 1145 | time.sleep(2) |
1078 | print head_list | 1146 | print head_list |
1079 | for item in check_list: | 1147 | for item in check_list: |
1080 | self.failUnless(item in head_list) | 1148 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1081 | # un-check 'em all | 1149 | # un-check 'em all |
1082 | self.driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() | 1150 | self.driver.find_element_by_id("edit-columns-button").click() |
1083 | self.driver.find_element_by_id("depends_on").click() | 1151 | self.driver.find_element_by_id("depends_on").click() |
1084 | self.driver.find_element_by_id("layer_version__branch").click() | 1152 | self.driver.find_element_by_id("layer_version__branch").click() |
1085 | self.driver.find_element_by_id("layer_version__layer__commit").click() | 1153 | self.driver.find_element_by_id("layer_version__layer__commit").click() |
1086 | self.driver.find_element_by_id("depends_by").click() | 1154 | self.driver.find_element_by_id("depends_by").click() |
1087 | self.driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() | 1155 | self.driver.find_element_by_id("edit-columns-button").click() |
1088 | # don't exist any more | 1156 | # don't exist any more |
1089 | head_list = self.get_table_head_text('otable') | 1157 | head_list = self.get_table_head_text('otable') |
1090 | for item in check_list: | 1158 | for item in check_list: |
1091 | self.failIf(item in head_list) | 1159 | self.assertFalse(item in head_list, msg=("item %s should not be in head row" % item)) |
1092 | 1160 | ||
1093 | 1161 | ||
1094 | ############## | 1162 | ############## |
@@ -1104,7 +1172,7 @@ class toaster_cases(toaster_cases_base): | |||
1104 | # step 3 | 1172 | # step 3 |
1105 | head_list = self.get_table_head_text('otable') | 1173 | head_list = self.get_table_head_text('otable') |
1106 | for item in ['Recipe', 'Recipe version', 'Recipe file', 'Section', 'License', 'Layer']: | 1174 | for item in ['Recipe', 'Recipe version', 'Recipe file', 'Section', 'License', 'Layer']: |
1107 | self.failUnless(item in head_list) | 1175 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1108 | # step 4 | 1176 | # step 4 |
1109 | self.driver.find_element_by_id("edit-columns-button").click() | 1177 | self.driver.find_element_by_id("edit-columns-button").click() |
1110 | # save screen | 1178 | # save screen |
@@ -1318,7 +1386,8 @@ class toaster_cases(toaster_cases_base): | |||
1318 | head_list = self.get_table_head_text('otable') | 1386 | head_list = self.get_table_head_text('otable') |
1319 | print head_list | 1387 | print head_list |
1320 | print len(head_list) | 1388 | print len(head_list) |
1321 | self.failUnless(head_list == ['Variable', 'Value', 'Set in file', 'Description']) | 1389 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ |
1390 | msg=("head row contents wrong")) | ||
1322 | # step 8 | 1391 | # step 8 |
1323 | # search other string. and click "Variable" to re-sort, check if table | 1392 | # search other string. and click "Variable" to re-sort, check if table |
1324 | # head is still the same | 1393 | # head is still the same |
@@ -1327,10 +1396,12 @@ class toaster_cases(toaster_cases_base): | |||
1327 | self.driver.find_element_by_id("search-button").click() | 1396 | self.driver.find_element_by_id("search-button").click() |
1328 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1397 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1329 | head_list = self.get_table_head_text('otable') | 1398 | head_list = self.get_table_head_text('otable') |
1330 | self.failUnless(head_list == ['Variable', 'Value', 'Set in file', 'Description']) | 1399 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ |
1400 | msg=("head row contents wrong")) | ||
1331 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1401 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1332 | head_list = self.get_table_head_text('otable') | 1402 | head_list = self.get_table_head_text('otable') |
1333 | self.failUnless(head_list == ['Variable', 'Value', 'Set in file', 'Description']) | 1403 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ |
1404 | msg=("head row contents wrong")) | ||
1334 | 1405 | ||
1335 | 1406 | ||
1336 | ############## | 1407 | ############## |
@@ -1346,11 +1417,11 @@ class toaster_cases(toaster_cases_base): | |||
1346 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() | 1417 | self.find_element_by_link_text_in_table('nav', 'Configuration').click() |
1347 | self.driver.find_element_by_link_text("BitBake variables").click() | 1418 | self.driver.find_element_by_link_text("BitBake variables").click() |
1348 | variable_list = self.get_table_column_text('class', 'variable_name') | 1419 | variable_list = self.get_table_column_text('class', 'variable_name') |
1349 | self.failUnless(is_list_sequenced(variable_list)) | 1420 | self.assertTrue(is_list_sequenced(variable_list), msg=("list not in order")) |
1350 | # step 4 | 1421 | # step 4 |
1351 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1422 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1352 | variable_list = self.get_table_column_text('class', 'variable_name') | 1423 | variable_list = self.get_table_column_text('class', 'variable_name') |
1353 | self.failUnless(is_list_inverted(variable_list)) | 1424 | self.assertTrue(is_list_inverted(variable_list), msg=("list not inverted")) |
1354 | self.find_element_by_link_text_in_table('otable', 'Variable').click() | 1425 | self.find_element_by_link_text_in_table('otable', 'Variable').click() |
1355 | # step 5 | 1426 | # step 5 |
1356 | # searching won't change the sequentiality | 1427 | # searching won't change the sequentiality |
@@ -1358,7 +1429,7 @@ class toaster_cases(toaster_cases_base): | |||
1358 | self.driver.find_element_by_id("search").send_keys("lib") | 1429 | self.driver.find_element_by_id("search").send_keys("lib") |
1359 | self.driver.find_element_by_id("search-button").click() | 1430 | self.driver.find_element_by_id("search-button").click() |
1360 | variable_list = self.get_table_column_text('class', 'variable_name') | 1431 | variable_list = self.get_table_column_text('class', 'variable_name') |
1361 | self.failUnless(is_list_sequenced(variable_list)) | 1432 | self.assertTrue(is_list_sequenced(variable_list), msg=("list not in order")) |
1362 | 1433 | ||
1363 | 1434 | ||
1364 | ############## | 1435 | ############## |
@@ -1372,7 +1443,7 @@ class toaster_cases(toaster_cases_base): | |||
1372 | # Step 2 | 1443 | # Step 2 |
1373 | # default sequence in "Completed on" column is inverted | 1444 | # default sequence in "Completed on" column is inverted |
1374 | c_list = self.get_table_column_text('class', 'completed_on') | 1445 | c_list = self.get_table_column_text('class', 'completed_on') |
1375 | self.failUnless(is_list_inverted(c_list)) | 1446 | self.assertTrue(is_list_inverted(c_list), msg=("list not inverted")) |
1376 | # step 3 | 1447 | # step 3 |
1377 | self.driver.find_element_by_id("edit-columns-button").click() | 1448 | self.driver.find_element_by_id("edit-columns-button").click() |
1378 | self.driver.find_element_by_id("started_on").click() | 1449 | self.driver.find_element_by_id("started_on").click() |
@@ -1380,8 +1451,8 @@ class toaster_cases(toaster_cases_base): | |||
1380 | self.driver.find_element_by_id("time").click() | 1451 | self.driver.find_element_by_id("time").click() |
1381 | self.driver.find_element_by_id("edit-columns-button").click() | 1452 | self.driver.find_element_by_id("edit-columns-button").click() |
1382 | head_list = self.get_table_head_text('otable') | 1453 | head_list = self.get_table_head_text('otable') |
1383 | for item in ['Outcome', 'Target', 'Machine', 'Started on', 'Completed on', 'Failed tasks', 'Errors', 'Warnings', 'Warnings', 'Time']: | 1454 | for item in ['Outcome', 'Recipe', 'Machine', 'Started on', 'Completed on', 'Failed tasks', 'Errors', 'Warnings', 'Warnings', 'Time']: |
1384 | self.failUnless(item in head_list) | 1455 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1385 | 1456 | ||
1386 | 1457 | ||
1387 | ############## | 1458 | ############## |
@@ -1395,7 +1466,7 @@ class toaster_cases(toaster_cases_base): | |||
1395 | # Please refer to case 924 requirement | 1466 | # Please refer to case 924 requirement |
1396 | # default sequence in "Completed on" column is inverted | 1467 | # default sequence in "Completed on" column is inverted |
1397 | c_list = self.get_table_column_text('class', 'completed_on') | 1468 | c_list = self.get_table_column_text('class', 'completed_on') |
1398 | self.failUnless(is_list_inverted(c_list)) | 1469 | self.assertTrue(is_list_inverted(c_list), msg=("list not inverted")) |
1399 | # Step 4 | 1470 | # Step 4 |
1400 | # click Errors , order in "Completed on" should be disturbed. Then hide | 1471 | # click Errors , order in "Completed on" should be disturbed. Then hide |
1401 | # error column to check if order in "Completed on" can be restored | 1472 | # error column to check if order in "Completed on" can be restored |
@@ -1406,7 +1477,7 @@ class toaster_cases(toaster_cases_base): | |||
1406 | # Note: without time.sleep here, there'll be unpredictable error..TBD | 1477 | # Note: without time.sleep here, there'll be unpredictable error..TBD |
1407 | time.sleep(1) | 1478 | time.sleep(1) |
1408 | c_list = self.get_table_column_text('class', 'completed_on') | 1479 | c_list = self.get_table_column_text('class', 'completed_on') |
1409 | self.failUnless(is_list_inverted(c_list)) | 1480 | self.assertTrue(is_list_inverted(c_list), msg=("list not inverted")) |
1410 | 1481 | ||
1411 | 1482 | ||
1412 | ############## | 1483 | ############## |
@@ -1422,7 +1493,7 @@ class toaster_cases(toaster_cases_base): | |||
1422 | self.find_element_by_link_text_in_table('nav', 'Packages').click() | 1493 | self.find_element_by_link_text_in_table('nav', 'Packages').click() |
1423 | check_head_list = ['Package', 'Package version', 'Size', 'Recipe'] | 1494 | check_head_list = ['Package', 'Package version', 'Size', 'Recipe'] |
1424 | head_list = self.get_table_head_text('otable') | 1495 | head_list = self.get_table_head_text('otable') |
1425 | self.failUnless(head_list == check_head_list) | 1496 | self.assertTrue(head_list == check_head_list, msg=("head row not as expected")) |
1426 | # Step 4 | 1497 | # Step 4 |
1427 | # pulldown menu | 1498 | # pulldown menu |
1428 | option_ids = ['recipe__layer_version__layer__name', 'recipe__layer_version__branch', \ | 1499 | option_ids = ['recipe__layer_version__layer__name', 'recipe__layer_version__branch', \ |
@@ -1451,7 +1522,7 @@ class toaster_cases(toaster_cases_base): | |||
1451 | self.find_element_by_link_text_in_table('nav', 'Packages').click() | 1522 | self.find_element_by_link_text_in_table('nav', 'Packages').click() |
1452 | # column -- Package | 1523 | # column -- Package |
1453 | column_list = self.get_table_column_text_by_column_number('otable', 1) | 1524 | column_list = self.get_table_column_text_by_column_number('otable', 1) |
1454 | self.failUnless(is_list_sequenced(column_list)) | 1525 | self.assertTrue(is_list_sequenced(column_list), msg=("list not in order")) |
1455 | self.find_element_by_link_text_in_table('otable', 'Size').click() | 1526 | self.find_element_by_link_text_in_table('otable', 'Size').click() |
1456 | 1527 | ||
1457 | 1528 | ||
@@ -1473,7 +1544,7 @@ class toaster_cases(toaster_cases_base): | |||
1473 | self.driver.find_element_by_id("edit-columns-button").click() | 1544 | self.driver.find_element_by_id("edit-columns-button").click() |
1474 | #get modified table header | 1545 | #get modified table header |
1475 | new_head = self.get_table_head_text('otable') | 1546 | new_head = self.get_table_head_text('otable') |
1476 | self.failUnless(head_list > new_head) | 1547 | self.assertTrue(head_list > new_head) |
1477 | 1548 | ||
1478 | ############## | 1549 | ############## |
1479 | # CASE 943 # | 1550 | # CASE 943 # |
@@ -1490,7 +1561,7 @@ class toaster_cases(toaster_cases_base): | |||
1490 | self.driver.find_element_by_id("search").send_keys("bash") | 1561 | self.driver.find_element_by_id("search").send_keys("bash") |
1491 | self.driver.find_element_by_id("search-button").click() | 1562 | self.driver.find_element_by_id("search-button").click() |
1492 | #check for the search result message "XX packages found" | 1563 | #check for the search result message "XX packages found" |
1493 | self.failUnless(self.is_text_present("packages found")) | 1564 | self.assertTrue(self.is_text_present("packages found"), msg=("no packages found text")) |
1494 | 1565 | ||
1495 | 1566 | ||
1496 | ############## | 1567 | ############## |
@@ -1511,11 +1582,12 @@ class toaster_cases(toaster_cases_base): | |||
1511 | self.driver.find_element_by_id("edit-columns-button").click() | 1582 | self.driver.find_element_by_id("edit-columns-button").click() |
1512 | # otable is the recipes table here | 1583 | # otable is the recipes table here |
1513 | otable_head_text = self.get_table_head_text('otable') | 1584 | otable_head_text = self.get_table_head_text('otable') |
1514 | for item in ["Layer", "Layer branch", "Layer commit", "Layer directory"]: | 1585 | for item in ["Layer", "Layer branch", "Layer commit"]: |
1515 | self.failIf(item not in otable_head_text) | 1586 | self.assertFalse(item not in otable_head_text, msg=("item %s should be in head row" % item)) |
1516 | # click the fist recipe, whatever it is | 1587 | # click the fist recipe, whatever it is |
1517 | self.get_table_element("otable", 1, 1).click() | 1588 | self.get_table_element("otable", 1, 1).click() |
1518 | self.failUnless(self.is_text_present(["Layer", "Layer branch", "Layer commit", "Recipe file"])) | 1589 | self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit", "Recipe file"]), \ |
1590 | msg=("text not in web page")) | ||
1519 | 1591 | ||
1520 | # step 2: test Packages page stuff. almost same as above | 1592 | # step 2: test Packages page stuff. almost same as above |
1521 | self.driver.back() | 1593 | self.driver.back() |
@@ -1528,10 +1600,11 @@ class toaster_cases(toaster_cases_base): | |||
1528 | self.driver.find_element_by_id("edit-columns-button").click() | 1600 | self.driver.find_element_by_id("edit-columns-button").click() |
1529 | otable_head_text = self.get_table_head_text("otable") | 1601 | otable_head_text = self.get_table_head_text("otable") |
1530 | for item in ["Layer", "Layer branch", "Layer commit"]: | 1602 | for item in ["Layer", "Layer branch", "Layer commit"]: |
1531 | self.failIf(item not in otable_head_text) | 1603 | self.assertFalse(item not in otable_head_text, msg=("item %s should be in head row" % item)) |
1532 | # click the fist recipe, whatever it is | 1604 | # click the fist recipe, whatever it is |
1533 | self.get_table_element("otable", 1, 1).click() | 1605 | self.get_table_element("otable", 1, 1).click() |
1534 | self.failUnless(self.is_text_present(["Layer", "Layer branch", "Layer commit"])) | 1606 | self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit"]), \ |
1607 | msg=("text not in web page")) | ||
1535 | 1608 | ||
1536 | # step 3: test Packages core-image-minimal(images) stuff. almost same as above. Note when future element-id changes... | 1609 | # step 3: test Packages core-image-minimal(images) stuff. almost same as above. Note when future element-id changes... |
1537 | self.driver.back() | 1610 | self.driver.back() |
@@ -1543,17 +1616,18 @@ class toaster_cases(toaster_cases_base): | |||
1543 | self.driver.find_element_by_id("edit-columns-button").click() | 1616 | self.driver.find_element_by_id("edit-columns-button").click() |
1544 | otable_head_text = self.get_table_head_text("otable") | 1617 | otable_head_text = self.get_table_head_text("otable") |
1545 | for item in ["Layer", "Layer branch", "Layer commit"]: | 1618 | for item in ["Layer", "Layer branch", "Layer commit"]: |
1546 | self.failIf(item not in otable_head_text) | 1619 | self.assertFalse(item not in otable_head_text, msg=("item %s should be in head row" % item)) |
1547 | # click the fist recipe, whatever it is | 1620 | # click the fist recipe, whatever it is |
1548 | self.get_table_element("otable", 1, 1).click() | 1621 | self.get_table_element("otable", 1, 1).click() |
1549 | self.failUnless(self.is_text_present(["Layer", "Layer branch", "Layer commit"])) | 1622 | self.assertTrue(self.is_text_present(["Layer", "Layer branch", "Layer commit"]), \ |
1623 | msg=("text not in web page")) | ||
1550 | 1624 | ||
1551 | # step 4: check Configuration page | 1625 | # step 4: check Configuration page |
1552 | self.driver.back() | 1626 | self.driver.back() |
1553 | self.driver.find_element_by_link_text("Configuration").click() | 1627 | self.driver.find_element_by_link_text("Configuration").click() |
1554 | otable_head_text = self.get_table_head_text() | 1628 | otable_head_text = self.get_table_head_text() |
1555 | for item in ["Layer", "Layer branch", "Layer commit"]: | 1629 | for item in ["Layer", "Layer branch", "Layer commit"]: |
1556 | self.failIf(item not in otable_head_text) | 1630 | self.assertTrue(item not in otable_head_text, msg=("item %s should not be in head row" % item)) |
1557 | 1631 | ||
1558 | 1632 | ||
1559 | ############## | 1633 | ############## |
@@ -1578,14 +1652,14 @@ class toaster_cases(toaster_cases_base): | |||
1578 | # Sure we can use driver.get(url) to refresh page, but since page will vary, we use click link text here | 1652 | # Sure we can use driver.get(url) to refresh page, but since page will vary, we use click link text here |
1579 | self.driver.find_element_by_link_text(items).click() | 1653 | self.driver.find_element_by_link_text(items).click() |
1580 | Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_visible_text(str(rows_displayed)) | 1654 | Select(self.driver.find_element_by_css_selector("select.pagesize")).select_by_visible_text(str(rows_displayed)) |
1581 | self.failUnless(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) | 1655 | self.assertTrue(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) |
1582 | self.failIf(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) | 1656 | self.assertFalse(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) |
1583 | 1657 | ||
1584 | # click 1st package, then go back to check if it's still those rows shown. | 1658 | # click 1st package, then go back to check if it's still those rows shown. |
1585 | self.driver.find_element_by_xpath(xpath_table + "/tr[1]/td[1]").click() | 1659 | self.driver.find_element_by_xpath(xpath_table + "/tr[1]/td[1]").click() |
1586 | self.driver.find_element_by_link_text(items).click() | 1660 | self.driver.find_element_by_link_text(items).click() |
1587 | self.failUnless(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) | 1661 | self.assertTrue(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed) +"]")) |
1588 | self.failIf(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) | 1662 | self.assertFalse(self.is_element_present(By.XPATH, xpath_table + "/tr[" + str(rows_displayed+1) +"]")) |
1589 | 1663 | ||
1590 | 1664 | ||
1591 | ############## | 1665 | ############## |
@@ -1676,7 +1750,7 @@ class toaster_cases(toaster_cases_base): | |||
1676 | check_list = ['Description', 'Set in file'] | 1750 | check_list = ['Description', 'Set in file'] |
1677 | head_list = self.get_table_head_text('otable') | 1751 | head_list = self.get_table_head_text('otable') |
1678 | for item in check_list: | 1752 | for item in check_list: |
1679 | self.failIf(item in head_list) | 1753 | self.assertFalse(item in head_list, msg=("item %s should not be in head row" % item)) |
1680 | # check these 2 options and verify again | 1754 | # check these 2 options and verify again |
1681 | self.driver.find_element_by_id('edit-columns-button').click() | 1755 | self.driver.find_element_by_id('edit-columns-button').click() |
1682 | self.driver.find_element_by_xpath(xpath_option('description')).click() | 1756 | self.driver.find_element_by_xpath(xpath_option('description')).click() |
@@ -1684,7 +1758,7 @@ class toaster_cases(toaster_cases_base): | |||
1684 | self.driver.find_element_by_id('edit-columns-button').click() | 1758 | self.driver.find_element_by_id('edit-columns-button').click() |
1685 | head_list = self.get_table_head_text('otable') | 1759 | head_list = self.get_table_head_text('otable') |
1686 | for item in check_list: | 1760 | for item in check_list: |
1687 | self.failUnless(item in head_list) | 1761 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1688 | 1762 | ||
1689 | 1763 | ||
1690 | ############## | 1764 | ############## |
@@ -1706,7 +1780,7 @@ class toaster_cases(toaster_cases_base): | |||
1706 | self.driver.find_element_by_id("search-button").click() | 1780 | self.driver.find_element_by_id("search-button").click() |
1707 | #get number of variables visible after search | 1781 | #get number of variables visible after search |
1708 | number_after_search = self.driver.find_element_by_class_name('page-header').text | 1782 | number_after_search = self.driver.find_element_by_class_name('page-header').text |
1709 | self.failUnless(number_before_search > number_after_search) | 1783 | self.assertTrue(number_before_search > number_after_search, msg=("items should be less after search")) |
1710 | 1784 | ||
1711 | 1785 | ||
1712 | ############## | 1786 | ############## |
@@ -1725,11 +1799,11 @@ class toaster_cases(toaster_cases_base): | |||
1725 | self.driver.find_element_by_partial_link_text("Directory structure") | 1799 | self.driver.find_element_by_partial_link_text("Directory structure") |
1726 | except Exception,e: | 1800 | except Exception,e: |
1727 | self.log.error(e) | 1801 | self.log.error(e) |
1728 | self.failIf(True) | 1802 | self.assertFalse(True) |
1729 | # step 4 | 1803 | # step 4 |
1730 | head_list = self.get_table_head_text('otable') | 1804 | head_list = self.get_table_head_text('otable') |
1731 | for item in ['Package', 'Package version', 'Size', 'Dependencies', 'Reverse dependencies', 'Recipe']: | 1805 | for item in ['Package', 'Package version', 'Size', 'Dependencies', 'Reverse dependencies', 'Recipe']: |
1732 | self.failUnless(item in head_list) | 1806 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1733 | # step 5-6 | 1807 | # step 5-6 |
1734 | self.driver.find_element_by_id("edit-columns-button").click() | 1808 | self.driver.find_element_by_id("edit-columns-button").click() |
1735 | selectable_class = 'checkbox' | 1809 | selectable_class = 'checkbox' |
@@ -1749,22 +1823,15 @@ class toaster_cases(toaster_cases_base): | |||
1749 | unselectable_list.append(element.text) | 1823 | unselectable_list.append(element.text) |
1750 | # check them | 1824 | # check them |
1751 | for item in selectable_check_list: | 1825 | for item in selectable_check_list: |
1752 | if item not in selectable_list: | 1826 | self.assertTrue(item in selectable_list, msg=("%s not found in dropdown menu" % item)) |
1753 | self.log.error(" %s not found in dropdown menu \n" % item) | ||
1754 | self.failIf(True) | ||
1755 | for item in unselectable_check_list: | 1827 | for item in unselectable_check_list: |
1756 | if item not in unselectable_list: | 1828 | self.assertTrue(item in unselectable_list, msg=("%s not found in dropdown menu" % item)) |
1757 | self.log.error(" %s not found in dropdown menu \n" % item) | ||
1758 | self.failIf(True) | ||
1759 | self.driver.find_element_by_id("edit-columns-button").click() | 1829 | self.driver.find_element_by_id("edit-columns-button").click() |
1760 | # step 7 | 1830 | # step 7 |
1761 | self.driver.find_element_by_partial_link_text("Directory structure").click() | 1831 | self.driver.find_element_by_partial_link_text("Directory structure").click() |
1762 | head_list = self.get_table_head_text('dirtable') | 1832 | head_list = self.get_table_head_text('dirtable') |
1763 | for item in ['Directory / File', 'Symbolic link to', 'Source package', 'Size', 'Permissions', 'Owner', 'Group']: | 1833 | for item in ['Directory / File', 'Symbolic link to', 'Source package', 'Size', 'Permissions', 'Owner', 'Group']: |
1764 | if item not in head_list: | 1834 | self.assertTrue(item in head_list, msg=("%s not found in Directory structure table head" % item)) |
1765 | self.log.error(" %s not found in Directory structure table head \n" % item) | ||
1766 | self.failIf(True) | ||
1767 | |||
1768 | 1835 | ||
1769 | ############## | 1836 | ############## |
1770 | # CASE 950 # | 1837 | # CASE 950 # |
@@ -1794,12 +1861,11 @@ class toaster_cases(toaster_cases_base): | |||
1794 | try: | 1861 | try: |
1795 | self.find_element_by_link_text_in_table('nav', item) | 1862 | self.find_element_by_link_text_in_table('nav', item) |
1796 | except Exception: | 1863 | except Exception: |
1797 | self.log.error("link %s cannot be found in the page" % item) | 1864 | self.assertFalse(True, msg=("link %s cannot be found in the page" % item)) |
1798 | self.failIf(True) | ||
1799 | # step 6 | 1865 | # step 6 |
1800 | check_list_2 = ['Packages included', 'Total package size', \ | 1866 | check_list_2 = ['Packages included', 'Total package size', \ |
1801 | 'License manifest', 'Image files'] | 1867 | 'License manifest', 'Image files'] |
1802 | self.failUnless(self.is_text_present(check_list_2)) | 1868 | self.assertTrue(self.is_text_present(check_list_2), msg=("text not in web page")) |
1803 | self.driver.back() | 1869 | self.driver.back() |
1804 | try: | 1870 | try: |
1805 | fail_icon = self.driver.find_element_by_xpath("//*[@class='icon-minus-sign error']") | 1871 | fail_icon = self.driver.find_element_by_xpath("//*[@class='icon-minus-sign error']") |
@@ -1816,12 +1882,11 @@ class toaster_cases(toaster_cases_base): | |||
1816 | try: | 1882 | try: |
1817 | self.find_element_by_link_text_in_table('nav', item) | 1883 | self.find_element_by_link_text_in_table('nav', item) |
1818 | except Exception: | 1884 | except Exception: |
1819 | self.log.error("link %s cannot be found in the page" % item) | 1885 | self.assertFalse(True, msg=("link %s cannot be found in the page" % item)) |
1820 | self.failIf(True) | ||
1821 | # step 7 involved | 1886 | # step 7 involved |
1822 | check_list_3 = ['Machine', 'Distro', 'Layers', 'Total number of tasks', 'Tasks executed', \ | 1887 | check_list_3 = ['Machine', 'Distro', 'Layers', 'Total number of tasks', 'Tasks executed', \ |
1823 | 'Tasks not executed', 'Reuse', 'Recipes built', 'Packages built'] | 1888 | 'Tasks not executed', 'Reuse', 'Recipes built', 'Packages built'] |
1824 | self.failUnless(self.is_text_present(check_list_3)) | 1889 | self.assertTrue(self.is_text_present(check_list_3), msg=("text not in web page")) |
1825 | self.driver.back() | 1890 | self.driver.back() |
1826 | 1891 | ||
1827 | 1892 | ||
@@ -1881,6 +1946,5 @@ class toaster_cases(toaster_cases_base): | |||
1881 | tasks, recipes, packages need to run manually") | 1946 | tasks, recipes, packages need to run manually") |
1882 | self.driver.find_element_by_partial_link_text("Toaster manual").click() | 1947 | self.driver.find_element_by_partial_link_text("Toaster manual").click() |
1883 | if not self.is_text_present("Toaster Manual"): | 1948 | if not self.is_text_present("Toaster Manual"): |
1884 | self.log.error("please check [Toaster manual] link on page") | 1949 | self.assertFalse(True, msg=("please check [Toaster manual] link on page")) |
1885 | self.failIf(True) | ||
1886 | 1950 | ||