示例#1
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    browser = actions.get_browser()
    checkbox_not_checked = browser.find('#unselected-checkbox')
    checkbox_checked = browser.find('#selected-checkbox')
    radio_not_checked = browser.find('#exampleRadios2')
    # checkbox not checked
    actions.verify_element_not_checked(checkbox_not_checked)
    checkbox_not_checked.check()
    actions.verify_element_checked(checkbox_not_checked)
    # checkbox already checked
    actions.verify_element_checked(checkbox_checked)
    checkbox_checked.check()
    actions.verify_element_checked(checkbox_checked)
    # radio button not checked
    actions.verify_element_not_checked(radio_not_checked)
    radio_not_checked.check()
    actions.verify_element_checked(radio_not_checked)
    radio_checked = radio_not_checked
    # radio button already checked
    radio_checked.check()
    actions.verify_element_checked(radio_checked)
    # try to check an element not radio or checkbox
    msg = 'Element #button-one is not checkbox or radiobutton'
    with expected_exception(Exception, msg):
        browser.find('#button-one').check()
示例#2
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    browser = actions.get_browser()
    checkbox_not_checked = '#unselected-checkbox'
    checkbox_checked = '#selected-checkbox'
    radio_not_checked = '#exampleRadios2'
    # checkbox not checked
    actions.verify_element_not_checked(checkbox_not_checked)
    browser.check_element(checkbox_not_checked)
    actions.verify_element_checked(checkbox_not_checked)
    # checkbox already checked
    actions.verify_element_checked(checkbox_checked)
    browser.check_element(checkbox_checked)
    actions.verify_element_checked(checkbox_checked)
    # radio button not checked
    actions.verify_element_not_checked(radio_not_checked)
    browser.check_element(radio_not_checked)
    actions.verify_element_checked(radio_not_checked)
    radio_checked = radio_not_checked
    # radio button already checked
    browser.check_element(radio_checked)
    actions.verify_element_checked(radio_checked)
    # try to check an element not radio or checkbox
    try:
        browser.check_element('#button-one')
        assert False, 'Expected Exception'
    except Exception as e:
        assert 'Element #button-one is not checkbox or radiobutton' in e.args[
            0]
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_not_checked('#unselected-checkbox')
    try:
        actions.verify_element_not_checked('#selected-checkbox')
    except Exception as e:
        assert 'element #selected-checkbox is checked' in e.args[0]
    actions.verify_element_not_checked('#exampleRadios2')
    try:
        actions.verify_element_not_checked('#exampleRadios1')
    except Exception as e:
        assert 'element #exampleRadios1 is checked' in e.args[0]
示例#4
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    browser = actions.get_browser()
    checkbox_checked = browser.find('#selected-checkbox')
    checkbox_not_checked = browser.find('#unselected-checkbox')
    radio_checked = browser.find('#exampleRadios1')
    # checkbox not checked
    actions.verify_element_not_checked(checkbox_not_checked)
    checkbox_not_checked.uncheck()
    actions.verify_element_not_checked(checkbox_not_checked)
    # checkbox already checked
    actions.verify_element_checked(checkbox_checked)
    checkbox_checked.uncheck()
    actions.verify_element_not_checked(checkbox_checked)
    # uncheck a radio button (error)
    actions.verify_element_checked(radio_checked)
    with expected_exception(Exception,
                            'Element #exampleRadios1 is not checkbox'):
        radio_checked.uncheck()
    # try to uncheck an element not checkbox
    with expected_exception(Exception, 'Element #button-one is not checkbox'):
        actions.get_browser().find('#button-one').uncheck()
示例#5
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    checkbox_checked = '#selected-checkbox'
    checkbox_not_checked = '#unselected-checkbox'
    radio_checked = '#exampleRadios1'
    # checkbox not checked
    actions.verify_element_not_checked(checkbox_not_checked)
    actions.uncheck_element(checkbox_not_checked)
    golem_steps.assert_last_step_message(
        'Uncheck checkbox {}'.format(checkbox_not_checked))
    actions.verify_element_not_checked(checkbox_not_checked)
    # checkbox already checked
    actions.verify_element_checked(checkbox_checked)
    actions.uncheck_element(checkbox_checked)
    actions.verify_element_not_checked(checkbox_checked)
    # uncheck a radio button (error)
    actions.verify_element_checked(radio_checked)
    with expected_exception(ValueError,
                            'Element #exampleRadios1 is not checkbox'):
        actions.uncheck_element(radio_checked)
    # try to uncheck an element not checkbox
    with expected_exception(ValueError, 'Element #button-one is not checkbox'):
        actions.uncheck_element('#button-one')
示例#6
0
def test(data):
    actions.navigate(data.env.url+'elements/')
    actions.verify_element_not_checked('#unselected-checkbox')
    golem_steps.assert_last_step_message('Verify element #unselected-checkbox is not checked')
    actions.verify_element_not_checked('#selected-checkbox')
    golem_steps.assert_last_error('element #selected-checkbox is checked')