def test_post_raw_data_xml(self):
     self.set_request_cookie('gman')
     self.set_payload({
         "stateCode": "NC",
         "asmtYear": "2015",
         "asmtType": "SUMMATIVE",
         "asmtSubject": "ELA",
         "asmtGrade": "04"
     })
     self.send_request("POST", "/services/extract/raw_data")
     self.check_response_code(200)
     self.check_not_error_page()
     self.open_requested_page_redirects_login_page("state_view_sds")
     self.enter_login_credentials('gman', 'gman1234')
     elements = self._response.json()['files']
     for each in elements:
         url = (each['web_download_url'])
         file_name = (each['fileName'])
         print(url)
         print(file_name)
         browser().get(url)
         save_screen('/tmp/screenshot_rawdata1.png')
         downloaded_xml_file = DOWNLOAD_DIRECTORY + file_name
         self.files_to_cleanup_at_end.append(downloaded_xml_file)
         self.unzip_file_to_directory(downloaded_xml_file,
                                      UNZIPPED_XML_FILE)
     # ToDo: 0 is incorrect expectation according to logic
     self.assertEqual(
         len(fnmatch.filter(os.listdir(UNZIPPED_XML_FILE), '*.xml')), 0,
         "Raw data XML file count is wrong")
Esempio n. 2
0
    def check_progress_bar_tooltip_is_found(self, section, expected_legend):
        """
        Validates the progress bar tool tip displayed on mouse over over the progress bar in comparing populations report
        :param expected_legend: list of lists of each ALD section. Expected data format for math/ela_progress bar:
        [[bar section index(int type), bar section background hexadecimal color code(string type with preceding #), section % (string type)]]
        :type expected_legend: list
        :param section: section where you need to validate the progress bar
        :type section: string
        """
        element_to_click = browser().find_element_by_class_name("ui-jqgrid-ftable").find_element_by_class_name(
            "progress").find_element_by_class_name("bar")
        hover_mouse = ActionChains(browser()).move_to_element(element_to_click)
        hover_mouse.perform()
        wait_for(lambda driver: driver.find_element_by_class_name("popover"))

        popover_legend = browser().find_element_by_class_name("popover-content").find_elements_by_tag_name("li")
        for each in expected_legend:
            save_screen('/tmp/screenshot_tooltip.png')
            rgb_color = self.get_rgb_equivalent(each[1])
            self.assertIn(rgb_color, str(popover_legend[each[0]].find_element_by_tag_name("div").get_attribute(
                "style"))), "Tooltip legend color does not match."
            time.sleep(3)
            self.assertEqual(each[2], str(popover_legend[each[0]].text)), "Tooltip legend score and % does not match."
        temp = browser().find_element_by_class_name("ui-jqgrid-ftable").find_element_by_class_name("summaryTitle")
        hover_mouse_out = ActionChains(browser()).move_to_element(temp)
        hover_mouse_out.perform()
Esempio n. 3
0
 def check_print_popover_contents(self, print_popover, pdf_type):
     self.assertEqual(
         str(
             print_popover.find_element_by_id("myModalLabel").get_attribute(
                 "innerHTML")), "Print",
         "Pdf print popup header incorrectly displayed")
     print_option = print_popover.find_element_by_class_name(
         "modal-body").find_elements_by_tag_name("input")
     wait_for(
         expected_conditions.element_to_be_clickable(
             (By.XPATH, "//div[@id='PrintModal']//input[@name='print']")))
     wait_for(
         expected_conditions.element_to_be_clickable(
             (By.XPATH, "//div[@id='PrintModal']//button")))
     if pdf_type == "grayscale":
         option = print_option[0]
     elif pdf_type == "color":
         option = print_option[1]
     else:
         raise Exception("incorrect pdf color specified")
     option.click()
     save_screen('/tmp/pdf_debug.png')
     print_button = print_popover.find_element_by_class_name(
         "modal-footer").find_element_by_class_name("btn")
     print_button.click()
