Exemple #1
0
    def test_error_required_fields_blank(self, ):
        addresses_list_page = AddressesListPage(self.driver)
        new_address_page = NewAddressPage(self.driver)
        common = CommonSearchHelper(self.driver)

        addresses_list_page.click_new_address_link()

        new_address_page.set_data_to_field(
            NAL.locator_first_name_field, self.data_gen[0]['address_negative']
            ['p1']['test_input']['first_name'])

        new_address_page.set_data_to_field(
            NAL.locator_last_name_field, self.data_gen[0]['address_negative']
            ['p1']['test_input']["last_name"])

        new_address_page.set_data_to_field(
            NAL.locator_address1_field, self.data_gen[0]['address_negative']
            ['p1']['test_input']["address1"])

        new_address_page.set_data_to_field(
            NAL.locator_city,
            self.data_gen[0]['address_negative']['p1']['test_input']["city"])

        new_address_page.set_data_to_field(
            NAL.locator_zip_code, self.data_gen[0]['address_negative']['p1']
            ['test_input']["zip_code"])

        new_address_page.click_create_address_btn()

        error_message = common.get_text_from_element(
            NAL.locator_required_fields_error)
        assert error_message == self.data_gen[0]['address_negative']['p1'][
            "expected"]
    def test_edit_address_negative(self, browser_fixture, data_fixture_js,
                                   test_input, expected):
        if not TestEditAddressNegative.before_all:
            before_all = TestHelper()
            before_all.add_address(browser_fixture, data_fixture_js)
            TestEditAddressNegative.before_all = True

        session_email = data_fixture_js["session_email2"]
        session_password = data_fixture_js["session_password2"]

        page = SignInSearchHelper(browser_fixture)
        common = CommonSearchHelper(browser_fixture)
        addresses_list_page = AddressesListPage(browser_fixture)
        edit_address_page = EditAddressPage(browser_fixture)
        show_address_page = ShowAddressPage(browser_fixture)

        page.go_to_sign_in_page()
        page.type_sign_in_email(session_email)
        page.type_sign_in_password(session_password)
        page.click_sign_in_btn()
        common.click_addresses()
        addresses_list_page.click_edit_link()

        edit_address_page.clean_field(EAL.locator_first_name_field)
        edit_address_page.clean_field(EAL.locator_last_name_field)
        edit_address_page.clean_field(EAL.locator_address1_field)
        edit_address_page.clean_field(EAL.locator_city)
        edit_address_page.clean_field(EAL.locator_zip_code)

        edit_address_page.set_data_to_field(EAL.locator_first_name_field,
                                            test_input["first_name"])

        edit_address_page.set_data_to_field(EAL.locator_last_name_field,
                                            test_input["last_name"])

        edit_address_page.set_data_to_field(EAL.locator_address1_field,
                                            test_input["address1"])

        edit_address_page.set_data_to_field(EAL.locator_city,
                                            test_input["city"])

        edit_address_page.set_data_to_field(EAL.locator_zip_code,
                                            test_input["zip_code"])

        edit_address_page.click_update_address_btn()

        error_message = common.get_text_from_element(
            EAL.locator_required_fields_error)

        assert error_message == expected

        common.click_sign_out()
    def test_error_required_fields_blank(self, browser_fixture,
                                         data_fixture_js, test_input,
                                         expected):
        session_email = data_fixture_js["session_email"]
        session_password = data_fixture_js["session_password"]
        page = SignInSearchHelper(browser_fixture)
        common = CommonSearchHelper(browser_fixture)
        addresses_list_page = AddressesListPage(browser_fixture)
        new_address_page = NewAddressPage(browser_fixture)
        page.go_to_sign_in_page()
        page.type_sign_in_email(session_email)
        page.type_sign_in_password(session_password)
        page.click_sign_in_btn()
        common.click_addresses()

        addresses_list_page.click_new_address_link()

        new_address_page.set_data_to_field(NAL.locator_first_name_field,
                                           test_input["first_name"])

        new_address_page.set_data_to_field(NAL.locator_last_name_field,
                                           test_input["last_name"])

        new_address_page.set_data_to_field(NAL.locator_address1_field,
                                           test_input["address1"])

        new_address_page.set_data_to_field(NAL.locator_city,
                                           test_input["city"])

        new_address_page.set_data_to_field(NAL.locator_zip_code,
                                           test_input["zip_code"])

        new_address_page.click_create_address_btn()

        error_message = common.get_text_from_element(
            NAL.locator_required_fields_error)
        assert error_message == expected

        common.click_sign_out()