Example #1
0
        def test_signupdialog(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/'))
            time.sleep(5)

            ## Make popup visible by clicking Login
            find_first (self.selenium, "#header_right ul li:first-child a", "a#show-login-dialog").click()
            time.sleep(5)

            # click Signup tab, enter username & email
            self.selenium.find_element_by_css_selector('#signin_signup_modal a[href="#signup"]').click()
            username = self.selenium.find_element_by_id('id_username')
            if self.selenium.name=='chrome':
                username.send_keys('test114c_eracks')
            if self.selenium.name=='firefox':
                username.send_keys('test114f_eracks')
            email = self.selenium.find_element_by_id(
                'id_email')
            if self.selenium.name=='chrome':
                email.send_keys('*****@*****.**')
            if self.selenium.name=='firefox':
                email.send_keys('*****@*****.**')
            time.sleep(5)

            # Submit the form
            find_first (self.selenium, '#signupTab form input[value=Signup]', '#signup form input[value=Signup]').click()
            time.sleep(5)

            ## Save screenshots
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_signupdialog.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_signupdialog.png')
            self.assertIn('Thank', self.selenium.page_source)
Example #2
0
 def test_login_without_email(self):
     self.selenium.get('%s%s' %
                       (self.live_server_url, '/accounts/login/'))
     username_input = find_first(
         self.selenium, '#content_row input#id_identification',
         '#content input#id_identification')
     username_input.send_keys('*****@*****.**')
     password_input = find_first(self.selenium,
                                 '#content_row input#id_password',
                                 '#content input#id_password')
     password_input.send_keys('testuser1')
     find_first(self.selenium,
                '#content_row input[type=submit][value=Signin]',
                '#content input[type=submit][value=Signin]').click()
     time.sleep(2)
     self.selenium.get(
         '%s%s' %
         (self.live_server_url, '/products/firewall-servers/DMZ/'))
     time.sleep(2)
     click_getquote = self.selenium.find_element_by_id(
         'get_quote').click()
     sentemail = self.selenium.find_element_by_css_selector(
         '#content div.alert.alert-success.alert-dismissible').text
     if self.selenium.name == 'chrome':
         self.selenium.get_screenshot_as_file(
             'media/test_results_screens/chrome/test_login.png')
     if self.selenium.name == 'firefox':
         self.selenium.get_screenshot_as_file(
             'media/test_results_screens/firefox/test_login.png')
     self.assertIn(
         "Your quote request has been sent to [email protected]",
         sentemail)
Example #3
0
        def test_signindialog(self):
            if breakpoint:
                from IPython import embed
                embed()  # breaks into an ipython shell here!

            self.selenium.get('%s%s' % (self.live_server_url, '/'))
            time.sleep(2)

            ## Make popup visible by clicking Login
            find_first(self.selenium, "#header_right ul li:first-child a",
                       'a#show-login-dialog',
                       '#show-login-dialog .glyphicon-log-in').click()
            time.sleep(2)

            ## Enter username & email
            username_input = self.selenium.find_element_by_id(
                'id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = self.selenium.find_element_by_css_selector(
                'input#id_password')
            password_input.send_keys('testuser1')

            ## Submit the form, grab screens
            find_first(self.selenium, '#signinTab form input[value=Signin]',
                       '#signin form input[value=Signin]').click()
            time.sleep(2)
            self.screengrabs('test_signindialog.png')
            self.assertIn("You have been signed in", self.selenium.page_source)
Example #4
0
        def test_signup_fail_username(self):
            self.selenium.get('%s%s' %
                              (self.live_server_url, '/accounts/signup/'))
            time.sleep(2)

            ## Fill in username
            username = find_first(self.selenium,
                                  '#content_row input#id_username',
                                  '#content input#id_username')
            if self.selenium.name == 'chrome':
                username.send_keys('test112c+eracks')
            if self.selenium.name == 'firefox':
                username.send_keys('test112f+eracks')

            ## Fill in email
            email = find_first(self.selenium, '#content_row input#id_email',
                               '#content input#id_email')
            if self.selenium.name == 'chrome':
                email.send_keys('*****@*****.**')
            if self.selenium.name == 'firefox':
                email.send_keys('*****@*****.**')

            ## Submit form, grab screens
            find_first(self.selenium,
                       '#content_row input[type=submit][value=Signup]',
                       '#content input[type=submit][value=Signup]').click()
            time.sleep(2)
            self.screengrabs('test_signup_fail_email.png')
            self.assertIn('not allowed', self.selenium.page_source)
Example #5
0
        def test_signup_email(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/accounts/signup/'))

            ## Fill in username
            username = find_first (self.selenium, '#content_row input#id_username', '#content input#id_username')
            if self.selenium.name=='chrome':
                username.send_keys('*****@*****.**')
            if self.selenium.name=='firefox':
                username.send_keys('*****@*****.**')

            ## Fill in email
            email = find_first (self.selenium, '#content_row input#id_email', '#content input#id_email')
            if self.selenium.name=='chrome':
                email.send_keys('*****@*****.**')
            if self.selenium.name=='firefox':
                email.send_keys('*****@*****.**')

            ## submit form, grab screens
            find_first (self.selenium, '#content_row input[type=submit][value=Signup]', '#content input[type=submit][value=Signup]').click()
            time.sleep(5)
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_signup_email.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_signup_email.png')
            self.assertIn('Thank', self.selenium.page_source)
Example #6
0
        def test_login_without_name_email_quotedetails(self):
            "Get quote with user logged in without filling in email field"
    
            self.selenium.get('%s%s' % (self.live_server_url, '/accounts/login/'))
            time.sleep(2)
        
            ## Select the visible ones, not the modal(hidden) one - fill in user & pw, submit
            username_input = find_first (self.selenium, '#content_row input#id_identification', '#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first (self.selenium, '#content_row input#id_password', '#content input#id_password')
            password_input.send_keys('testuser1')
            find_first(self.selenium, '#content_row input[type=submit][value=Signin]', '#content input[type=submit][value=Signin]').click()
            time.sleep(2)
        
            ## Grab screens
            self.screengrabs ('test_login.png')
            logedin = self.selenium.page_source
            self.assertIn ("You have been signed in", logedin)                     

            ## Load product page
            self.selenium.get('%s%s' % (self.live_server_url, '/products/firewall-servers/DMZ/'))
            time.sleep (2)
                        
            ## Get quote
            click_getquote = self.selenium.find_element_by_id('get_quote').click()
            source = self.selenium.page_source
            sentemail = self.selenium.find_element_by_css_selector('#content div.alert.alert-success.alert-dismissible').text

            ## Grab screens
            self.screengrabs ('quote_test_logged_in_without_email.png')
            self.assertIn ("Your quote request has been sent to [email protected]", sentemail)
Example #7
0
        def test_contact(self):
            #display = Display(visible=0, size=(800, 600))
            # display.start()

            # now Firefox will run in a virtual display.
            # you will not see the browser.
            browser = self.drivers  # webdriver.Firefox()
            print "**" * 50
            print "opening the site"
            print self.selenium.name
            print "**" * 50
            self.selenium.get('%s%s' % (self.live_server_url, '/accounts/login/'))

            username_input = find_first (self.selenium,
                    '#content_row form fieldset input#id_identification',
                    '#content form fieldset input#id_identification'
                  )
            #username_input = self.selenium.find_element_by_css_selector(
                #'#content_row form fieldset input#id_identification')
                #'.seven.columns>form>fieldset>p>input#id_identification')
            username_input.send_keys('*****@*****.**')

            password_input = find_first (self.selenium,
                  '#content_row form fieldset input#id_password',
                  '#content form fieldset input#id_password'
                )
            #password_input = self.selenium.find_element_by_css_selector(
                #'#content_row form fieldset input#id_password')
                #'.seven.columns>form>fieldset>p>input#id_password')
            password_input.send_keys('testuser1')

            find_first (self.selenium,
                  '#content_row form input[type=submit][value=Signin]',
                  '#content form input[type=submit][value=Signin]'
                ).click()
            #self.selenium.find_element_by_css_selector(
                #'#content_row form input[type=submit][value=Signin]').click()
                #'.seven.columns>form>input').click()
            time.sleep(3)
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_contact.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_contact.png')
            time.sleep(3)
            self.assertIn("You have been signed in", self.selenium.page_source)
            time.sleep(3)
            # self.selenium.quit()
            print "**" * 50
            print "closing the site"
            print "**" * 50
Example #8
0
        def test_contact(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/contact/'))
            time.sleep(2)

            name = self.selenium.find_element_by_id("id_name")
            name.clear()
            name.send_keys("name1")

            email = find_first(self.selenium, '#content_row input#id_email',
                               '#content input#id_email')
            email.clear()
            email.send_keys("*****@*****.**")

            desc = self.selenium.find_element_by_id("id_description")
            desc.clear()
            desc.send_keys("sample description")

            body = self.selenium.find_element_by_id("id_body")
            body.clear()
            body.send_keys("sample body")

            # self.selenium.find_element_by_id("contact").click()

            submit = self.selenium.find_element_by_id("contact")
            submit.send_keys(Keys.RETURN)
            time.sleep(2)

            self.screengrabs('test_contact.png')
            self.assertIn("Thank you", self.selenium.page_source)
Example #9
0
        def test_contact_long_email(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/contact/'))
            time.sleep(2)

            name = self.selenium.find_element_by_id("id_name")
            name.clear()
            name.send_keys("lengthen email")

            email = find_first(self.selenium, '#content_row input#id_email',
                               '#content input#id_email')
            email.clear()
            email.send_keys(
                "*****@*****.**")

            desc = self.selenium.find_element_by_id("id_description")
            desc.clear()
            desc.send_keys("lengthen test with very large email")

            body = self.selenium.find_element_by_id("id_body")
            body.clear()
            body.send_keys("lengthen test with very large email")

            submit = self.selenium.find_element_by_id("contact")
            time.sleep(2)
            submit.send_keys(Keys.RETURN)
            time.sleep(2)

            self.screengrabs('test_contact_long_email.png')
            self.assertIn("Thank you", self.selenium.page_source)
Example #10
0
        def test_contact_long_email(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/contact/'))
            name = self.selenium.find_element_by_id("id_name")
            name.clear()
            name.send_keys("lengthen email")

            email = find_first (self.selenium, '#content_row input#id_email', '#content input#id_email')
            email.clear()
            email.send_keys("*****@*****.**")

            desc = self.selenium.find_element_by_id("id_description")
            desc.clear()
            desc.send_keys("lengthen test with very large email")

            body = self.selenium.find_element_by_id("id_body")
            body.clear()
            body.send_keys("lengthen test with very large email")

            # self.selenium.find_element_by_id("contact").click()

            submit = self.selenium.find_element_by_id("contact")
            time.sleep(2)
            submit.send_keys(Keys.RETURN)
            #time.sleep(5)
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_contact_long_email.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_contact_long_email.png')
            self.assertIn("Thank you", self.selenium.page_source)
Example #11
0
        def test_login(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/accounts/login/'))

            ## Select the visible ones, not the modal(hidden) one - fill in user & pw, submit
            username_input = find_first (self.selenium, '#content_row input#id_identification', '#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first (self.selenium, '#content_row input#id_password', '#content input#id_password')
            password_input.send_keys('testuser1')
            find_first (self.selenium, '#content_row input[type=submit][value=Signin]', '#content input[type=submit][value=Signin]').click()
            time.sleep(5)

            ## grab screens
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_login.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_login.png')
            self.assertIn("You have been signed in", self.selenium.page_source)
Example #12
0
        def test_login_with_email(self):
            before_get_quote = User.objects.all().count()
            self.selenium.get('%s%s' %
                              (self.live_server_url, '/accounts/login/'))
            ## Select the visible ones, not the modal(hidden) one - fill in user & pw, submit
            username_input = find_first(
                self.selenium, '#content_row input#id_identification',
                '#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first(self.selenium,
                                        '#content_row input#id_password',
                                        '#content input#id_password')
            password_input.send_keys('testuser1')
            find_first(self.selenium,
                       '#content_row input[type=submit][value=Signin]',
                       '#content input[type=submit][value=Signin]').click()
            time.sleep(1)
            self.selenium.get(
                '%s%s' %
                (self.live_server_url, '/products/firewall-servers/DMZ/'))
            time.sleep(1)
            email = self.selenium.find_element_by_css_selector(
                'form.configform #id_email')
            time.sleep(1)
            email.send_keys("*****@*****.**")
            time.sleep(2)
            override_email = User.objects.filter(
                email="*****@*****.**").update(
                    email="*****@*****.**")
            click_getquote = self.selenium.find_element_by_id(
                'get_quote').click()
            after_get_quote = User.objects.all().count()
            sentemail = self.selenium.find_element_by_css_selector(
                '#content div.alert.alert-success.alert-dismissible').text
            ## grab screens
            if self.selenium.name == 'chrome':
                self.selenium.get_screenshot_as_file(
                    'media/test_results_screens/chrome/test_login.png')
            if self.selenium.name == 'firefox':
                self.selenium.get_screenshot_as_file(
                    'media/test_results_screens/firefox/test_login.png')
            # self.assertIn("Your quote request has been sent to [email protected]",
            #     sentemail)

            self.assertEqual(before_get_quote, after_get_quote)
Example #13
0
        def test_signupdialog(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/'))
            time.sleep(2)

            ## Make popup visible by clicking Login
            find_first(
                self.selenium,
                "#header_right ul li:first-child a",
                "a#show-login-dialog",
                '#show-login-dialog .glyphicon-log-in',
            ).click()
            time.sleep(2)

            if breakpoint:
                from IPython import embed
                embed()  # breaks into an ipython shell here!

            ## click Signup tab, enter username & email
            self.selenium.find_element_by_css_selector(
                '#signin_signup_modal a[href="#signup"]').click()
            username = self.selenium.find_element_by_id('id_username')
            if self.selenium.name == 'chrome':
                username.send_keys('test114c_eracks')
            if self.selenium.name == 'firefox':
                username.send_keys('test114f_eracks')
            email = self.selenium.find_element_by_id('id_email')
            if self.selenium.name == 'chrome':
                email.send_keys('*****@*****.**')
            if self.selenium.name == 'firefox':
                email.send_keys('*****@*****.**')
            time.sleep(2)

            ## Submit the form
            find_first(self.selenium, '#signupTab form input[value=Signup]',
                       '#signup form input[value=Signup]').click()
            time.sleep(2)

            ## Save screenshots
            self.screengrabs('test_signupdialog.png')
            self.assertIn('Thank', self.selenium.page_source)
Example #14
0
        def test_login_with_name_email_quotedetails(self):
            "Get quote with user logged in with filled-in email field"

            before_get_quote = User.objects.all().count()

            self.selenium.get('%s%s' % (self.live_server_url, '/accounts/login/'))
            time.sleep(2)
        
            ## Select the visible ones, not the modal(hidden) one - fill in user & pw, submit
            username_input = find_first (self.selenium, '#content_row input#id_identification', '#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first (self.selenium, '#content_row input#id_password', '#content input#id_password')
            password_input.send_keys('testuser1')
            find_first (self.selenium, '#content_row input[type=submit][value=Signin]', '#content input[type=submit][value=Signin]').click()
            time.sleep(2)
        
            ## Grab screens
            self.screengrabs ('test_login.png')
            self.assertIn ("You have been signed in", self.selenium.page_source) 

            ## Load product page
            self.selenium.get('%s%s' % (self.live_server_url, '/products/firewall-servers/DMZ/'))
            time.sleep (2)

            ## Fill in email and get quote
            email = self.selenium.find_element_by_css_selector('div#config.pull-left form.configform #id_email')
            email.send_keys("*****@*****.**")
            override_email = User.objects.filter(email ="*****@*****.**").update(email="*****@*****.**")
            click_getquote = self.selenium.find_element_by_id('get_quote').click()
            time.sleep (2)

            ## Get count for comparison, check email msg
            after_get_quote = User.objects.all().count()
            sentemail = self.selenium.find_element_by_css_selector('#content div.alert.alert-success.alert-dismissible').text

            ## Grab screens
            self.screengrabs ('quote_test_loggedin_with_email.png')
            self.assertIn("Your quote request has been sent to [email protected]", sentemail)
            self.assertEqual(before_get_quote, after_get_quote)
Example #15
0
        def test_signindialog(self):
            self.selenium.get('%s%s' % (self.live_server_url, '/'))
            time.sleep(5)

            ## Make popup visible by clicking Login
            find_first (self.selenium, "#header_right ul li:first-child a", 'a#show-login-dialog').click()
            time.sleep(5)

            ## Enter username & email
            username_input = self.selenium.find_element_by_id('id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = self.selenium.find_element_by_css_selector('input#id_password')
            password_input.send_keys('testuser1')

            ## Submit the form, grab screens
            find_first (self.selenium, '#signinTab form input[value=Signin]', '#signin form input[value=Signin]').click()
            time.sleep(5)
            if self.selenium.name=='chrome':
                self.selenium.get_screenshot_as_file('media/test_results_screens/chrome/test_signindialog.png')
            if self.selenium.name=='firefox':
                self.selenium.get_screenshot_as_file('media/test_results_screens/firefox/test_signindialog.png')
            self.assertIn("You have been signed in", self.selenium.page_source)
Example #16
0
        def test_order(self):
            p = Product.objects.get(sku='DMZ')
            shipping_weight = p.weight
            print shipping_weight
            self.selenium.get(
                '%s%s' %
                (self.live_server_url, '/products/firewall-servers/DMZ/'))
            time.sleep(2)

            ## Now updating for new themes - JJW

            # Click an 'Add toi cart' button, update quantity
            find_first(self.selenium,
                       '#config_summary #current a[href="#add"]',
                       'input#add_to_cart').click()
            update_qty = self.selenium.find_element_by_name('updqty')
            update_qty.send_keys('2')
            self.selenium.find_element_by_name('update').click()
            time.sleep(2)

            ## Now move to checkout page
            find_first(self.selenium, '#next a[href="/checkout/"]',
                       '#order-detail-content a[href="/checkout/"]').click()
            time.sleep(2)

            ## User Login form
            username_input = find_first(
                self.selenium, '#content_row input#id_identification',
                'div#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first(self.selenium,
                                        '#content_row input#id_password',
                                        'div#content input#id_password')
            password_input.send_keys('testuser1')

            find_first(
                self.selenium,
                '#content_row form input[type=submit][value=Signin]',
                'div#content form input[type=submit][value=Signin]').click()

            ## User Info Form - should be pre-filled-in, no need
            ## Customer Info form
            organization = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_organization')
            organization.send_keys('test')
            title = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_title')
            title.send_keys('test')
            department = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_department')
            department.send_keys('test')
            email_id = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_email')
            email_id.send_keys('*****@*****.**')
            phone = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_phone')
            phone.send_keys('+919999999999')

            ## Order Info Form
            referral_type = Select(
                self.selenium.find_element_by_css_selector(
                    'table#OrderForm select#id_referral_type'))
            referral_type.select_by_visible_text("Google search")
            sales_tax = Select(
                self.selenium.find_element_by_css_selector(
                    'table#OrderForm select#id_california_tax'))
            sales_tax.select_by_visible_text('Los Angeles')
            agree_to_terms = self.selenium.find_element_by_css_selector(
                'table#OrderForm input#id_agree_to_terms')
            agree_to_terms.click()

            ## Shipping Address Form
            address1 = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-address1')
            address1.send_keys('test street, 5-4-20')
            city = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-city')
            city.send_keys('Los Angeles')
            state = Select(
                self.selenium.find_element_by_css_selector(
                    'table#AddressForm select#id_shipping-state'))
            state.select_by_visible_text('CA (California)')
            zip_code = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-zip')
            zip_code.send_keys('90011')

            ## Billing Address Form (use selector table#BillingAddressForm input#id_billing_name, etc)
            # if blank same as shipping, but could still test here..

            ## Payment Info Form
            payment_method1 = Select(
                self.selenium.find_element_by_css_selector(
                    "table#PaymentForm select#id_payment_method"))
            payment_method1.select_by_visible_text("Purchase Order")
            expiry_date1 = Select(
                self.selenium.find_element_by_css_selector(
                    'table#PaymentForm select#id_expiry_date_1'))
            expiry_date1.select_by_visible_text('2017')
            time.sleep(2)
            find_first(
                self.selenium, 'input[name=update][value=Update]',
                'form#checkoutform div#content_row a[href="/checkout/confirm/"]'
            ).click()
            actual_shipping = self.selenium.execute_script(
                '''return $("#final_cart table td:contains(Shipping & Handling)+td").get(0)'''
            )

            if breakpoint:
                from IPython import embed
                embed()

            print 'actual_shipping', type(
                actual_shipping), actual_shipping.text
            actual_shipping_price = float(actual_shipping.text.strip('$'))
            expected_shipping_price = shipping_weight * 2

            ## Place the order!
            find_first(
                self.selenium,
                '#content_row input[name=order][value="Place Order"]',
                'form#confirmform a[href="/checkout/confirm/"]').click()

            if self.selenium.name == 'chrome':
                self.selenium.get_screenshot_as_file(
                    'media/test_results_screens/chrome/test_order.png')

            if self.selenium.name == 'firefox':
                self.selenium.get_screenshot_as_file(
                    'media/test_results_screens/firefox/test_order.png')

            time.sleep(5)
            self.assertEqual(expected_shipping_price, actual_shipping_price)
Example #17
0
        def test_order(self):
            # import pdb;pdb.set_trace()
            from selenium.webdriver.support.select import Select

            p = Product.objects.get(sku='DMZ')
            shipping_weight = p.weight
            if trace: print 'SHIPPING WEIGHT:', shipping_weight
            self.selenium.get(
                '%s%s' %
                (self.live_server_url, '/products/firewall-servers/DMZ/'))
            time.sleep(2)

            ## Click an 'Add to cart' button, update quantity
            find_first(self.selenium, 'input#add_to_cart').click()
            time.sleep(10)
            update_qty = self.selenium.find_element_by_name('updqty')
            time.sleep(2)
            update_qty.send_keys('2')
            time.sleep(2)
            self.selenium.find_element_by_name('update').click()
            time.sleep(2)

            ## Now move to checkout page
            checkout = find_first(
                self.selenium, '#next a[href="/checkout/"]',
                '#order-detail-content a[href="/checkout/"]')
            self.selenium.execute_script(
                "return arguments[0].scrollIntoView();", checkout)
            checkout.click()
            time.sleep(2)
            form_heading = self.find_first('#content form fieldset legend')
            self.assertIn('Signin', form_heading.text)

            ## User Login form
            username_input = find_first(
                self.selenium, '#content_row input#id_identification',
                'div#content input#id_identification')
            username_input.send_keys('*****@*****.**')
            password_input = find_first(self.selenium,
                                        '#content_row input#id_password',
                                        'div#content input#id_password')
            password_input.send_keys('testuser1')
            find_first(
                self.selenium,
                '#content_row form input[type=submit][value=Signin]',
                'div#content form input[type=submit][value=Signin]').click()
            time.sleep(2)
            h1 = self.find_first('#content h1')
            self.assertIn('Checkout', h1.text)

            ## User Info Form - should be pre-filled-in, no need
            ## Customer Info form
            organization = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_organization')
            organization.send_keys('test')
            title = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_title')
            title.send_keys('test')
            department = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_department')
            department.send_keys('test')
            email_id = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_email')
            email_id.send_keys('*****@*****.**')
            phone = self.selenium.find_element_by_css_selector(
                'table#CustomerForm input#id_phone')
            phone.send_keys('+919999999999')

            ## Order Info Form
            referral_type = Select(
                self.selenium.find_element_by_css_selector(
                    'table#OrderForm select#id_referral_type'))
            referral_type.select_by_visible_text("Google search")
            sales_tax = Select(
                self.selenium.find_element_by_css_selector(
                    'table#OrderForm select#id_california_tax'))
            sales_tax.select_by_visible_text('Los Angeles')
            agree_to_terms = self.selenium.find_element_by_css_selector(
                'table#OrderForm input#id_agree_to_terms')
            agree_to_terms.click()  # send_keys(' ') nfg

            if breakpoint:
                from IPython import embed
                embed()

            ## Shipping Address Form
            address1 = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-address1')
            address1.send_keys('test street, 5-4-20')
            city = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-city')
            city.send_keys('Los Angeles')
            state = Select(
                self.selenium.find_element_by_css_selector(
                    'table#AddressForm select#id_shipping-state'))
            state.select_by_visible_text('CA (California)')
            zip_code = self.selenium.find_element_by_css_selector(
                'table#AddressForm input#id_shipping-zip')
            zip_code.send_keys('90011')

            ## Billing Address Form (use selector table#BillingAddressForm input#id_billing_name, etc)
            # if blank same as shipping, but could still test here..

            ## Payment Info Form
            payment_method1 = Select(
                self.selenium.find_element_by_css_selector(
                    "table#PaymentForm select#id_payment_method"))
            payment_method1.select_by_visible_text("Purchase Order")
            expiry_date1 = Select(
                self.selenium.find_element_by_css_selector(
                    'table#PaymentForm select#id_expiry_date_1'))
            expiry_date1.select_by_visible_text('2017')
            time.sleep(2)

            ## Click confirm
            confirm_button = find_first(
                self.selenium, 'input[name=update][value=Update]',
                'form#checkoutform div#content_row a[href="/checkout/confirm/"]'
            )
            if trace: print confirm_button.text
            confirm_button.click()
            time.sleep(2)
            h1 = self.find_first('#content h1')
            self.assertIn('Checkout - Review/Confirm Your Order', h1.text)

            actual_shipping = self.selenium.execute_script(
                '''return $("#final_cart table td:contains(Shipping & Handling)+td").get(0)'''
            )

            if breakpoint:
                from IPython import embed
                embed()

            if trace:
                print 'actual_shipping', type(
                    actual_shipping), actual_shipping.text
            actual_shipping_price = float(actual_shipping.text.strip('$'))
            expected_shipping_price = shipping_weight * 2

            ## Place the order!
            find_first(
                self.selenium,
                '#content_row input[name=order][value="Place Order"]',
                'form#confirmform a[href="/checkout/confirm/"]').click()
            time.sleep(2)

            self.screengrabs('test_order.png')
            self.assertEqual(expected_shipping_price, actual_shipping_price)