Ejemplo n.º 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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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))
Ejemplo n.º 4
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))
Ejemplo n.º 5
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'])
Ejemplo n.º 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'])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 13
0
 def test_back_on_order_review_leads_to_payment_processor(self, browser):
     checkout.goto(checkout.ORDER_REVIEW)
     checkout.back()
     checkout.assert_step(checkout.PAYMENT_PROCESSOR)
Ejemplo n.º 14
0
 def test_back_on_payment_processor(self, browser):
     checkout.goto(checkout.PAYMENT_PROCESSOR)
     checkout.select_valid_payment_processor()
     checkout.back()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)
Ejemplo n.º 15
0
 def test_payment_processor_selection(self, browser):
     checkout.goto(checkout.PAYMENT_PROCESSOR)
     checkout.submit_valid_payment_processor()
     checkout.assert_step(checkout.ORDER_REVIEW)
Ejemplo n.º 16
0
 def test_back_on_shipping_address(self, browser):
     checkout.goto(checkout.SHIPPING_ADDRESS)
     checkout.back()
     checkout.assert_step(checkout.CONTACT_INFORMATION)
Ejemplo n.º 17
0
 def test_back_on_shipping_address(self, browser):
     checkout.goto(checkout.SHIPPING_ADDRESS)
     checkout.back()
     checkout.assert_step(checkout.CONTACT_INFORMATION)
Ejemplo n.º 18
0
 def test_payment_processor_selection(self, browser):
     checkout.goto(checkout.PAYMENT_PROCESSOR)
     checkout.submit_valid_payment_processor()
     checkout.assert_step(checkout.ORDER_REVIEW)
Ejemplo n.º 19
0
 def test_back_on_payment_processor(self, browser):
     checkout.goto(checkout.PAYMENT_PROCESSOR)
     checkout.select_valid_payment_processor()
     checkout.back()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)
Ejemplo n.º 20
0
 def test_back_on_order_review_leads_to_payment_processor(self, browser):
     checkout.goto(checkout.ORDER_REVIEW)
     checkout.back()
     checkout.assert_step(checkout.PAYMENT_PROCESSOR)
Ejemplo n.º 21
0
 def test_submitting_contact_information_leads_to_shipping_address(self, browser):
     checkout.visit_checkout_with_one_item_in_cart()
     checkout.submit_valid_contact_info()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)
Ejemplo n.º 22
0
 def test_submitting_contact_information_leads_to_shipping_address(
         self, browser):
     checkout.visit_checkout_with_one_item_in_cart()
     checkout.submit_valid_contact_info()
     checkout.assert_step(checkout.SHIPPING_ADDRESS)