Пример #1
0
def _set_settings(browser, setting_type):
    used_settings = list_view_settings[setting_type]
    default_column_count = used_settings["default_column_count"]
    addable_fields = used_settings["addable_fields"]

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)

    #shuup_tests/browser/front/test_category_view.py
    settings_xpath = "(//a[contains(text(),'Settings')])[2]"
    # go to settings
    browser.find_by_xpath(settings_xpath).click()

    # select settings
    for idx, (index_key, text) in enumerate(addable_fields):
        expected_index = default_column_count + 1 + idx
        assert browser.is_text_present(text)
        browser.find_by_xpath("//ul[@id='source-sortable']/li[%d]/button" %
                              index_key).first.click()
        wait_until_appeared_xpath(
            browser,
            "//ul[@id='target-sortable']/li[%d]/button" % expected_index)

    # save settings
    browser.find_by_css(".btn.btn-success").first.click()
    wait_until_appeared(browser, ".picotable-item-info")

    for idx, text in addable_fields:
        wait_until_condition(browser, lambda x: x.is_text_present(text))

    # go back to settings
    browser.find_by_xpath(settings_xpath).click()

    wait_until_appeared_xpath(browser,
                              "//a[contains(text(),'Reset Defaults')]")

    # reset to defaults
    browser.find_by_xpath("//a[contains(text(),'Reset Defaults')]").click()

    # wait
    wait_until_appeared(browser, ".picotable-item-info")

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)
Пример #2
0
def _set_settings(browser, setting_type, creator):
    used_settings = list_view_settings[setting_type]
    default_column_count = used_settings["default_column_count"]
    addable_fields = used_settings["addable_fields"]

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)

    browser.find_by_css(".shuup-toolbar .btn.btn-inverse").first.click()

    # select settings
    for idx, (index_key, text) in enumerate(addable_fields):
        expected_index = default_column_count + 1 + idx
        assert browser.is_text_present(text)
        browser.find_by_xpath("//ul[@id='source-sortable']/li[%d]/button" %
                              index_key).first.click()
        wait_until_appeared_xpath(
            browser,
            "//ul[@id='target-sortable']/li[%d]/button" % expected_index)

    # save settings
    move_to_element(browser, ".shuup-toolbar .btn.btn-success")
    browser.find_by_css(".shuup-toolbar .btn.btn-success").first.click()
    _check_picotable_item_info(browser, creator)

    if creator:
        for idx, text in addable_fields:
            wait_until_condition(browser, lambda x: x.is_text_present(text))

    # go back to settings
    browser.find_by_css(".shuup-toolbar .btn.btn-inverse").first.click()

    wait_until_appeared_xpath(browser,
                              "//a[contains(text(),'Reset Defaults')]")

    # reset to defaults
    browser.find_by_xpath("//a[contains(text(),'Reset Defaults')]").click()

    # wait
    _check_picotable_item_info(browser, creator)

    # not selected by default
    if creator:
        for idx, text in addable_fields:
            assert not browser.is_text_present(text)
Пример #3
0
def _set_settings(browser, setting_type, creator):
    used_settings = list_view_settings[setting_type]
    default_column_count = used_settings["default_column_count"]
    addable_fields = used_settings["addable_fields"]

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)

    browser.find_by_css(".shuup-toolbar .btn.btn-inverse").first.click()

    # select settings
    for idx, (index_key, text) in enumerate(addable_fields):
        expected_index = default_column_count + 1 + idx
        assert browser.is_text_present(text)
        browser.find_by_xpath("//ul[@id='source-sortable']/li[%d]/button" % index_key).first.click()
        wait_until_appeared_xpath(browser, "//ul[@id='target-sortable']/li[%d]/button" % expected_index)

    # save settings
    move_to_element(browser, ".shuup-toolbar .btn.btn-success")
    browser.find_by_css(".shuup-toolbar .btn.btn-success").first.click()
    _check_picotable_item_info(browser, creator)

    if creator:
        for idx, text in addable_fields:
            wait_until_condition(browser, lambda x: x.is_text_present(text))

    # go back to settings
    browser.find_by_css(".shuup-toolbar .btn.btn-inverse").first.click()

    wait_until_appeared_xpath(browser, "//a[contains(text(),'Reset Defaults')]")

    # reset to defaults
    browser.find_by_xpath("//a[contains(text(),'Reset Defaults')]").click()

    # wait
    _check_picotable_item_info(browser, creator)

    # not selected by default
    if creator:
        for idx, text in addable_fields:
           assert not browser.is_text_present(text)
Пример #4
0
def _set_settings(browser, setting_type):
    used_settings = list_view_settings[setting_type]
    default_column_count = used_settings["default_column_count"]
    addable_fields = used_settings["addable_fields"]

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)
    #shuup_tests/browser/front/test_category_view.py
    settings_xpath = "(//a[contains(text(),'Settings')])[2]"
    # go to settings
    browser.find_by_xpath(settings_xpath).click()

    # select settings
    for idx, (index_key, text) in enumerate(addable_fields):
        expected_index = default_column_count + 1 + idx
        assert browser.is_text_present(text)
        browser.find_by_xpath("//ul[@id='source-sortable']/li[%d]/button" % index_key).first.click()
        wait_until_appeared_xpath(browser, "//ul[@id='target-sortable']/li[%d]/button" % expected_index)
        # browser.find_by_css(".btn.btn-xs.btn-success.btn-add-sortable").first.click()

    # save settings
    browser.find_by_css(".btn.btn-success").first.click()
    wait_until_appeared(browser, ".picotable-item-info")

    for idx, text in addable_fields:
        wait_until_condition(browser, lambda x: x.is_text_present(text))

    # go back to settings
    browser.find_by_xpath(settings_xpath).click()

    wait_until_appeared_xpath(browser, "//a[contains(text(),'Reset Defaults')]")

    # reset to defaults
    browser.find_by_xpath("//a[contains(text(),'Reset Defaults')]").click()

    # wait
    wait_until_appeared(browser, ".picotable-item-info")

    # not selected by default
    for idx, text in addable_fields:
        assert not browser.is_text_present(text)