Пример #1
0
 def test_shipping_address_is_prefilled(self, browser):
     checkout.visit_checkout_with_one_item_in_cart()
     checkout.fill_contact_info()
     browser.fill({'First Name': 'John', 'Last Name': 'Doe'})
     checkout.next()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)
     self.assertEquals('John', browser.find('First Name').value)
     self.assertEquals('Doe', browser.find('Last Name').value)
Пример #2
0
    def test_payment_processor_is_required(self, browser):
        checkout.goto(checkout.PAYMENT_PROCESSOR)
        checkout.next()
        checkout.assert_step(checkout.PAYMENT_PROCESSOR)
        form = browser.css('form.kssattr-formname-checkout-wizard').first

        # XXX: "Gegen Rechnung" should be translated to english
        self.assertEquals({u'Gegen Rechnung': ['Required input is missing.']},
                          z3cform.erroneous_fields(form))
Пример #3
0
 def test_shipping_address_is_prefilled(self, browser):
     checkout.visit_checkout_with_one_item_in_cart()
     checkout.fill_contact_info()
     browser.fill({'First Name': 'John',
                   'Last Name': 'Doe'})
     checkout.next()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)
     self.assertEquals('John', browser.find('First Name').value)
     self.assertEquals('Doe', browser.find('Last Name').value)
Пример #4
0
    def test_valid_email_address_required(self, browser):
        checkout.visit_checkout_with_one_item_in_cart()
        browser.fill({'Email': 'invalid.email.ch'})
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        form = browser.css('form.kssattr-formname-checkout-wizard').first
        self.assertEquals(['This email address is invalid.'],
                          z3cform.erroneous_fields(form)[u'Email'])
Пример #5
0
    def test_payment_processor_is_required(self, browser):
        checkout.goto(checkout.PAYMENT_PROCESSOR)
        checkout.next()
        checkout.assert_step(checkout.PAYMENT_PROCESSOR)
        form = browser.css('form.kssattr-formname-checkout-wizard').first

        # XXX: "Gegen Rechnung" should be translated to english
        self.assertEquals({u'Gegen Rechnung': ['Required input is missing.']},
                          z3cform.erroneous_fields(form))
Пример #6
0
    def test_valid_email_address_required(self, browser):
        checkout.visit_checkout_with_one_item_in_cart()
        browser.fill({'Email': 'invalid.email.ch'})
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        form = browser.css('form.kssattr-formname-checkout-wizard').first
        self.assertEquals(
            ['This email address is invalid.'],
            z3cform.erroneous_fields(form)[u'Email'])
Пример #7
0
    def test_contact_information_defaults_for_user_without_fullname(self,
                                                                    browser):
        browser.login()
        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        self.assertEquals(
            '',
            browser.css(
                '[name="contact_information.widgets.lastname"]').first.value)
        self.assertEquals(
            '',
            browser.css(
                '[name="contact_information.widgets.firstname"]').first.value)
Пример #8
0
    def test_contact_information_defaults_for_user_without_fullname(
            self, browser):
        browser.login()
        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        self.assertEquals(
            '',
            browser.css(
                '[name="contact_information.widgets.lastname"]').first.value)
        self.assertEquals(
            '',
            browser.css(
                '[name="contact_information.widgets.firstname"]').first.value)
Пример #9
0
    def test_contact_information_defaults_for_logged_in_user(self, browser):
        hugo = create(Builder('user').named('H\xc3\xbcgo', 'B\xc3\xb6ss'))
        browser.login(hugo)

        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        self.assertEquals(
            hugo.getProperty('fullname').split(' ')[1].decode('utf-8'),
            browser.css(
                '[name="contact_information.widgets.lastname"]').first.value)
        self.assertEquals(
            hugo.getProperty('fullname').split(' ')[0].decode('utf-8'),
            browser.css(
                '[name="contact_information.widgets.firstname"]').first.value)
Пример #10
0
    def test_contact_information_defaults_for_logged_in_user(self, browser):
        hugo = create(Builder('user').named('H\xc3\xbcgo', 'B\xc3\xb6ss'))
        browser.login(hugo)

        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)

        self.assertEquals(
            hugo.getProperty('fullname').split(' ')[1].decode('utf-8'),
            browser.css(
                '[name="contact_information.widgets.lastname"]').first.value)
        self.assertEquals(
            hugo.getProperty('fullname').split(' ')[0].decode('utf-8'),
            browser.css(
                '[name="contact_information.widgets.firstname"]').first.value)
Пример #11
0
    def test_contact_information_fields_required(self, browser):
        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)
        form = browser.css('form.kssattr-formname-checkout-wizard').first

        self.assertEquals(
            {u'Title': ['Required input is missing.'],
             u'First Name': ['Required input is missing.'],
             u'Last Name': ['Required input is missing.'],
             u'Email': ['Required input is missing.'],
             u'Street/No.': ['Required input is missing.'],
             u'Phone number': ['Required input is missing.'],
             u'Zip Code': ['Required input is missing.'],
             u'City': ['Required input is missing.'],
             u'Country': ['Required input is missing.']},
            z3cform.erroneous_fields(form))
Пример #12
0
    def test_contact_information_fields_required(self, browser):
        checkout.visit_checkout_with_one_item_in_cart()
        checkout.next()
        checkout.assert_step(checkout.CONTACT_INFORMATION)
        form = browser.css('form.kssattr-formname-checkout-wizard').first

        self.assertEquals(
            {
                u'Title': ['Required input is missing.'],
                u'First Name': ['Required input is missing.'],
                u'Last Name': ['Required input is missing.'],
                u'Email': ['Required input is missing.'],
                u'Street/No.': ['Required input is missing.'],
                u'Phone number': ['Required input is missing.'],
                u'Zip Code': ['Required input is missing.'],
                u'City': ['Required input is missing.'],
                u'Country': ['Required input is missing.']
            }, z3cform.erroneous_fields(form))