def test_verify_all_checkboxes(self, app, enrollment):
     with pytest.allure.step('Assert all checkboxes'):
         is_state_checked = is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_state())
         is_contract_checked = is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_contract())
         is_privilege_checked = is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_privilege())
         is_hostel_checked = is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_hostel())
         document_is_original = is_checkbox_checked(app.enrollments_main_page.checkbox_document_is_original)
         try:
             assert enrollment.checkbox_is_state == is_state_checked
             assert enrollment.checkbox_is_contract == is_contract_checked
             assert enrollment.checkbox_is_privilege == is_privilege_checked
             assert enrollment.checkbox_is_hostel == is_hostel_checked
             assert enrollment.checkbox_document_is_original == document_is_original
         except AssertionError:
             allure.attach('screenshot', app.enrollments_page.driver.get_screenshot_as_png(), type=AttachmentType.PNG)
             raise
    def fill_in_address_page(self, person):
        """
        Method fill in data on the address persons page
        :param person: persons model in Person format
        :return:
        """
        self.is_this_page()
        for i in range(0, len(person.burn_place)):
            self.select_birth_place(person.burn_place[i], i)

        for i in range(0, len(person.registration_place["area"])):
            self.select_registration_address(person.registration_place["area"][i], i)

        self.set_zip_code(person.registration_place["index"])
        self.reg_address_type_select(person.registration_place["type"])
        self.set_street(person.registration_place["street"])
        self.set_house(person.registration_place["house"])
        self.set_apartment(person.registration_place["apartment"])
        self.check_is_reg_and_post_addresses_the_same(person.registration_place["is_addresses_match"])
        if not is_checkbox_checked(self.driver.find_element(*self.IS_ADDRESSES_MATCH)):

            for i in range(0, len(person.post_registration_place["area"])):
                self.select_post_registration_address(person.registration_place["area"][i], i)

            self.set_post_zip_code(person.post_registration_place["index"])
            self.post_address_type_select(person.post_registration_place["type"])
            self.set_street_for_post_address(person.post_registration_place["street"])
            self.set_house_for_post_address(person.post_registration_place["house"])
            self.set_apartment_for_post_address(person.post_registration_place["apartment"])
 def test_view_enrollment(self, logout_login, enrollment, screenshot):
     with pytest.allure.step('Authorize to the application and view enrollment page'):
         app = logout_login
         app.internal_page.enrollments_page_link.click()
         app.enrollments_page.is_this_page()
     with pytest.allure.step('Search enrollment which was added'):
         actual_search = app.enrollments_page.search_enrollment(app.enrollments_page.SEARCH_METHOD["document_number"], str(enrollment.number_statements))
     with pytest.allure.step('Assert document number is the same document number which was added'):
         screenshot.assert_and_get_screenshot(app, str(enrollment.number_statements) == actual_search[0])
     with pytest.allure.step('View added enrollment'):
         app.enrollments_page.edit_button_on_first_row_click()
     with pytest.allure.step('Assert series of enrollment is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, app.enrollments_main_page.find_series_of_statements().get_attribute("value") == enrollment.series_of_statements)
     with pytest.allure.step('Assert number of enrollment is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, app.enrollments_main_page.find_number_statements().get_attribute("value") == str(enrollment.number_statements))
     with pytest.allure.step('Assert "is state" checkbox of enrollment is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_state()) == enrollment.checkbox_is_state)
     with pytest.allure.step('Assert "is contract" checkbox is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_contract()) == enrollment.checkbox_is_contract)
         assert is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_contract()) == enrollment.checkbox_is_contract
     with pytest.allure.step('Assert "is privilege" checkbox is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_contract()) == enrollment.checkbox_is_contract)
     with pytest.allure.step('Assert "is hostel" checkbox is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_hostel()) == enrollment.checkbox_is_hostel)
         assert is_checkbox_checked(app.enrollments_main_page.find_checkbox_is_hostel()) == enrollment.checkbox_is_hostel
     with pytest.allure.step('Assert total score is the same as from input data'):
         screenshot.assert_and_get_screenshot(app, app.enrollments_main_page.find_total_score().get_attribute("value") == str(enrollment.total_score))
Ejemplo n.º 4
0
 def read_in_extra_person_page(self, person_new):
     """
     Method read the data on the extra persons page
     :param person_new: persons model in Person format
     :return:
     """
     common_methods = CommonMethods(self.driver)
     self.is_this_page
     person_new.birth_day = common_methods.get_value_from_text_field(
         self.driver.find_element(*self.ACTIVATE_BIRTH_DAY_CHOOSER))
     person_new.sex = self.sex_types_select().text
     person_new.marital_status = self.marital_status_select().text
     person_new.nationality = self.nationality_select().text
     person_new.private_case_chars = common_methods.get_value_from_text_field(
         self.driver.find_element(*self.PRIVATE_CASE_CHARS_INPUT)).encode('cp1251')
     person_new.private_case_number = common_methods.get_value_from_text_field(
         self.driver.find_element(*self.PRIVATE_CASE_NUMBER_INPUT))
     person_new.is_outlander = is_checkbox_checked(
         self.driver.find_element(*self.IS_A_OUTLANDER_CHECKER))
     person_new.reservist = is_checkbox_checked(
         self.driver.find_element(*self.IS_A_OUTLANDER_CHECKER))
     person_new.hostel_need = is_checkbox_checked(
         self.driver.find_element(*self.IS_A_OUTLANDER_CHECKER))
     return person_new
Ejemplo n.º 5
0
    def read_in_document_page(self, person_new):
        """
        Method read the data on the papers persons page
        :param person_new: persons model in Person format
        :return: person_new
        """
        common_methods = CommonMethods(self.driver)
        self.is_this_page()
        self.wait_until_page_generate()
        for index in range(1, self.get_number_of_person_documents() + 1):
            self.click_on_edit_document(index)
            document = []
            self.wait_until_page_generate()
            for web_element in self.list_with_all_visible_element_in_document():
                value_of_webelement_by_js = common_methods.get_value_from_web_element(web_element)
                document.append(value_of_webelement_by_js)

            document.append(
                is_checkbox_checked(self.driver.find_element(*self.DOCUMENT_IS_ORIGINAL)))
            document.append(
                is_checkbox_checked(self.driver.find_element(*self.DOCUMENT_IS_FOREIGN)))
            person_new.documents.append(document)

        return person_new
    def read_in_address_page(self, person_new):
        """
        Method read the data on the address persons page
        :param person_new: persons model in Person format
        :return:
        """
        common_methods = CommonMethods(self.driver)
        self.is_this_page
        self.wait_until_page_generate()

        # reading birth place
        for place in self.driver.find_elements(*self.FULL_BIRTH_PLACE_TEXT):
            person_new.burn_place.append(place.text)

        # reading registration address
        for place in self.driver.find_elements(*self.FULL_BIRTH_REGISTRATION_TEXT):
            person_new.registration_place["area"].append(place.text)

        person_new.registration_place["index"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.INDEX_INPUT))
        person_new.registration_place["type"] = self.address_type_chooser().text
        person_new.registration_place["street"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.STREET_INPUT)).encode('cp1251')
        person_new.registration_place["house"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.HOUSE_INPUT))
        person_new.registration_place["apartment"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.APARTMENT_INPUT))
        person_new.registration_place["is_addresses_match"] = is_checkbox_checked(
            self.driver.find_element(*self.IS_ADDRESSES_MATCH))

        if person_new.registration_place["is_addresses_match"]:
            person_new.post_registration_place["index"] = person_new.registration_place["index"]
            person_new.post_registration_place["type"] = person_new.registration_place["type"]
            person_new.post_registration_place["street"] = person_new.registration_place["street"]
            person_new.post_registration_place["house"] = person_new.registration_place["house"]
            person_new.post_registration_place["apartment"] = person_new.registration_place["apartment"]
            return person_new

        # reading post address
        for place in self.driver.find_elements(*self.FULL_BIRTH_POST_REGISTRATION_TEXT):
            person_new.post_registration_place["area"].append(place.text)

        person_new.post_registration_place["index"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.INDEX_POST_INPUT))
        person_new.post_registration_place["type"] = common_methods.get_value_from_select(self.driver.find_element(*self.ADDRESS_TYPE_POST_CHOOSER)).encode('cp1251')
        person_new.post_registration_place["street"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.STREET_POST_INPUT)).encode('cp1251')
        person_new.post_registration_place["house"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.HOUSE_POST_INPUT)).encode('cp1251')
        person_new.post_registration_place["apartment"] = common_methods.get_value_from_text_field(self.driver.find_element(*self.APARTMENT_POST_INPUT))
        return person_new