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 fill_user_form(user, version=None): monkey_patch_sst() keys = user.keys() # for 1.8 and possibly lower, country needs to be filled before region_id # is a dropdown keys.sort() for key in keys: (vtype, value) = user[key] print 'fill', key, vtype, value try: el = a.get_element(id=key) except AssertionError: continue # before 1.9 region was a text field #if version < (1, 9, 0, 0) and key == 'region_id': # el = a.get_element(id='region') # a.write_textfield(el, value) if vtype == 'text': a.write_textfield(el, value) elif vtype == 'password': a.write_textfield(el, value, check=False) elif vtype == 'option': a.wait_for(a.assert_displayed, el) a.set_dropdown_value(el, value)
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 delete_products(self): self.navigate('Catalog', 'Manage Products') if a.get_elements_by_xpath("//td[text()='No records found.']"): return click_link_by_text('Select All') a.set_dropdown_value('productGrid_massaction-select', 'Delete') self.click_magento_button('Submit', wait=False) a.accept_alert('Are you sure?')
def rebuild_indexes(self): self.navigate('System', 'Index Management') select_all_link = a.get_element_by_xpath( "//a[%s]" % ( xpath_contains_text('Select All')) ) a.click_link(select_all_link) a.set_dropdown_value('indexer_processes_grid_massaction-select', 'Reindex Data') self.click_magento_button('Submit')
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 add_product(self, name, price, sku): self.navigate('Catalog', 'Manage Products') self.click_magento_button('Add Product') self.click_magento_button('Continue') a.write_textfield('name', name) a.write_textfield('description', name) a.write_textfield('short_description', name) a.write_textfield('sku', sku) a.write_textfield('weight', '1') a.set_dropdown_value('status', 'Enabled') self.click_save_and_continue() a.set_dropdown_value('tax_class_id', 'None') a.write_textfield('price', price) self.click_save_and_continue() self.wait_for_product_saved() # Clicking reset clears the message; allowing us to assert again later # to make sure the change is made self.click_magento_button('Reset') click_link_by_title('Inventory') a.write_textfield('inventory_qty', '9999999') a.set_dropdown_value('inventory_stock_availability', 'In Stock') self.click_magento_button('Save') self.wait_for_product_saved()
from u1testutils import mail from u1testutils.sst import config from acceptance import helpers, urls config.set_base_url_from_env() # Create an account with multiple emails. email_address = helpers.register_account(displayname="Fred Jones", verify=True) other_email_address = mail.make_unique_test_email_address() helpers.add_email(other_email_address, verify=True) edit_account_anchor = {'data-qa-id': 'edit_account'} # Verify the current preferred email and change it. go_to(urls.EDIT) assert_element(**edit_account_anchor) assert_dropdown_value('id_preferred_email', email_address) set_dropdown_value('id_preferred_email', other_email_address) click_button(get_element(name='update')) # Verify that it was changed (we re-load the page to be sure it's not # some unexpected validation error): go_to(urls.EDIT) assert_element(**edit_account_anchor) assert_dropdown_value('id_preferred_email', other_email_address) # XXX Julien would also like this test to trigger an email being sent so # we can verify that the email is actually sent to the preferred # address.
set_dropdown_value, ) from u1testutils import mail from u1testutils.sst import config from acceptance import helpers, urls config.set_base_url_from_env() # Register the primary account. primary_email_id = mail.make_unique_test_email_address() helpers.register_account(primary_email_id, verify=True) # Register a secondary email. secondary_email_id = mail.make_unique_test_email_address() vcode = helpers.add_email(secondary_email_id) helpers.try_to_validate_email(secondary_email_id, vcode) # Change the preferred email. go_to(urls.HOME) select = get_element(tag='select', id='id_preferred_email') set_dropdown_value(select, secondary_email_id) click_button(get_element(name='update')) # Check that we got a notification e-mail to the *original* preferred # address, and mentioning the *new* preferred address. email_msg = mail.get_latest_email_sent_to(primary_email_id) mail.email_subject_includes(email_msg, 'E-mail change notification') mail.email_body_includes(email_msg, secondary_email_id)