File: 05-forms.t

package info (click to toggle)
libtest-www-declare-perl 0.02-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 228 kB
  • sloc: perl: 1,652; makefile: 9
file content (46 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!perl
use Test::WWW::Declare::Tester tests => 7;
use warnings;
use strict;

my @results = run_tests(
    sub {
        session "check logins" => run {
            flow "search1" => check {
                get "http://localhost:$PORT/formy";

                fill form 'one' => {
                    clever => 'Modestly',
                };

                click button 'sub-mits';

                content should match qr{MODESTLY};
            };

            flow "search2" => check {
                get "http://localhost:$PORT/formy";

                fill form 'two' => {
                    clever => 'Verily',
                };

                click button 'sub-mits 2';

                content should match qr{verily};
            };
        };
    }
);

shift @results; # Test::Tester gives 1-based arrays
is(@results, 2, "two tests");
ok($results[0]{ok}, "1st test passed");
ok($results[1]{ok}, "2nd test passed");

is($results[0]{name}, "search1", "1st test was flow");
is($results[1]{name}, "search2", "2nd test was flow");

is($results[0]{diag}, '', 'no errors/warnings');
is($results[1]{diag}, '', 'no errors/warnings');