def get_enrollment(self, json_file, name_of_dict):
     """
     This method return dictionary from json by name.
     :param json_file: is name of json file.
     :param name_of_dict: is name of dictionary in json file.
     :return: dictionary.
     """
     fill_enrollment = FillEnrollment()
     return fill_enrollment.create_enrollment_from_json(json_file, name_of_dict)
def test_enrollment_verify(app):
    person_enrollment = app.person_enrollment_view_page

    app.person_main_view_page.person_enrollment_button().click()
    person_enrollment.wait_until_page_generate()

    # Валера должен сделать json который в себе хранит множество заявок
    enrollments = FillEnrollment()
    expected_enrollment = enrollments.create_enrollment_from_json("fill_enrollment_main_test_view.json", "1")

    # if(len(person.documents) > 0):
    assert person_enrollment.is_table_enrollment_present() == True
    # else:
    #     assert app.person_papers_view_page.is_table_present() == False
    if(expected_enrollment is None):
        assert person_enrollment.get_text_not_have_enrollment().text == u"У даної персони немає заяв"
        return

    expected_enrollments = []
    for enrollment in range(1):
        row = []
        row.append(expected_enrollment.get_text_privilege_for_view(expected_enrollment.checkbox_is_privilege))
        row.append(expected_enrollment.series_of_statements)
        row.append(expected_enrollment.number_statements)
        row.append(expected_enrollment.get_text_hostel_for_view(expected_enrollment.checkbox_is_hostel))
        row.append(expected_enrollment.get_day_of_entry_str_for_view())
        expected_enrollments.append(row)

    expected_count_documents = len(expected_enrollments)
    actual_count_row_in_table = person_enrollment.get_count_row_in_table_enrollment()
    assert actual_count_row_in_table == expected_count_documents

    actual_table = TestTable(person_enrollment.driver, person_enrollment.TABLE, row_xpath=person_enrollment.ROW, cell_xpath=person_enrollment.CELL)

    for i in range(1, actual_table.try_get_table_data_height() + 1):
        # 3 - We begin from "Наявність пільг" because number and id we did't type when created enrollment
        for j in range(3, actual_table.try_get_table_data_width() + 1):
            assert actual_table.try_get_cell_ij(i, j).text == expected_enrollments[i - 1][j - 3]
    def test_enrollment_verify(self):
        try:
            person_enrollment = self.app.person_enrollment_view_page
            self.app.person_main_view_page.person_enrollment_button().click()
            person_enrollment.wait_until_page_generate()

            enrollments = FillEnrollment()
            expected_enrollment = enrollments.create_enrollment_from_json("fill_enrollment_main_test_view.json", "1")

            assert person_enrollment.is_table_enrollment_present() == True

            if expected_enrollment is None:
                assert person_enrollment.get_text_not_have_enrollment().text == u"У даної персони немає заяв"
                return

            expected_enrollments = []
            for enrollment in range(1):
                row = [expected_enrollment.get_text_privilege_for_view(expected_enrollment.checkbox_is_privilege),
                       expected_enrollment.series_of_statements,
                       expected_enrollment.number_statements,
                       expected_enrollment.get_text_hostel_for_view(expected_enrollment.checkbox_is_hostel),
                       expected_enrollment.get_day_of_entry_str_for_view()]
                expected_enrollments.append(row)

            expected_count_documents = len(expected_enrollments)
            actual_count_row_in_table = person_enrollment.get_count_row_in_table_enrollment()
            assert actual_count_row_in_table == expected_count_documents

            actual_table = TestTable(person_enrollment.driver, person_enrollment.TABLE,
                                     row_xpath=person_enrollment.ROW, cell_xpath=person_enrollment.CELL)

            for i in range(1, actual_table.try_get_table_data_height() + 1):
                # 3 - We begin from "Наявність пільг" because number and id we did't type when created enrollment
                for j in range(3, actual_table.try_get_table_data_width() + 1):
                    assert actual_table.try_get_cell_ij(i, j).text == expected_enrollments[i - 1][j - 3]
        except AssertionError:
            allure.attach('screenshot', self.app.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
            raise