예제 #1
0
def wait_for_editor(context, tooltips=False):
    util = context.util
    driver = context.driver
    builder = context.selenic
    wedutil.wait_for_editor(util)

    context.origin_object = driver.execute_script(
        """
    var tooltips = arguments[0];
    if (!tooltips) {
        // Turn off tooltips
        wed_editor.preferences.set("tooltips", false);

        // Delete all tooltips.
        jQuery(".tooltip").remove();
    }

    // This is bullshit to work around a Selenium limitation.
    jQuery("body").append(
        '<div id="origin-object" style=' +
        '"position: fixed; top: 0px; left: 0px; width:1px; height:1px;"/>');
    return jQuery("#origin-object")[0];
    """, tooltips)

    # For some reason, FF does not get focus automatically.
    # This counters the problem.
    if builder.config.browser == "FIREFOX":
        body = driver.find_element_by_css_selector(".wed-document")
        ActionChains(driver) \
            .move_to_element_with_offset(body, 1, 1) \
            .click() \
            .perform()
예제 #2
0
파일: util.py 프로젝트: bennettbuchanan/wed
def wait_for_editor(context, tooltips=False):
    util = context.util
    driver = context.driver
    builder = context.builder
    wedutil.wait_for_editor(util)

    context.origin_object = driver.execute_script("""
    var tooltips = arguments[0];
    if (!tooltips) {
        // Turn off tooltips
        wed_editor.preferences.set("tooltips", false);

        // Delete all tooltips.
        jQuery(".tooltip").remove();
    }

    // This is bullshit to work around a Selenium limitation.
    jQuery("body").append(
        '<div id="origin-object" style=' +
        '"position: fixed; top: 0px; left: 0px; width:1px; height:1px;"/>');
    return jQuery("#origin-object")[0];
    """, tooltips)

    # For some reason, FF does not get focus automatically.
    # This counters the problem.
    if builder.config.browser == "FIREFOX":
        body = driver.find_element_by_css_selector(".wed-document")
        ActionChains(driver) \
            .move_to_element_with_offset(body, 1, 1) \
            .click() \
            .perform()
예제 #3
0
def setup_editor(context):
    util = context.util
    driver = context.driver

    wedutil.wait_for_editor(util, 60)

    # Turning off tooltips makes the tests much easier to handle.
    driver.execute_script("""
    // Turn off tooltips
    wed_editor.preferences.set("tooltips", false);

    // Delete all tooltips.
    jQuery(".tooltip").remove();
    """)
예제 #4
0
def wait_for_editor(context):
    util = context.util
    driver = context.driver
    wedutil.wait_for_editor(util, 60)

    # Turning off tooltips makes the tests much easier to handle.
    context.origin_object = driver.execute_script("""
    // Turn off tooltips
    wed_editor.preferences.set("tooltips", false);

    // Delete all tooltips.
    jQuery(".tooltip").remove();

    // This is bullshit to work around a Selenium limitation.
    document.body.insertAdjacentHTML('beforeend',
        '<div id="origin-object" style=' +
        '"position: fixed; top: 0px; left: 0px; width:1px; height:1px;"/>');
    return document.body.lastElementChild;
    """)
예제 #5
0
파일: general.py 프로젝트: keisetsu/wed
def load_and_wait_for_editor(context, text=None):
    no_before_unload(context)
    driver = context.driver
    util = context.util
    config = context.selenic_config
    server = config.WED_SERVER + "?mode=test"
    if text is not None:
        server = server + "&file=" + text

    driver.get(server)

    wedutil.wait_for_editor(util)

    # This is bullshit to work around a Selenium limitation.
    driver.execute_script("""
    jQuery("body").append(
      '<div id="origin-object" '+
      'style="position: fixed; top: 0px; left: 0px; z-index: -10;"/>');
    """)
    context.origin_object = driver.find_element_by_id("origin-object")