5428206e3d5c743ac54f75ecd9828e457a6b5899
[bse.git] / t / t00smoke.t
1 #!perl -w
2 use strict;
3 use BSE::Test qw(make_ua ok fetch_ok base_url config);
4
5 ++$|;
6 print "1..62\n";
7 my $baseurl = base_url;
8 ok($baseurl =~ /^http:/, "basic check of base url");
9 my $ua = make_ua;
10 fetch_ok($ua, "admin menu - check the site exists at all", "$baseurl/admin/", "Admin");
11 fetch_ok($ua, "generate all", "$baseurl/cgi-bin/admin/generate.pl",
12         "html", "Title: BSE - Administration Centre");
13 fetch_ok($ua, "generate all verbose", 
14          "$baseurl/cgi-bin/admin/generate.pl?progress=1",
15          "Regenerating.*Return to admin menu");
16 fetch_ok($ua, "index", "$baseurl/", "Home");
17 fetch_ok($ua, "shop", "$baseurl/shop/", "The Shop");
18 fetch_ok($ua, "shop cart", "$baseurl/cgi-bin/shop.pl",
19          "Shopping Cart Items");
20 fetch_ok($ua, "shop cart checkout no items", "$baseurl/cgi-bin/shop.pl",
21          "Shopping Cart Items");
22 fetch_ok($ua, "build search index", "$baseurl/cgi-bin/admin/makeIndex.pl",
23          "html", "Title: BSE - Administration Centre");
24 fetch_ok($ua, "advanced search form", "$baseurl/cgi-bin/search.pl",
25          "All\\s+lower\\s+case");
26 fetch_ok($ua, "failed search", "$baseurl/cgi-bin/search.pl?q=blargle",
27          "No\\s+documents\\s+were\\s+found");
28 fetch_ok($ua, "good search", "$baseurl/cgi-bin/search.pl?q=shop",
29          qr!You\s+can\s+buy!s);
30 if (config('site users.nopassword')) {
31   fetch_ok($ua, "not user logon page", "$baseurl/cgi-bin/user.pl",
32            qr!Not\s+Authenticated!s);
33 }
34 else {
35   fetch_ok($ua, "user logon page", "$baseurl/cgi-bin/user.pl",
36            qr!User\s+Logon!s);
37 }
38 fetch_ok($ua, "shop admin page", "$baseurl/cgi-bin/admin/shopadmin.pl",
39          qr!Shop\s+Administration!s);
40 fetch_ok($ua, "add article form", "$baseurl/cgi-bin/admin/add.pl",
41          qr!New\s+Page\sLev3!s);
42 fetch_ok($ua, "add catalog form", "$baseurl/cgi-bin/admin/add.pl?type=Catalog",
43          qr!Add\s+Catalog!s);
44 fetch_ok($ua, "add product form", "$baseurl/cgi-bin/admin/add.pl?type=Product",
45          qr!Add\s+product!s);
46 fetch_ok($ua, "edit article form", "$baseurl/cgi-bin/admin/add.pl?id=1",
47          qr!Edit\s+Page\s+Lev1!s);
48 fetch_ok($ua, "edit catalog form", "$baseurl/cgi-bin/admin/add.pl?id=4",
49          qr!Catalog\sDetails!s);
50 fetch_ok($ua, "user list", "$baseurl/cgi-bin/admin/adminusers.pl",
51          qr!Admin\sUsers!s);
52 fetch_ok($ua, "group list", "$baseurl/cgi-bin/admin/adminusers.pl?a_groups=1",
53          qr!Admin\sGroups!s);
54 fetch_ok($ua, "subscriptions", "$baseurl/cgi-bin/admin/subs.pl",
55          qr/Newsletter\s+List/);
56 fetch_ok($ua, "reports", "$baseurl/cgi-bin/admin/report.pl",
57          qr/Reports/);
58 # does a refresh unless the user is logged on
59 fetch_ok($ua, "changepw", "$baseurl/cgi-bin/admin/changepw.pl",
60          qr!Change Password|Security not enabled!i);
61 fetch_ok($ua, "printable", "$baseurl/cgi-bin/printable.pl?id=5",
62          qr!sidebar\s+subsection!i);
63 fetch_ok($ua, "printable error", "$baseurl/cgi-bin/printable.pl?id=5&template=foo",
64          qr!Invalid\s+template\s+name!i);
65 fetch_ok($ua, "siteusers", "$baseurl/cgi-bin/admin/siteusers.pl",
66          qr!Admin Site Members!i);
67
68 fetch_ok($ua, "reorder", "$baseurl/cgi-bin/admin/reorder.pl",
69         "html", "Title: BSE - Administration Centre");
70
71 fetch_ok($ua, 'fmail', "$baseurl/cgi-bin/fmail.pl",
72          qr!name="form"!);
73 fetch_ok($ua, 'page.pl?page=1', "$baseurl/cgi-bin/page.pl?page=1",
74          qr!welcome\s+to\s!i);