Esempio n. 4
0
 def check_iab_column_headers(self, expected_cols):
     wait_for(expected_conditions.visibility_of_element_located((By.CLASS_NAME, "detailsItem")))
     grid_heading_element = browser().find_element_by_class_name("ui-jqgrid-htable").find_element_by_class_name(
         "jqg-second-row-header")
     grid_heading = grid_heading_element.get_attribute('textContent')
     expected_text = ''.join(str(each) for each in expected_cols)
     self.assertEqual(expected_text, grid_heading, "The grid headings are not listed")
     # grid_headers = [elem.text for elem in browser().find_elements_by_css_selector(".ui-jqgrid-htable .jqg-second-row-header th[role='columnheader'] div") if elem.text]
     # self.assertEqual(len(expected_cols), len(grid_headers), "Invalid number of IAB columns found.")
     save_screen('/tmp/check_iab_column_headers.png')
Esempio n. 5
0
 def test_ethnicity_filter(self):
     self.drill_down_navigation("228", "ui-jqgrid-ftable")
     self.drill_down_navigation("242", "ui-jqgrid-ftable")
     filter_popup = self.open_filter_menu()
     self.select_ethnicity_filter(filter_popup, ["Asian*"], '9% reported "not stated"')
     self.close_filter_menu(filter_popup, "apply")
     self.check_overall_filtered_count("4", "Out of 35 students", "4", "Out of 35 students")
     self.check_filter_bar(["Race/Ethnicity: Asian"])
     browser().find_element_by_link_text("North Carolina").click()
     try:
         wait_for(expected_conditions.visibility_of_element_located((By.CLASS_NAME, "ui-jqgrid-view")))
     except:
         save_screen('/tmp/screenshot.png')
     self.check_filter_bar(["Race/Ethnicity: Asian"])
     self.check_overall_filtered_count("11", "Out of 89 students", "8", "Out of 77 students")
Esempio n. 6
0
 def check_print_popover_contents(self, print_popover, pdf_type):
     self.assertEqual(str(print_popover.find_element_by_id("myModalLabel").get_attribute("innerHTML")), "Print",
                      "Pdf print popup header incorrectly displayed")
     print_option = print_popover.find_element_by_class_name("modal-body").find_elements_by_tag_name("input")
     wait_for(
         expected_conditions.element_to_be_clickable((By.XPATH, "//div[@id='PrintModal']//input[@name='print']")))
     wait_for(expected_conditions.element_to_be_clickable((By.XPATH, "//div[@id='PrintModal']//button")))
     if pdf_type == "grayscale":
         option = print_option[0]
     elif pdf_type == "color":
         option = print_option[1]
     else:
         raise Exception("incorrect pdf color specified")
     option.click()
     save_screen('/tmp/pdf_debug.png')
     print_button = print_popover.find_element_by_class_name("modal-footer").find_element_by_class_name("btn")
     print_button.click()
Esempio n. 7
0
 def test_ethnicity_filter(self):
     self.drill_down_navigation("228", "ui-jqgrid-ftable")
     self.drill_down_navigation("242", "ui-jqgrid-ftable")
     filter_popup = self.open_filter_menu()
     self.select_ethnicity_filter(filter_popup, ["Asian*"],
                                  '9% reported "not stated"')
     self.close_filter_menu(filter_popup, "apply")
     self.check_overall_filtered_count("4", "Out of 35 students", "4",
                                       "Out of 35 students")
     self.check_filter_bar(["Race/Ethnicity: Asian"])
     browser().find_element_by_link_text("North Carolina").click()
     try:
         wait_for(
             expected_conditions.visibility_of_element_located(
                 (By.CLASS_NAME, "ui-jqgrid-view")))
     except:
         save_screen('/tmp/screenshot.png')
     self.check_filter_bar(["Race/Ethnicity: Asian"])
     self.check_overall_filtered_count("11", "Out of 89 students", "8",
                                       "Out of 77 students")
Esempio n. 8
0
 def check_opportunity_selectors(self, ex_options):
     """
     Validate all the opportunity selector options in the LOS assessment drop down
     """
     dropdown = browser().find_element_by_class_name("asmtDropdown")
     dropdown.find_element_by_tag_name("button").click()
     options = dropdown.find_element_by_class_name("asmtDropdownMenu").find_elements_by_class_name('asmtSelection')
     actual_options = []
     expected_options = []
     for each in ex_options:
         expected_options.append(each)
     for each in options:
         actual_options.append((each.text))
     print(expected_options)
     print(actual_options)
     save_screen('/tmp/check_opportunity_selectors1.png')
     self.assertEqual(expected_options, actual_options,
                      "Opportunity selector options do not match the expected options on LOS")
     dropdown.find_element_by_tag_name("button").click()
     save_screen('/tmp/check_opportunity_selectors2.png')
