3 use Test::More tests => 22;
4 use BSE::Test qw(base_url make_ua check_form post_ok
5 check_content follow_ok);
9 my $baseurl = base_url;
12 ok($ua->get("$baseurl/cgi-bin/admin/add.pl?parentid=-1"), "edit page");
13 check_content($ua->{content}, 'edit page',
14 qr!No\s+parent\s+-\s+this\s+is\s+a\s+section
18 Add\s+New\s+Page\s+Lev1
20 check_form($ua->{content},
22 parentid=>[ -1, 'select' ],
23 id => [ '', 'hidden' ],
24 template=> [ 'common/default.tmpl', 'select' ],
25 body => [ '', 'textarea' ],
26 listed => [ 1, 'select' ],
28 $ua->field(title=>'Test Article');
29 $ua->field(body=>'This is a test body');
30 ok($ua->click('save'), 'submit modified edit form');
31 # should redirect to admin mode page
32 check_content($ua->{content}, "admin mode",
34 <title>.*Test\ Article.*</title>
36 This\ is\ a\ test\ body
39 my $id = $uri->query_param("id");
41 ok($ua->get("$baseurl/cgi-bin/admin/add.pl?id=-1"), "sections page");
42 follow_ok($ua, "clean up",
45 url_regex => qr/id=$id/
46 }, qr/Article deleted/);