def edit_page(webdriver, datasets):
    edit_page = Editor(webdriver, page_id=datasets['page_id'])

    @print_timing
    def measure(webdriver, interaction):
        edit_page.go_to()
        edit_page.wait_for_page_loaded(interaction)
    measure(webdriver, "selenium_edit_page:open_create_page_editor")

    edit_page.write_content(interaction='edit page')

    @print_timing
    def measure(webdriver, interaction):
        edit_page.save_edited_page(interaction)
    measure(webdriver, "selenium_edit_page:save_edited_page")
def create_confluence_page(webdriver, datasets):
    nav_panel = TopNavPanel(webdriver)
    create_page = Editor(webdriver)

    @print_timing("selenium_create_page")
    def measure():
        @print_timing("selenium_create_page:open_create_page_editor")
        def sub_measure():
            nav_panel.click_create()
            PopupManager(webdriver).dismiss_default_popup()
            create_page.wait_for_create_page_open()

        sub_measure()

        PopupManager(webdriver).dismiss_default_popup()

        create_page.write_title()
        create_page.write_content()

        @print_timing("selenium_create_page:save_created_page")
        def sub_measure():
            create_page.click_submit()
            page = Page(webdriver)
            page.wait_for_page_loaded()

        sub_measure()

    measure()
def create_comment(webdriver, datasets):
    page = Page(webdriver, page_id=datasets['page_id'])
    page.go_to()
    page.wait_for_page_loaded(interaction='create comment')
    edit_comment = Editor(webdriver)
    @print_timing
    def measure(webdriver, interaction):
        page.click_add_comment()
        edit_comment.write_content(interaction=interaction, text='This is selenium comment')
    measure(webdriver, 'selenium_create_comment:write_comment')

    @print_timing
    def measure(webdriver, interaction):
        edit_comment.click_submit()
        page.wait_for_comment_field(interaction)
    measure(webdriver, "selenium_create_comment:save_comment")
    def measure():
        page.go_to()
        page.wait_for_page_loaded()
        edit_comment = Editor(webdriver)

        @print_timing("selenium_create_comment:write_comment")
        def sub_measure():
            page.click_add_comment()
            edit_comment.write_content(text='This is selenium comment')

        sub_measure()

        @print_timing("selenium_create_comment:save_comment")
        def sub_measure():
            edit_comment.click_submit()
            page.wait_for_comment_field()

        sub_measure()
def edit_confluence_page(webdriver, datasets):
    edit_page = Editor(webdriver, page_id=datasets['page_id'])

    @print_timing("selenium_edit_page")
    def measure():
        @print_timing("selenium_edit_page:open_create_page_editor")
        def sub_measure():
            edit_page.go_to()
            edit_page.wait_for_page_loaded()

        sub_measure()

        edit_page.write_content()

        @print_timing("selenium_edit_page:save_edited_page")
        def sub_measure():
            edit_page.save_edited_page()

        sub_measure()

    measure()
def create_page(webdriver, datasets):
    nav_panel = TopNavPanel(webdriver)
    create_page = Editor(webdriver)

    @print_timing
    def measure(webdriver, interaction):
        nav_panel.click_create(interaction)
        PopupManager(webdriver).dismiss_default_popup()
        create_page.wait_for_create_page_open(interaction)
    measure(webdriver, "selenium_create_page:open_create_page_editor")

    PopupManager(webdriver).dismiss_default_popup()

    create_page.write_title()
    create_page.write_content(interaction='create page')

    @print_timing
    def measure(webdriver, interaction):
        create_page.click_submit()
        page = Page(webdriver)
        page.wait_for_page_loaded(interaction)
    measure(webdriver, "selenium_create_page:save_created_page")