Esempio n. 9
0
 def test_iab_expand_columns(self):
     self.drill_down_navigation("228", "ui-jqgrid-ftable")
     self.drill_down_navigation("248", "ui-jqgrid-ftable")
     self.drill_down_navigation("11", "jqgfirstrow")
     self.select_academic_year_los(6, "2014 - 2015")
     self.select_academic_year_los(6, "2015 - 2016")
     self.check_current_selected_opportunity('2015 - 2016 · Summative')
     self.total_los_records(3)
     save_screen('/tmp/test_iab_expand_columns.png')
     # self.check_opportunity_selectors(['2015.04.04 · Summative', '2015.01.06 · Interim Comprehensive', '2014.09.02 · Interim Comprehensive', '2014 - 2015 · Interim Assessment Blocks'])
     self.select_opportunity_los('Interim Assessment Blocks')
     self.check_iab_column_headers(
         ['Students', 'Algebra and Functions - Line...', 'Algebra and Functions - Poly...', 'Geometry - Circles',
          'Making Inferences and Justif...'])
     self.check_current_subject_view("Mathematics")
     self.validate_interim_disclaimer()
     # self.validate_iab_disclaimer("grade 11")
     students = ['Askew, Jose', 'Richardson, Angelica']
     self.check_student_record(students)
     self.total_iab_los_records(2)
Esempio n. 10
0
 def select_opportunity_los(self, selection):
     """
     Select o view from the opportunity selector dropdown from LOS report
     :param selection: Expected selection of assessment view from LOS report
     :type selection: String
     """
     wait_for(expected_conditions.visibility_of_element_located((By.CLASS_NAME, "detailsItem")))
     dropdown = browser().find_element_by_class_name("asmtDropdown")
     dropdown.find_element_by_tag_name("button").click()
     all_options = dropdown.find_element_by_class_name("asmtDropdownMenu").find_elements_by_class_name(
         'asmtSelection')
     for each in all_options:
         """
         Another way to handle the unicode encode error is to encode the expected result and then compare it with the actual text
         for eg: Replace . with · in the expected text like "2016.01.01 · Grade 3 · Interim Comprehensive" and then
         if selection in each.text.encode('ascii', 'xmlcharrefreplace'):
         """
         if selection in each.text:
             section = each
     section.click()
     save_screen('/tmp/select_opportunity_los2.png')
 def test_iab_expand_columns(self):
     self.drill_down_navigation("228", "ui-jqgrid-ftable")
     self.drill_down_navigation("248", "ui-jqgrid-ftable")
     self.drill_down_navigation("11", "jqgfirstrow")
     self.select_academic_year_los(6, "2014 - 2015")
     self.select_academic_year_los(6, "2015 - 2016")
     self.check_current_selected_opportunity('2015 - 2016 · Summative')
     self.total_los_records(3)
     save_screen('/tmp/test_iab_expand_columns.png')
     # self.check_opportunity_selectors(['2015.04.04 · Summative', '2015.01.06 · Interim Comprehensive', '2014.09.02 · Interim Comprehensive', '2014 - 2015 · Interim Assessment Blocks'])
     self.select_opportunity_los('Interim Assessment Blocks')
     self.check_iab_column_headers([
         'Students', 'Algebra and Functions - Line...',
         'Algebra and Functions - Poly...', 'Geometry - Circles',
         'Making Inferences and Justif...'
     ])
     self.check_current_subject_view("Mathematics")
     self.validate_interim_disclaimer()
     # self.validate_iab_disclaimer("grade 11")
     students = ['Askew, Jose', 'Richardson, Angelica']
     self.check_student_record(students)
     self.total_iab_los_records(2)
