Exemplo n.º 1
0
def enter_value_in_spinner(driver, el, value, del_prev=True):
    if del_prev:
        el.clear()
    actions = ActionChains(driver)
    actions.move_to_element(el)
    actions.click()
    actions.send_keys(str(value))
    actions.send_keys(Keys.ENTER)
    actions.perform()
Exemplo n.º 2
0
def drag_slider(driver, css_class, distance, release=True):
    el = driver.find_element_by_css_selector(css_class)
    handle = el.find_element_by_css_selector('.bk-noUi-handle')
    actions = ActionChains(driver)
    actions.move_to_element(handle)
    actions.click_and_hold()
    actions.move_by_offset(distance, 0)
    if release:
        actions.release()
    actions.perform()
Exemplo n.º 3
0
def enter_value_in_spinner(driver, el, value, del_prev=True):
    actions = ActionChains(driver)
    actions.move_to_element(el)
    actions.click()
    if del_prev:
        actions.key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL)
    actions.send_keys(str(value))
    actions.send_keys(Keys.ENTER)
    actions.perform()
Exemplo n.º 4
0
    def test_spinner_spinning_events(self, bokeh_model_page) -> None:
        spinner = Spinner(value=0,
                          low=0,
                          high=1,
                          step=0.01,
                          css_classes=["foo"])
        spinner.js_on_change('value',
                             CustomJS(code=RECORD("value", "cb_obj.value")))

        page = bokeh_model_page(spinner)

        input_el = page.driver.find_element_by_css_selector('.foo input')
        btn_up_el = page.driver.find_element_by_css_selector(
            '.foo .bk-spin-btn-up')
        btn_down_el = page.driver.find_element_by_css_selector(
            '.foo .bk-spin-btn-down')

        enter_text_in_element(page.driver, input_el, "0.5")
        results = page.results
        assert results['value'] == 0.5

        #click btn up
        actions = ActionChains(page.driver)
        actions.click(on_element=btn_up_el)
        actions.perform()
        results = page.results
        assert results['value'] == 0.51

        #dbl click btn down
        actions = ActionChains(page.driver)
        actions.double_click(on_element=btn_down_el)
        actions.perform()
        results = page.results
        assert results['value'] == 0.49

        #arrow up
        actions = ActionChains(page.driver)
        actions.click(on_element=input_el)
        actions.send_keys(Keys.ARROW_UP)
        actions.perform()
        results = page.results
        assert results['value'] == 0.50

        #arrow down
        actions = ActionChains(page.driver)
        actions.click(on_element=input_el)
        actions.key_down(Keys.ARROW_DOWN)
        actions.perform()
        results = page.results
        assert results['value'] == 0.49

        #page up
        actions = ActionChains(page.driver)
        actions.click(on_element=input_el)
        actions.key_down(Keys.PAGE_UP)
        actions.perform()
        results = page.results
        assert results['value'] == 0.59

        #page down
        actions = ActionChains(page.driver)
        actions.click(on_element=input_el)
        actions.key_down(Keys.PAGE_DOWN)
        actions.perform()
        results = page.results
        assert results['value'] == 0.49

        assert page.has_no_console_errors()
Exemplo n.º 5
0
def enter_value_in_spinner(driver, el, value, del_prev=True):
    actions = ActionChains(driver)
    actions.move_to_element(el)
    actions.click()
    if del_prev:
        actions.key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL)
    actions.send_keys(str(value))
    actions.send_keys(Keys.ENTER)
    actions.perform()
Exemplo n.º 6
0
def drag_slider(driver, css_class, distance, release=True):
    el = driver.find_element_by_css_selector(css_class)
    handle = el.find_element_by_css_selector('.bk-noUi-handle')
    actions = ActionChains(driver)
    actions.move_to_element(handle)
    actions.click_and_hold()
    actions.move_by_offset(distance, 0)
    if release:
        actions.release()
    actions.perform()