xowiki::test::edit_form_page (public)

 xowiki::test::edit_form_page [ -user_id user_id ] \
    [ -last_request last_request ] [ -instance instance ] -path path \
    [ -update update ] [ -remove remove ] \
    [ -extra_url_parameter extra_url_parameter ] \
    [ -next_page_must_contain next_page_must_contain ] [ -refetch ]

Defined in packages/xowiki/tcl/test/test-procs.tcl

Edit a form page via the web interface. In essence, this calls $instance/$path?m=edit

Switches:
-user_id
(defaults to "0") (optional)
-last_request
(optional)
-instance
(optional)
-path
(required)
-update
(optional)
-remove
(optional)
-extra_url_parameter
(defaults to "{m edit}") (optional)
-next_page_must_contain
(optional)
-refetch
(boolean) (defaults to "true") (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_folder_with_page create_folder_with_page (test xowf) xowiki::test::edit_form_page xowiki::test::edit_form_page test_create_folder_with_page->xowiki::test::edit_form_page test_create_form_with_form_instance create_form_with_form_instance (test xowiki) test_create_form_with_form_instance->xowiki::test::edit_form_page test_create_form_with_numeric create_form_with_numeric (test xowiki) test_create_form_with_numeric->xowiki::test::edit_form_page test_create_test_items create_test_items (test ) test_create_test_items->xowiki::test::edit_form_page test_create_workflow_with_instance create_workflow_with_instance (test xowf) test_create_workflow_with_instance->xowiki::test::edit_form_page aa_log aa_log (public) xowiki::test::edit_form_page->aa_log aa_true aa_true (public) xowiki::test::edit_form_page->aa_true acs::test::dom_html acs::test::dom_html (public) xowiki::test::edit_form_page->acs::test::dom_html acs::test::form_reply acs::test::form_reply (public) xowiki::test::edit_form_page->acs::test::form_reply acs::test::get_form acs::test::get_form (public) xowiki::test::edit_form_page->acs::test::get_form

Testcases:
create_test_items, xowf, create_folder_with_page, create_workflow_with_instance, create_form_with_form_instance, create_form_with_numeric, form_validate
Source code:
        if {$instance eq ""} {
            if {[dict exists $last_request instance]} {
                set instance [dict get $last_request instance]
            }
        }
        aa_log "edit page $instance/$path"
        set d [acs::test::http  -user_id $user_id -last_request $last_request  [export_vars -base $instance/$path $extra_url_parameter]]
        acs::test::reply_has_status_code $d 200

        #set location [::acs::test::get_url_from_location $d]
        #aa_true "location '$location' is valid" {$location ne ""}
        set response [dict get $d body]

        acs::test::dom_html root $response {
            set f_id     [::xowiki::test::get_object_name $root]
            set CSSclass [::xowiki::test::get_form_CSSclass $root]
            aa_true "page_name '$f_id' non empty" {$f_id ne ""}
            aa_true "CSSclass: '$CSSclass' non empty"  {$CSSclass ne ""}
        }

        set form [acs::test::get_form $response "//form\[contains(@class,'$CSSclass') and @method='POST'\]"]

        set f_page_name [dict get $form fields _name]
        set f_creator   [dict get $form fields _creator]

        aa_true "page_name '$f_page_name' non empty" {$f_page_name ne ""}
        #aa_true "creator '$f_creator' is nonempty" {$f_creator ne ""}
        aa_log  "creator '$f_creator'"

        set f_form_action  [dict get $form @action]
        aa_true "form_action '$f_form_action' is nonempty" {$f_form_action ne ""}

        set form_content [dict get $form fields]
        set names [dict keys $form_content]
        aa_log "form names: [lsort $names]"
        aa_true "page has at least 9 fields" { [llength $names] >= 9 }

        set d [::acs::test::form_reply  -last_request $last_request -user_id $user_id  -form $form  -update $update  -remove $remove]
        acs::test::reply_has_status_code $d 302
        # set location /[::acs::test::get_url_from_location $d]

        if {$refetch_p} {
            foreach {key value} $update {
                dict set form_content $key $value
            }
            aa_log "form_content:\n[::xowiki::test::pretty_form_content $form_content]"

            set d [acs::test::http  -last_request $last_request -user_id $user_id  $instance/$path]
            acs::test::reply_has_status_code $d 200
            if {$next_page_must_contain eq ""} {
                set next_page_must_contain [dict get $form_content _title]
            }
            acs::test::reply_contains $d $next_page_must_contain
        }
        dict set d instance $instance
        return $d
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: