Ejemplo n.º 1
0
    def _account_menu_1_9(self, item):
        account = a.get_element_by_xpath(
            "//a[contains(@class, 'skip-account')]")
        a.click_link(account)

        link = a.get_element_by_xpath("//a[@title='%s']" % item)
        a.click_link(link)
Ejemplo n.º 2
0
    def add_billing_address(self):
        # from the account page
        manage_link = a.get_element_by_xpath("//a[text()='Manage Addresses']")
        a.click_link(manage_link)

        fill_user_form(self._data, version=self._version)
        button = a.get_element_by_xpath("//button[@title='Save Address']")
        a.click_button(button)
Ejemplo n.º 3
0
    def navigate(self, first, second):
        # no idea how to hover, but there's a false click handler so that works
        hover_link = a.get_element_by_xpath(
            "//li[%s]/*/*[%s]/.." % (
                xpath_contains_class('level0'),
                xpath_contains_text(first))
        )
        a.click_link(hover_link)

        final_link = a.get_element_by_xpath(
            "//li[%s]/*/*[%s]/.." % (
                xpath_contains_class('level1'),
                xpath_contains_text(second))
        )
        a.click_link(final_link)
Ejemplo n.º 4
0
 def customer_edit_by_email(self, email):
     edit_link = a.get_element_by_xpath(
         "//table[@id='customerGrid_table']"
         "//td[%s]"
         "//.."
         "//a" % (xpath_contains_text(email))
     )
     a.click_link(edit_link)
Ejemplo n.º 5
0
    def login(self):
        go_to('admin/')
        a.assert_title_contains('Admin')

        fill_user_form(self._data)
        button = a.get_element_by_xpath("//input[@title='Login']")
        a.click_button(button)

        # do away with messages if any
        close = None
        try:
            close = a.get_element_by_xpath(
                "//div[@id='message-popup-window']"
                "//a[@title='close']")
        except AssertionError:
            pass
        if close:
            a.click_link(close)
Ejemplo n.º 6
0
    def login(self):
        if self._version >= (1, 9, 0, 0):
            self._account_menu_1_9('Log In')
        else:
            a.click_link(a.get_element(text='Log In'))

        # fill in data on login screen
        data = {
            'email': self._data['email_address'],
            'pass': self._data['password'],
        }
        fill_user_form(data, version=self._version)

        button = a.get_element_by_xpath("//button[@title='Login']")
        a.click_button(button)

        e = a.get_element_by_xpath("//p[@class='welcome-msg']")
        assert e.text.upper() == u'WELCOME, MARY BERNARD!', \
            "Login failed: %r" % e.text
Ejemplo n.º 7
0
    def register(self):
        if self._version >= (1, 9, 0, 0):
            self._account_menu_1_9('Register')
        else:
            a.click_link(a.get_element(text='My Account'))
            button = a.get_element_by_xpath(
                "//button[@title='Create an Account']")
            a.click_button(button)


        # fill in data for mary and register
        fill_user_form(self._data, version=self._version)

        if self._version >= (1, 9, 0, 0):
            title = 'Register'
        else:
            title = 'Submit'
        button = a.get_element_by_xpath("//button[@title='%s']" % title)
        a.click_button(button)
Ejemplo n.º 8
0
    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')
Ejemplo n.º 9
0
user.login()

# search for tv
a.write_textfield('search', 'tv')
common.click_button_by_title('Search')

# click it
common.click_button_by_title('Add to Cart', multiple=True)

common.click_button_by_title('Proceed to Checkout', multiple=True)

a.wait_for(a.assert_displayed, 'checkout-step-billing')

a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-billing']"
    "//button[@title='Continue']"))

# in 1.4 it doesn't automatically proceed to shipping method
# because Use Billing Address is not active
if common.get_version() < (1, 5, 0, 0):
    check = a.get_element_by_xpath("//input[@id='shipping:same_as_billing']")
    a.wait_for(a.assert_displayed, check)
    check.click()
    # we need the right continue button, so roll by hand
    button = a.get_element_by_xpath(
        "//form[@id='co-shipping-form']//button[@title='Continue']")
    button.click()

a.wait_for(a.assert_displayed, 'checkout-step-shipping_method')