def configure_getfinancing(self, merch_id=None, username=None, password=None, postback_username=None, postback_password=None): if not merch_id: merch_id = os.getenv('GF_MERCH_ID') if not username: username = os.getenv('GF_USERNAME') if not password: password = os.getenv('GF_PASSWORD') if not postback_username: postback_username = os.getenv('GF_POSTBACK_USERNAME') if not postback_password: postback_password = os.getenv('GF_POSTBACK_PASSWORD') self.navigate('System', 'Configuration') self.navigate_configuration('Payment Methods') # GetFinancing could be open already try: a.assert_displayed('payment_getfinancing_active') except AssertionError: common.click_link_by_text('GetFinancing') a.set_dropdown_value('payment_getfinancing_active', 'Yes') a.write_textfield('payment_getfinancing_merch_id', merch_id) a.write_textfield('payment_getfinancing_username', username) a.write_textfield('payment_getfinancing_password', password) a.write_textfield('payment_getfinancing_postback_username', postback_username) a.write_textfield('payment_getfinancing_postback_password', postback_password) self.click_save_config() self.allow_symlinks() self.enable_log()
def enable_log(self): self.navigate('System', 'Configuration') self.navigate_configuration('Developer') # TemplateSettings could be open already try: a.assert_displayed('dev_log_active') except AssertionError: click_link_by_text('Log Settings') a.set_dropdown_value('dev_log_active', 'Yes') self.click_save_config()
def allow_symlinks(self): # the option was introduced in 1.5 # 1.4.0 should allow it, 1.4.2 no longer allowed symlinks if self._version < (1, 5, 0, 0): return # configure magento to allow symlinks in templates # useful for allowing modman to work self.navigate('System', 'Configuration') self.navigate_configuration('Developer') # TemplateSettings could be open already try: a.assert_displayed('dev_template_allow_symlink') except AssertionError: click_link_by_text('Template Settings') a.set_dropdown_value('dev_template_allow_symlink', 'Yes') self.click_save_config()
def test_ep_fields_workaround(self): # This test is a workaround for test_ep_fields_fails # This test can also fail based on issues detailed in bug #2 report funcs = [ set_random_first_name, set_random_last_name, set_random_city, set_random_state_dropdown, set_random_zip2, set_random_birthdate ] selected = [None] # write fields in random order random_last_name = None random_city = None random_state_dropdown = None random_zip = None random_birthdate = None set_update_personal_button() for _ in funcs: random_index = None while random_index in selected: random_index = random.randrange(len(funcs)) val = funcs[random_index]() selected.append(random_index) # check profile values if random_index == 0: random_first_name = val elif random_index == 1: random_last_name = val elif random_index == 2: random_city = val elif random_index == 3: random_state_dropdown = val elif random_index == 4: random_zip = val else: random_birthdate = val set_update_personal_button() # confirm dashboard messages, links expected = 'This app is designed and created for the sole use of screening QA candidates for AvantCredit, any other use is prohibitted' actual = self.get_landing_dash_text() self.assertEqual( expected, actual, msg='FAILED: expected text on dashboard page = "{0}", got = "{1}"'. format(expected, actual)) test_print( 'Successfully verified dashboard page text = "{0}"'.format(actual), flash='!') expected = 'Succesfully updated profile' actual = get_dash_ep_text() self.assertEqual( expected, actual, msg='FAILED: expected text on dashboard page = "{0}", got = "{1}"'. format(expected, actual)) test_print( 'Successfully verified dashboard page text = "{0}"'.format(actual), flash='!') expected = 'Sign out | Edit Profile' self.assertEqual( expected, self.h1, msg='FAILED: expected h1 text on dashboard page = "{0}", got = "{1}"' .format(expected, self.h1)) test_print('Successfully verified h1 text = "{0}"'.format(self.h1), flash='!') # click edit profile and confirm values set_edit_profile_link() # fn self.assertTrue( assert_displayed(wait_for_element(value=random_first_name))) test_print( 'Successfully verified "{0}" in the first name field'.format( random_first_name), flash='!') # ln self.assertTrue( assert_displayed(wait_for_element(value=random_last_name))) test_print('Successfully verified "{0}" in the last name field'.format( random_last_name), flash='!') # city self.assertTrue(assert_displayed(wait_for_element(value=random_city))) test_print('Successfully verified "{0}" in the city field'.format( random_city), flash='!') # state self.assertTrue( assert_displayed( wait_for_element(value=str(random_state_dropdown)))) test_print('Successfully verified "{0}" in the state field'.format( random_state_dropdown), flash='!') # zip self.assertTrue(assert_displayed(wait_for_element(value=random_zip))) test_print( 'Successfully verified "{0}" in the zip field'.format(random_zip), flash='!') # birthdate self.assertTrue( assert_displayed(wait_for_element(value=random_birthdate))) test_print('Successfully verified "{0}" in the birthdate field'.format( random_birthdate), flash='!')
get_element, go_to, skip, write_textfield, ) from u1testutils.sst import config from acceptance import helpers, urls if not exists_element(id='recaptcha_response_field'): skip("Test skipped - no captcha present") config.set_base_url_from_env() helpers.skip_unless_staging_or_production() go_to(urls.NEW_ACCOUNT) assert_title('Create account') # explicitly don't set captcha email_address = '*****@*****.**' write_textfield('id_displayname', "My Name") write_textfield('id_email', email_address) write_textfield('id_password', "Admin007") write_textfield('id_passwordconfirm', "Admin007") # Even though the recaptcha field is ignored for our tests, we do want to # verify that it is on the page. In response to Defect #839216 we click once # before to ensure captcha is still displayed click_button(get_element(name='continue')) assert_displayed('recaptcha_response_field')
def test_ep_fields_workaround(self): # This test is a workaround for test_ep_fields_fails # This test can also fail based on issues detailed in bug #2 report funcs = [set_random_first_name, set_random_last_name, set_random_city, set_random_state_dropdown, set_random_zip2, set_random_birthdate] selected = [None] # write fields in random order random_last_name = None random_city = None random_state_dropdown = None random_zip = None random_birthdate = None set_update_personal_button() for _ in funcs: random_index = None while random_index in selected: random_index = random.randrange(len(funcs)) val = funcs[random_index]() selected.append(random_index) # check profile values if random_index == 0: random_first_name = val elif random_index == 1: random_last_name = val elif random_index == 2: random_city = val elif random_index == 3: random_state_dropdown = val elif random_index == 4: random_zip = val else: random_birthdate = val set_update_personal_button() # confirm dashboard messages, links expected = 'This app is designed and created for the sole use of screening QA candidates for AvantCredit, any other use is prohibitted' actual = self.get_landing_dash_text() self.assertEqual(expected, actual, msg='FAILED: expected text on dashboard page = "{0}", got = "{1}"'.format(expected, actual)) test_print('Successfully verified dashboard page text = "{0}"'.format(actual), flash='!') expected = 'Succesfully updated profile' actual = get_dash_ep_text() self.assertEqual(expected, actual, msg='FAILED: expected text on dashboard page = "{0}", got = "{1}"'.format(expected, actual)) test_print('Successfully verified dashboard page text = "{0}"'.format(actual), flash='!') expected = 'Sign out | Edit Profile' self.assertEqual(expected, self.h1, msg='FAILED: expected h1 text on dashboard page = "{0}", got = "{1}"'.format(expected, self.h1)) test_print('Successfully verified h1 text = "{0}"'.format(self.h1), flash='!') # click edit profile and confirm values set_edit_profile_link() # fn self.assertTrue(assert_displayed(wait_for_element(value=random_first_name))) test_print('Successfully verified "{0}" in the first name field'.format(random_first_name), flash='!') # ln self.assertTrue(assert_displayed(wait_for_element(value=random_last_name))) test_print('Successfully verified "{0}" in the last name field'.format(random_last_name), flash='!') # city self.assertTrue(assert_displayed(wait_for_element(value=random_city))) test_print('Successfully verified "{0}" in the city field'.format(random_city), flash='!') # state self.assertTrue(assert_displayed(wait_for_element(value=str(random_state_dropdown)))) test_print('Successfully verified "{0}" in the state field'.format(random_state_dropdown), flash='!') # zip self.assertTrue(assert_displayed(wait_for_element(value=random_zip))) test_print('Successfully verified "{0}" in the zip field'.format(random_zip), flash='!') # birthdate self.assertTrue(assert_displayed(wait_for_element(value=random_birthdate))) test_print('Successfully verified "{0}" in the birthdate field'.format(random_birthdate), flash='!')
# Add an authentication device add_device('login') # Change the preference to always require 2 factor authentication and save helpers.set_twofactor_to_always_required() # Logout and attempt to log back in helpers.logout_and_in() # Should insist on 2F and not give access to '/' # In response to defect #923814 go_to(base_url) # Check we are on the 2-factor login page assert_displayed('id_oath_token') # Enter an invalid password and submit enter_otp('foo bar baz') # Check an error message is shown and we are not logged in assert_displayed('id_oath_token') assert_text(get_element(css_class='error'), 'Please enter a 6-digit or 8-digit one-time password.') # Enter a valid one time password authenticate('login') # Check we are now logged in assert_url('/')