Esempio n. 12
0
    def test_color_pdf(self):
        print("TC_COLOR_PDF: Validate that the pdf is printed from the UI and a directory structure is available.")
        self.drill_down_navigation("228", "ui-jqgrid-ftable")
        self.drill_down_navigation("242", "ui-jqgrid-ftable")
        self.drill_down_navigation("03", "jqgfirstrow")
        save_screen('/tmp/test_color_pdf.png')
        # Click on 'Lettie L Hose' student link from list of students
        self.drill_down_navigation("jqg26", "overallScoreSection")

        print("PDF: Click on the print button to generate a pdf.")
        browser().find_element_by_class_name("printLabel").click()
        wait_for(expected_conditions.visibility_of_element_located((By.CLASS_NAME, "modal-backdrop")))
        print_popup = browser().find_element_by_id("PrintModal")
        self.check_print_popover_contents(print_popup, "color")
        time.sleep(20)
        print("PDF: Validate if the directory structure is available.")
        assert os.path.isdir(_pdfs + "/NC/2016/228/242/03/isr/SUMMATIVE")

        print("PDF: Validate if the pdf file is stored inside the directory structure.")
        assert os.path.isfile(
            _pdfs + "/NC/2016/228/242/03/isr/SUMMATIVE/dae1acf4-afb0-4013-90ba-9dcde4b25621.20160410.en.pdf")
        print("PDF: Color pdf tests passed.")
Esempio n. 13
0
 def test_post_raw_data_xml(self):
     self.set_request_cookie('gman')
     self.set_payload(
         {"stateCode": "NC", "asmtYear": "2015", "asmtType": "SUMMATIVE", "asmtSubject": "ELA",
          "asmtGrade": "04"})
     self.send_request("POST", "/services/extract/raw_data")
     self.check_response_code(200)
     self.check_not_error_page()
     self.open_requested_page_redirects_login_page("state_view_sds")
     self.enter_login_credentials('gman', 'gman1234')
     elements = self._response.json()['files']
     for each in elements:
         url = (each['web_download_url'])
         file_name = (each['fileName'])
         print(url)
         print(file_name)
         browser().get(url)
         save_screen('/tmp/screenshot_rawdata1.png')
         downloaded_xml_file = DOWNLOAD_DIRECTORY + file_name
         self.files_to_cleanup_at_end.append(downloaded_xml_file)
         self.unzip_file_to_directory(downloaded_xml_file, UNZIPPED_XML_FILE)
     # ToDo: 0 is incorrect expectation according to logic
     self.assertEqual(len(fnmatch.filter(os.listdir(UNZIPPED_XML_FILE), '*.xml')), 0,
                      "Raw data XML file count is wrong")
Esempio n. 14
0
 def sort_by_asmt(self, asmt, expected_top_row, expected_header):
     """
     Validates the sort functionality on the CPOP reports
     :param asmt: assessment to sort by. Valid options are math and ela
     :type asmt: string
     :param menu_position: index of sort option where: 0 - sort by red; 1 = sort by green & blue; 2 = sort by blue; 3 = sort by total students
     :type menu_position: integer
     :param order: sort order where valid options are asc and desc
     :type order: string
     :param expected_top_row: expected name of the top most row in the grid after sorting.
     :type expected_top_row: string
     """
     # TODO
     if asmt == 'Math':
         index = 1
     else:
         index = 3
     columns = browser().find_elements_by_class_name("ui-th-column")
     columns[index].find_element_by_class_name("s-ico").click()
     self.check_topmost_row(expected_top_row)
     save_screen('/tmp/nidhi_sort_temp.png')
     new_columns = browser().find_elements_by_class_name("ui-th-column")
     print(str(new_columns[index].text))
     print(expected_header)
Esempio n. 15
0
 def check_current_selected_opportunity(self, expected_value):
     wait_for(expected_conditions.visibility_of_element_located((By.CLASS_NAME, "detailsItem")))
     save_screen('/tmp/check_current_selected_opportunity2.png')
     dropdown = browser().find_element_by_class_name("asmtDropdown")
     dropdown_value = dropdown.find_element_by_id("selectedAsmtType").text
     self.assertEqual(expected_value, dropdown_value, "Current opportunity selector is invalid on LOS.")