Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -N -r1.12.2.67 -r1.12.2.68 --- openacs-4/packages/xowf/xowf.info 12 Jan 2022 17:47:21 -0000 1.12.2.67 +++ openacs-4/packages/xowf/xowf.info 18 Jan 2022 12:51:45 -0000 1.12.2.68 @@ -10,16 +10,16 @@ t xowf - + Gustaf Neumann XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms 2021-09-15 WU Vienna BSD-Style 2 - - + + Index: openacs-4/packages/xowf/tcl/test/test-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test/Attic/test-item-procs.tcl,v diff -u -N -r1.1.2.15 -r1.1.2.16 --- openacs-4/packages/xowf/tcl/test/test-item-procs.tcl 18 Jan 2022 11:25:11 -0000 1.1.2.15 +++ openacs-4/packages/xowf/tcl/test/test-item-procs.tcl 18 Jan 2022 12:51:45 -0000 1.1.2.16 @@ -415,7 +415,7 @@ aa_true "lookup of en:sample_text_0 succeeded" {$text_page_id != 0} set text_page [::xo::db::CrClass get_instance_from_db -item_id $text_page_id] - aa_section "Create image 'file:somefile' as child of '[$text_page name]'" + aa_section "Create file 'file:somefile' as child of '[$text_page name]'" set file_object [::xowiki::File new \ -destroy_on_cleanup \ -title "somefile" \ @@ -428,27 +428,32 @@ $::acs::rootdir/packages/xowf/tcl/test/test-item-procs.tcl $file_object save_new + ############################################################# aa_section "Call preview workflow for '[$text_page name]'" - # - # we should make here a POST with button "__action_preview" for - # - aa_log "=============== call edit with PREVIEW" + set d [::xowiki::test::edit_form_page \ -last_request $dt \ + -refetch=0 \ -path $testfolder/[$text_page name] \ -update { __action_preview "" + __form_action "save-form-data" }] - #aa_log "inclass exam edited d=[ns_quotehtml $d]" acs::test::reply_has_status_code $d 302 set location /[::acs::test::get_url_from_location $d] - aa_log "fill-out page=[ns_quotehtml $location]" + set d [acs::test::http -last_request $d $location] + acs::test::reply_has_status_code $d 302 + set location /[::acs::test::get_url_from_location $d] + set d [acs::test::http -last_request $d $location] set response [dict get $d body] set results ""; set hrefs "" - ns_log notice RESPONSE=$response + #ns_log notice RESPONSE1=$response acs::test::dom_html root $response { foreach e [$root getElementsByTagName a] { + if {![$e hasAttribute href]} { + continue + } set href [$e getAttribute href] lappend hrefs $href if {[string match "*somefile*" $href]} { @@ -457,34 +462,36 @@ dict set results unresolved [$e getAttribute class] } } - aa_log "results '$results' hrefs
[join $hrefs \n]
" aa_log "results '$results'" } + aa_true "link 'somefile' is resolved" {[dict get $results somefile] eq "file"} + aa_true "link 'unresolved' is not resolved" {[dict get $results unresolved] eq "missing"} + ########################################################################################## aa_section "create composite page 'sample_composite_0'" - ::xowiki::test::create_form_page \ - -last_request $d \ - -instance $instance \ - -path $testfolder \ - -parent_id $folder_id \ - -form_name en:edit-interaction.wf \ - -extra_url_parameter {{p.item_type Composite}} \ - -update { - _title "Sample composite Interaction" - _name sample_composite_0 - _nls_language en_US - question.points 4 - question.twocol f - question.interaction.text {Given a text with an [[file:otherfile]].} - question.interaction.selection .testfolder/en:sample_text_0 - } + set dt [::xowiki::test::create_form_page \ + -last_request $d \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -form_name en:edit-interaction.wf \ + -extra_url_parameter {{p.item_type Composite}} \ + -update { + _title "Sample composite Interaction" + _name sample_composite_0 + _nls_language en_US + question.points 4 + question.twocol f + question.interaction.text {Given a text with an [[file:otherfile]].} + question.interaction.selection .testfolder/en:sample_text_0 + }] set composite_page_id [::xo::db::CrClass lookup -name en:sample_composite_0 -parent_id $folder_id] aa_true "lookup of en:sample_text_0 succeeded" {$composite_page_id != 0} set composite_page [::xo::db::CrClass get_instance_from_db -item_id $composite_page_id] - aa_section "Create image 'file:somefile' as child of '[$text_page name]'" + aa_section "Create file 'file:somefile' as child of '[$text_page name]'" set file_object [::xowiki::File new \ -destroy_on_cleanup \ -title "otherfile" \ @@ -497,7 +504,49 @@ $::acs::rootdir/packages/xowf/tcl/test/test-item-procs.tcl $file_object save_new + ############################################################# + aa_section "Call preview workflow for '[$composite_page name]'" + set d [::xowiki::test::edit_form_page \ + -last_request $dt \ + -refetch=0 \ + -path $testfolder/[$composite_page name] \ + -update { + __action_preview "" + __form_action "save-form-data" + }] + acs::test::reply_has_status_code $d 302 + set location /[::acs::test::get_url_from_location $d] + set d [acs::test::http -last_request $d $location] + acs::test::reply_has_status_code $d 302 + set location /[::acs::test::get_url_from_location $d] + set d [acs::test::http -last_request $d $location] + + set response [dict get $d body] + set results ""; set hrefs "" + #ns_log notice RESPONSE2=$response + acs::test::dom_html root $response { + foreach e [$root getElementsByTagName a] { + if {![$e hasAttribute href]} { + continue + } + set href [$e getAttribute href] + lappend hrefs $href + if {[string match "*somefile*" $href]} { + dict set results somefile [$e getAttribute class] + } elseif {[string match "*unresolved*" $href]} { + dict set results unresolved [$e getAttribute class] + } elseif {[string match "*otherfile*" $href]} { + dict set results otherfile [$e getAttribute class] + } + } + aa_log "results '$results'" + } + aa_true "link 'somefile' is resolved" {[dict get $results somefile] eq "file"} + aa_true "link 'otherfile' is resolved" {[dict get $results otherfile] eq "file"} + aa_true "link 'unresolved' is not resolved" {[dict get $results unresolved] eq "missing"} + + } on error {errorMsg} { aa_true "Error msg: $errorMsg" 0 } finally { Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -N -r1.180.2.80 -r1.180.2.81 --- openacs-4/packages/xowiki/xowiki.info 15 Jan 2022 16:16:04 -0000 1.180.2.80 +++ openacs-4/packages/xowiki/xowiki.info 18 Jan 2022 12:51:45 -0000 1.180.2.81 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2021-09-15 @@ -55,7 +55,7 @@ BSD-Style 2 - + Index: openacs-4/packages/xowiki/tcl/test/test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/test-procs.tcl,v diff -u -N -r1.15.2.23 -r1.15.2.24 --- openacs-4/packages/xowiki/tcl/test/test-procs.tcl 18 Jan 2022 11:29:11 -0000 1.15.2.23 +++ openacs-4/packages/xowiki/tcl/test/test-procs.tcl 18 Jan 2022 12:51:45 -0000 1.15.2.24 @@ -376,6 +376,7 @@ {-remove ""} {-extra_url_parameter {{m edit}}} {-next_page_must_contain ""} + {-refetch:boolean false} } { Edit a form page via the web interface. @@ -428,22 +429,25 @@ -remove $remove] acs::test::reply_has_status_code $d 302 - foreach {key value} $update { - dict set form_content $key $value - } - aa_log "form_content:\n[::xowiki::test::pretty_form_content $form_content]" + set location /[::acs::test::get_url_from_location $d] - 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 + 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 + return $d } ad_proc ::xowiki::test::create_form {