Ejemplo n.º 1
0
def fill_design_page_single_pref(selenium, base_url, request, variables,
                                 experiment_type, fill_overview):
    """Fills design page according to single pref requirements."""
    design = DesignPage(selenium,
                        base_url,
                        experiment_url=f"{fill_overview.url}").open()
    design = design.wait_for_page_to_load()
    design.input_firefox_pref_name(
        f"{variables[experiment_type]['branches'][0]['firefox_pref_name']}")
    design.select_firefox_pref_type(
        f"{variables[experiment_type]['branches'][0]['firefox_pref_type']}")
    design.select_firefox_pref_branch(
        f"{variables[experiment_type]['branches'][0]['firefox_pref_branch']}")
    current_branchs = design.current_branches
    control_branch = current_branchs[0]
    control_branch.branch_name = (
        f"{variables[experiment_type]['branches'][0]['branch_name']}")
    control_branch.branch_description = "THIS IS A TEST"
    control_branch.branch_value = (
        f"{variables[experiment_type]['branches'][0]['branch_value']}")
    current_branchs[
        1].branch_name = f"{variables[experiment_type]['branches'][1]['branch_name']}"
    current_branchs[1].branch_description = "THIS IS A TEST"
    current_branchs[
        1].branch_value = f"{variables[experiment_type]['branches'][1]['branch_value']}"
    design.save_btn()
    return design
Ejemplo n.º 2
0
def fill_design_page_single_pref(
    selenium, base_url, request, default_data, experiment_type, fill_overview
):
    """Fills design page according to single pref requirements."""
    design = DesignPage(selenium, base_url, experiment_url=f"{fill_overview.url}").open()
    design = design.wait_for_page_to_load()
    design.input_firefox_pref_name(
        default_data.branches[0].preferences.preference_branch_name
    )
    design.select_firefox_pref_type(default_data.branches[0].preferences.preference_type)
    design.select_firefox_pref_branch(
        default_data.branches[0].preferences.preference_branch_type
    )
    current_branchs = design.current_branches
    control_branch = current_branchs[0]
    control_branch.branch_name = default_data.branches[0].branch_name
    control_branch.branch_description = "THIS IS A TEST"
    control_branch.branch_value = default_data.branches[0].preferences.preference_value
    current_branchs[1].branch_name = default_data.branches[1].branch_name
    current_branchs[1].branch_description = "THIS IS A TEST"
    current_branchs[1].branch_value = default_data.branches[
        1
    ].preferences.preference_value
    design.save_btn()
    return design
def test_add_branch(base_url, selenium, ds_issue_host, fill_overview):
    """Test adding a new branch."""
    exp_design = DesignPage(selenium,
                            base_url,
                            experiment_url=f"{fill_overview.url}").open()
    exp_design.input_firefox_pref_name("robot rock")
    exp_design.select_firefox_pref_type("boolean")
    exp_design.select_firefox_pref_branch("default")
    new_branch = exp_design.create_new_branch()
    assert "Branch 2" in new_branch.branch_number.text
def test_remove_branch(base_url, selenium, fill_overview):
    """Test removing a branch."""
    exp_design = DesignPage(selenium,
                            base_url,
                            experiment_url=f"{fill_overview.url}").open()
    exp_design.input_firefox_pref_name("robot rock")
    exp_design.select_firefox_pref_type("boolean")
    exp_design.select_firefox_pref_branch("default")
    current_branch = exp_design.current_branches
    current_branch[-1].remove_branch()
    branches = exp_design.current_branches
    assert len(branches) == 1
    assert "Control Branch" in branches[-1].branch_number.text
Ejemplo n.º 5
0
def fill_design_page(selenium, base_url, request, fill_overview):
    """Fills design page according to generic requirements."""
    design = DesignPage(selenium, base_url, experiment_url=f"{fill_overview.url}").open()
    design = design.wait_for_page_to_load()
    design.input_firefox_pref_name("default_fixture")
    design.select_firefox_pref_type("boolean")
    design.select_firefox_pref_branch("default")
    current_branchs = design.current_branches
    control_branch = current_branchs[0]
    control_branch.branch_name = "Fixture Branch"
    control_branch.branch_description = "THIS IS A TEST"
    control_branch.branch_value = "true"
    current_branchs[1].branch_name = "Fixture Branch 2"
    current_branchs[1].branch_description = "THIS IS A TEST"
    current_branchs[1].branch_value = "false"
    design.save_btn()
    return design
def test_duplicate_branch_name(base_url, selenium, ds_issue_host, fill_overview):
    """Test adding a branch with the same name as the control branch."""
    exp_design = DesignPage(
        selenium, base_url, experiment_url=f"{fill_overview.url}"
    ).open()
    exp_design.input_firefox_pref_name("robot rock")
    exp_design.select_firefox_pref_type("boolean")
    exp_design.select_firefox_pref_branch("default")
    control_branch = exp_design.current_branches[0]
    control_branch.branch_name = "DUPLICATE BRANCH"
    control_branch.branch_description = "THIS IS A TEST"
    control_branch.branch_value = "false"
    extra_branch = exp_design.current_branches[-1]
    extra_branch.branch_name = "DUPLICATE BRANCH"
    extra_branch.branch_description = "THIS IS A TEST"
    extra_branch.branch_value = "false"
    exp_design.save_and_continue()
    selenium.find_element_by_css_selector("#design-form .invalid-feedback")
Ejemplo n.º 7
0
def fill_design_page(selenium, base_url, request, variables, fill_overview):
    experiment_type = getattr(request.module, "experiment_type", None)
    design = DesignPage(selenium,
                        base_url,
                        experiment_url=f"{fill_overview.url}").open()
    design = design.wait_for_page_to_load()
    if request.node.get_closest_marker("use_variables"):
        design.input_firefox_pref_name(
            f"{variables[experiment_type]['branches'][0]['firefox_pref_name']}"
        )
        design.select_firefox_pref_type(
            f"{variables[experiment_type]['branches'][0]['firefox_pref_type']}"
        )
        design.select_firefox_pref_branch(
            f"{variables[experiment_type]['branches'][0]['firefox_pref_branch']}"
        )
        current_branchs = design.current_branches
        control_branch = current_branchs[0]
        control_branch.set_branch_name(
            f"{variables[experiment_type]['branches'][0]['branch_name']}")
        control_branch.set_branch_description("THIS IS A TEST")
        control_branch.set_branch_value(
            f"{variables[experiment_type]['branches'][0]['branch_value']}")
        current_branchs[1].set_branch_name(
            f"{variables[experiment_type]['branches'][1]['branch_name']}")
        current_branchs[1].set_branch_description("THIS IS A TEST")
        current_branchs[1].set_branch_value(
            f"{variables[experiment_type]['branches'][1]['branch_value']}")
    else:
        design.input_firefox_pref_name("default_fixture")
        design.select_firefox_pref_type("boolean")
        design.select_firefox_pref_branch("default")
        current_branchs = design.current_branches
        control_branch = current_branchs[0]
        control_branch.set_branch_name("Fixture Branch")
        control_branch.set_branch_description("THIS IS A TEST")
        control_branch.set_branch_value("true")
        current_branchs[1].set_branch_name("Fixture Branch 2")
        current_branchs[1].set_branch_description("THIS IS A TEST")
        current_branchs[1].set_branch_value("false")
    design.save_btn()
    return design