if { [catch { # Source Tcl libraries set script_dir [file dirname [info script]] source "${script_dir}/../../../etc/install/tcl/test-procs.tcl" source "${script_dir}/simulation-test-procs.tcl" # Test Execution START # Demo data start set actors_list { Teacher Student Agent1 Agent2 } array set characters { Bernadette "Bernadette" MOTORHOME "MOTORHOME" "A of Lawfirm X" "Her lawyer" "A of Lawfirm Y" "Its lawyer" "B of Lawfirm X" "Partner firm X" "B of Lawfirm Y" "Partner firm Y" "C of Lawfirm X" "Secretary firm X" "C of Lawfirm Y" "Secretary firm Y" "Portal" "Library" "Lok of Legisl. Dept." "Member 1 of Legisl. Dept." "Peter of Legisl. Dept." "Member 2 of Legisl. Dept." "Aernout of Legisl. Dept." "Head of Legisl. Dept." "Jeroen of Legisl. Dept." "Deputy Head of Legisl. Dept." "Laurens of Legisl. Dept." "Chief of Legisl. Dept." "Fred Undraiser" "Fundraiser" "A of ADC" "Representative of ADC" "Minister" "Minister of Justice" "General Student" "Student" } array set characters_ld { "Lok of Legisl. Dept." "Member 1 of Legisl. Dept." "Peter of Legisl. Dept." "Member 2 of Legisl. Dept." "Aernout of Legisl. Dept." "Head of Legisl. Dept." "Jeroen of Legisl. Dept." "Deputy Head of Legisl. Dept." "Laurens of Legisl. Dept." "Chief of Legisl. Dept." "Fred Undraiser" "Fundraiser" "A of ADC" "Representative of ADC" "Minister" "Minister of Justice" "General Student" "Student" } array set properties { "Demo Property 1" "Demo Property 1" "Demo Property 2" "Demo Property 2" } array set tasks { "Ask information from Bernadette" {assigned_role "Her lawyer" recipient_role "Bernadette"} "Ask information from MOTORHOME" {assigned_role "Her lawyer" recipient_role "MOTORHOME"} "Ask information from opponent's lawyer 1" {assigned_role "Its lawyer" recipient_role "Her lawyer"} "Ask information from opponent's lawyer 2" {assigned_role "Her lawyer" recipient_role "Its lawyer"} "Ask information from library" {assigned_role "Her lawyer" recipient_role "Library"} "Ask information from partner" {assigned_role "Her lawyer" recipient_role "Partner firm X"} "Intervene" {assigned_role "Partner firm X" recipient_role "Her lawyer"} "Reply to intervention" {assigned_role "Her lawyer" recipient_role "Partner firm X"} "Give information as Bernadette" {assigned_role "Bernadette" recipient_role "Her lawyer"} "Give information as Motorhome" {assigned_role "MOTORHOME" recipient_role "Her lawyer"} "Make/edit draft report" {assigned_role "Her lawyer" recipient_role "Her lawyer"} "Edit draft report" {assigned_role "Her lawyer" recipient_role "Her lawyer"} "Give information to opponent's lawyer" {assigned_role "Her lawyer" recipient_role "Its lawyer"} "Send final report" {assigned_role "Her lawyer" recipient_role "Partner firm X"} "Send draft report" {assigned_role "Her lawyer" recipient_role "Partner firm X"} } array set tasks_ld { "Write Proposal gr1" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Head of Legisl. Dept."} "Write Proposal gr2" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Deputy Head of Legisl. Dept."} "Write Opinion SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Fundraiser" recipient_role "Minister of Justice"} "Write Opinion SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Representative of ADC" recipient_role "Minister of Justice"} "Comment on Member2 Proposal SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Head of Legisl. Dept." recipient_role "Minister of Justice"} "Comment on Member1 Proposal SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Deputy Head of Legisl. Dept." recipient_role "Minister of Justice"} "Revise using Opinions and Comment from Head SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} "Revise using Opinions and Comment from Deputy SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} "Rate Comments SHOULD BE A REVIEWINFO" {assigned_role "Student" recipient_role "Minister of Justice"} "Rate Revisions SHOULD BE A REVIEWINFO" {assigned_role "Student" recipient_role "Minister of Justice"} "Learning evaluation DUMMY or ADDINFOTOPORTFOLIO" {assigned_role "Student" recipient_role "Minister of Justice"} "Write Definition based on Revision SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} "Elaborate the Revision SHOULD BE AN ADDINFOTOPORTFOLIO" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} "Comment Revision of Member 1" {assigned_role "Head of Legisl. Dept." recipient_role "Minister of Justice"} "Comment Revision of Member 2" {assigned_role "Deputy Head of Legisl. Dept." recipient_role "Minister of Justice"} "Learning Evalution SHOULD BE A ADDINFOTOPORTFOLIO" {assigned_role "Student" recipient_role "Minister of Justice"} "Implementation of all received comments and opinions SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} "Implementation of all received comments and opinions SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Member 2 of Legisl. Dept." recipient_role "Minister of Justice"} "Write law SHOULD BE AN ADDINFOTOPORTFOLIO gr1" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} "Write law SHOULD BE AN ADDINFOTOPORTFOLIO gr2" {assigned_role "Member 1 of Legisl. Dept." recipient_role "Minister of Justice"} } # Demo data end ::twt::log_section "Login the site wide admin" ::twt::user::login_site_wide_admin ################################### # # Users and Groups setup # ################################### ::twt::log_section "Add demo users to system" for {set i 1} {$i <= 20} {incr i} { ::twt::simulation::add_user -first_names Demo -last_name "User $i" } ::twt::log_section "Add demo groups" for {set i 1} {$i <= 5} {incr i} { do_request "/admin/group-types/one?group_type=group" link follow ~u "parties/new" field find ~n group.group_name field fill "Demo group $i" form submit } ::twt::log_section "Add demo users to groups" for {set i 1} {$i <= 5} {incr i} { set add_user_url [::twt::simulation::add_user_to_group_url -group_name "Demo group $i"] for {set user_count [expr ($i - 1)*4 + 1]} {$user_count <= [expr $i*4]} {incr user_count} { ::twt::simulation::add_user_to_group -add_user_url $add_user_url -user_name "Demo User $user_count" } } ::twt::log_section "Create a demo user in each permission group" foreach group_name { "Sim Admins" "Template Authors" "Case Authors" "Service Admins" "City Admins" "Actors" } { set first_names $group_name set last_name "Test User" ::twt::simulation::add_user -first_names $first_names -last_name $last_name ::twt::simulation::add_user_to_group -group_name $group_name -user_name "$first_names $last_name" } ################################### # # Citybuild object setup # ################################### ::twt::log_section "Create an image object" do_request /simulation/citybuild link follow ~u object-edit form find ~n object field find ~n content_type field select2 ~v image field find ~n __refreshing_p field fill 1 form submit field find ~n title field fill "New Jersey Lawyers" field find ~n description field fill "New Jersey Lawyers and Consumers" field find ~n content_file field fill [::twt::config::serverroot]/packages/simulation/test/new-jersey-lawyer-logo.gif form submit ::twt::log_section "Create characters for Elementary private law" foreach character_name [array names characters] { ::twt::simulation::add_object -type character -title $character_name } ::twt::log_section "Create characters for Legislative Drafting" foreach character_name [array names characters_ld] { ::twt::simulation::add_object -type character -title $character_name } ::twt::log_section "Create properties" foreach property_name [array names properties] { ::twt::simulation::add_object -type sim_prop -title $property_name } ################################### # # Elementary private law template # ################################### set template_name "Elementary Private Law" ::twt::log_section "Create $template_name simulation template" ::twt::simulation::add_template -template_name $template_name ::twt::log_section "Create roles for template" ::twt::simulation::add_roles_to_template \ -template_name $template_name \ -character_array characters ::twt::log_section "Add tasks to template" ::twt::simulation::add_tasks_to_template \ -template_name $template_name \ -task_array tasks ################################### # # Legislative Drafting template # ################################### set template_name "Legislative Drafting" ::twt::log_section "Create $template_name simulation template" ::twt::simulation::add_template -template_name $template_name ::twt::log_section "Create roles for template" ::twt::simulation::add_roles_to_template \ -template_name $template_name \ -character_array characters_ld ::twt::log_section "Add tasks to template" ::twt::simulation::add_tasks_to_template \ -template_name $template_name \ -task_array tasks_ld ################################### # # Tilburg template created from spec # ################################### ::twt::log_section "Create a template from a spec" do_request /simulation/simbuild/template-load field fill "Template loaded from spec" ~n pretty_name field fill [::twt::simulation::get_template_spec] ~n spec form submit # TODO: Check permissions with different users # TODO: click the ready_p link for the templates } result] } { global errorInfo # Output error stack trace and HTML response body ::twt::log $result ::twt::log "*** Tcl TRACE ***" ::twt::log $errorInfo ::twt::log "The response body is: [response body]" error "Test failed: $result" }