示例#1
0
def run_test(name, args):
    context_config = store_context()
    actions.reset_base_url()
    actions.set_wait_timeout(10, 0.1)

    try:
        return _execute_test(name, args)
    finally:
        restore_context(context_config)
示例#2
0
def run_test(name, args):
    context_config = store_context()
    actions.reset_base_url()
    actions.set_wait_timeout(10, 0.1)

    try:
        return _execute_test(name, args)
    finally:
        restore_context(context_config)
示例#3
0
    def test_retry_on_exception_fails_with_max_timeout(self):
        timeout = 0.5

        @actions.retry_on_exception(TestException)
        def protected_raiser():
            # It will have time to retry only once.
            time.sleep(timeout + 0.01)
            return self.raise_exception(times=2)

        actions.set_wait_timeout(timeout)
        self.assertRaises(TestException, protected_raiser)
示例#4
0
    def test_retry_on_exception_sleeps_poll_time(self):
        @actions.retry_on_exception(TestException, retries=1)
        def protected_raiser():
            return self.raise_exception(times=1)

        poll_time = random.random()
        actions.set_wait_timeout(10, poll_time)
        with mock.patch('time.sleep') as mock_sleep:
            protected_raiser()

        mock_sleep.assert_called_once_with(poll_time)
    def test_retry_on_exception_fails_with_max_timeout(self):
        timeout = 0.5

        @actions.retry_on_exception(TestException)
        def protected_raiser():
            # It will have time to retry only once.
            time.sleep(timeout + 0.01)
            return self.raise_exception(times=2)

        actions.set_wait_timeout(timeout)
        self.assertRaises(TestException, protected_raiser)
    def test_retry_on_exception_sleeps_poll_time(self):
        @actions.retry_on_exception(TestException, retries=1)
        def protected_raiser():
            return self.raise_exception(times=1)

        poll_time = random.random()
        actions.set_wait_timeout(10, poll_time)
        with mock.patch('time.sleep') as mock_sleep:
            protected_raiser()

        mock_sleep.assert_called_once_with(poll_time)
    click_button,
    click_link,
    get_element,
    go_to,
    set_wait_timeout,
    write_textfield,
    wait_for,
)
from u1testutils.sst import config

from acceptance.helpers import logout, production_only

config.set_base_url_from_env()

# Some external sites have extraordinary wait times
set_wait_timeout(20)

# Check whether we're on Production or not
production_only()

# Ubuntu One
go_to('http://ubuntuone.com')
click_link(get_element(text="Log in or Sign up"))
write_textfield('id_email', settings.SSO_TEST_ACCOUNT_EMAIL)
write_textfield('id_password', settings.SSO_TEST_ACCOUNT_PASSWORD)
click_button(get_element(name='continue'))
assert_element(tag='span', text='Welcome ISD Test')
logout()

# Payment system
go_to('https://pay.ubuntu.com/')
示例#8
0
 def test_wait_for_returns_result_of_wrapped_call(self):
     actions.set_wait_timeout(0.3)
     self.assertEquals(actions.wait_for(lambda: 2), 2)
     self.assertEquals(actions.wait_for(lambda: True), True)
     self.assertRaises(AssertionError, actions.wait_for, lambda: None)
     self.assertRaises(AssertionError, actions.wait_for, lambda: False)
    button.click()

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

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

a.wait_for(a.assert_displayed, 'p_method_getfinancing')
a.click_element(a.get_element(id='p_method_getfinancing'))
a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-payment']"
    "//button"))

# go through gf process
a.set_wait_timeout(60.0)

a.wait_for(a.switch_to_frame, 'popup')
a.wait_for(a.assert_displayed, 'id_ssn4')
a.write_textfield('id_ssn4', '6220')
a.click_element('id_agree')
a.click_button('submit-id-btn_find')

# we could either adopt the loan or start from scratch; check
el = a.wait_for(common.get_elements_multiple, [
    ([], { 'id': 'id_salary_current' }),
    ([], { 'id': 'comment' }),
    ])

if el[0].get_attribute('id') == 'id_salary_current':
    a.wait_for(a.assert_displayed, 'id_salary_current')