File: fancy-sessions.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 (68 lines) | stat: -rwxr-xr-x 1,857 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!perl
use BTDT::Test::WWW::Declare tests => 9;
use strict;
use warnings;

session "gooduser" => run {
    flow "create task" => check {
        login as 'gooduser';
        fill form 'tasklist-new_item_create' => {
            summary => "bouncy task",
        };
        click button 'Create';
        content should contain "bouncy task";
    };

    flow "assign task to otheruser" => check {
        click href qr{bouncy task};
        fill form mech->moniker_for("BTDT::Action::UpdateTask", id => 3) => {
            owner_id => 'otheruser@example.com',
        };
        click button 'Save';

        content should contain 'something or other';
    };

    session "otheruser" => run {
        flow "accept gooduser's task" => check {
            login as 'otheruser';
            click href qr{unaccepted task(s)?};
            content should contain 'bouncy task';
            click href qr{bouncy task};

            fill form mech->moniker_for('BTDT::Action::AcceptTask') => {
                accepted => 1,
            };
            click button 'Save';

            content should contain 'Task accepted';
        };
    };

    flow "comment on the task I gave" => check {
        click href qr{bouncy task};
        content should contain 'bouncy task';

        fill form mech->moniker_for('BTDT::Action::UpdateTask', id => 3) => {
            comment => "first comment",
        };

        click button 'Save';

        session "otheruser" => run {
            flow "check that we got the comment" => check {
                reload;
                content should contain 'first comment';
            };
        };
    };

    flow "add another comment" => check {
        fill form mech->moniker_for('BTDT::Action::UpdateTask', id => 3) => {
            comment => "second comment",
        };

        click button 'Save';
    };
};