1# Test simple continuation using the example in Jifty::Manual::Continuation
2
3use strict;
4use warnings;
5use Jifty::Test::Dist tests => 24, actual_server => 1;
6use Jifty::Test::WWW::Selenium;
7use utf8;
8
9my $server = Jifty::Test->make_server;
10my $sel    = Jifty::Test::WWW::Selenium->rc_ok($server);
11my $URL    = $server->started_ok;
12
13{
14    # /c/page1 -> /c/page2 -> /c/page1
15
16
17    $sel->open_ok("/c/page1");
18    $sel->wait_for_text_present_ok('first_number');
19
20    my $field = '//input[contains(@class, "text")]';
21    my $button = '//input[@type="submit"]';
22
23    $sel->wait_for_element_present_ok($field);
24    $sel->click_ok($field);
25    $sel->type_ok($field, "100");
26
27    $sel->do_command_ok("clickAndWait", $button);
28
29    my $loc = $sel->get_location;
30    like $loc, qr{/c/page2}, "URL looks like /c/page2";;
31
32    $sel->click_ok($field);
33    $sel->type_ok($field, "50");
34    $sel->do_command_ok("clickAndWait", $button);
35
36    $loc = $sel->get_location;
37    like $loc, qr{/c/page1}, "URL looks like /c/page1";
38
39}
40
41
42{
43    # /c/page_another_one -> /c/page2 -> /c/page_another_one
44
45    $sel->open_ok("/c/page_another_one");
46    $sel->wait_for_text_present_ok('first_number');
47
48    my $field = '//input[contains(@class, "text")]';
49    my $button = '//input[@type="submit"]';
50
51    $sel->wait_for_element_present_ok($field);
52    $sel->click_ok($field);
53    $sel->type_ok($field, "100");
54
55    $sel->do_command_ok("clickAndWait", $button);
56
57    my $loc = $sel->get_location;
58    like $loc, qr{/c/page2}, "URL looks like /c/page2";
59
60    $sel->click_ok($field);
61    $sel->type_ok($field, "50");
62    $sel->do_command_ok("clickAndWait", $button);
63
64    $loc = $sel->get_location;
65    like $loc, qr{/c/page_another_one}, "URL looks like /c/page_another_one";
66}
67
68
69
70$sel->stop;
71