Пример #1
0
    def test_new(self):

        browser.open(
            "/en/cms/content/new/"
            "?item_type=woost.tests.test_selenium.test_edit.EditTestModel")
        admin_login()

        assert not browser.is_element_present(
            "css=.part_field .control .select")
        assert not browser.is_element_present("css=.part_field .control .edit")
        assert not browser.is_element_present(
            "css=.part_field .control .delete")
        assert not browser.is_element_present(
            "css=.part_field .control .unlink")

        browser.click("css=.part_field .control .new")
        browser.wait_for_page_to_load(10000)

        browser.type("edited_item_description", "Foo")
        browser.click("css=.save_action")
        browser.wait_for_page_to_load(10000)

        datastore.sync()
        part_id = int(browser.get_value("edited_item_part"))
        assert EditTestModel.require_instance(part_id).description == "Foo"
Пример #2
0
    def test_edit(self):

        datastore.sync()
        container = EditTestModel()
        container.description = "test_edit container"

        part = EditTestModel()
        part.description = "test_edit part"
        container.part = part

        container.insert()
        datastore.commit()

        browser.open("/en/cms/content/%d/fields" % container.id)
        admin_login()

        assert not browser.is_element_present(
            "css=.part_field .control .select")
        assert not browser.is_element_present("css=.part_field .control .new")
        assert not browser.is_element_present(
            "css=.part_field .control .unlink")
        assert browser.get_value("edited_item_part") == str(part.id)

        browser.click("css=.part_field .control .edit")
        browser.wait_for_page_to_load(10000)

        browser.type("edited_item_description", "modified test_edit part")
        browser.click("css=.save_action")
        browser.wait_for_page_to_load(10000)

        browser.click("css=.cancel_action")
        browser.wait_for_page_to_load(10000)

        datastore.sync()
        assert browser.get_value("edited_item_part") == str(part.id)
        assert part.description == "modified test_edit part"
Пример #3
0
    def test_add_filters_from_selector(self):

        from cocktail.schema.expressions import Self
        from cocktail.persistence import Query

        results = Item.select(
            [Item.id.greater(15),
             Self.search("@localhost", languages=["en"])])
        results_count = len(results)

        browser.open("/en/cms/content/?content_view=flat&search_expanded=true"
                     "&page_size=%d" % (results_count + 1))
        admin_login()

        # Add filters
        for i, filter_id in enumerate(("member-id", "global_search")):
            browser.fire_event("css=.new_filter_selector", "click")
            browser.fire_event("css=.new_filter-%s" % filter_id, "click")

        assert browser.jquery_count(".filters .filter_list .filter_entry") == 2

        # Set values on filters
        browser.type("filter_operator0", "gt")
        browser.type("filter_value0", "15")
        browser.type("filter_value1", "@localhost")
        browser.click("css=.filters .search_button")
        browser.wait_for_page_to_load(10000)

        # Test the returned content
        rows_count = browser.jquery_count(".collection_display .item_row")
        assert rows_count == results_count

        # Supplied values must be preserved between page loads
        assert browser.get_selected_value("filter_operator0") == "gt"
        assert browser.get_value("filter_value0") == "15"
        assert browser.get_value("filter_value1") == "@localhost"
Пример #4
0
 def login(self, user_name="", password=""):
     browser.type("user", user_name)
     browser.type("password", password)
     browser.click("authenticate")
     browser.wait_for_page_to_load(10000)
Пример #5
0
def login(user, password):
    browser.type("user", user)
    browser.type("password", password)
    browser.click("authenticate")
    browser.wait_for_page_to_load(10000)