~testplan-team/testplan/source-collection

« back to all changes in this revision

Viewing changes to selenium-remote-control-1.0.1-dist/selenium-remote-control-1.0.1/selenium-perl-client-driver-1.0.1/t/selenium-dwim.t

  • Committer: edA-qa mort-ora-y
  • Date: 2009-07-02 09:23:56 UTC
  • Revision ID: eda-qa@disemia.com-20090702092356-w9rxifuvlva3bk31
upgradingĀ selenium

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
use Test::More tests => 23;
 
5
use Test::Exception;
 
6
use Test::Mock::LWP;
 
7
 
 
8
# Tests for enhancements to help users find their problems faster
 
9
 
 
10
BEGIN {
 
11
    use lib 'lib';
 
12
    use_ok 't::WWW::Selenium';  # subclass for testing
 
13
}
 
14
 
 
15
Forgot_to_open: {
 
16
    my $sel = t::WWW::Selenium->new;
 
17
    my $error_msg = q{You must open a page before calling getTitle. eg: $sel->open('/');};
 
18
    throws_ok { $sel->get_title } qr/\Q$error_msg\E/;
 
19
}
 
20
 
 
21
Open_default: {
 
22
    my $sel = t::WWW::Selenium->new;
 
23
    lives_ok { $sel->open };
 
24
    like $Mock_req->new_args->[4], qr/\Qcmd=open&1=%2F\E/, 'open specified /';
 
25
}
 
26
 
 
27
Double_start: {
 
28
    my $sel = t::WWW::Selenium->new; # calls start() automatically
 
29
    $sel->start;
 
30
    is $Mock_req->new_args, undef;
 
31
}
 
32
 
 
33
Auto_stop: {
 
34
    my $sel = t::WWW::Selenium->new;
 
35
    $sel->open('/');
 
36
    $sel->_set_mock_response_content('http://example.com');
 
37
    $sel->get_location;
 
38
    $sel = undef;
 
39
    like $Mock_req->new_args->[4], qr/cmd=testComplete/, 'auto-stop';
 
40
}
 
41
 
 
42
Auto_stop_off: {
 
43
    my $sel = t::WWW::Selenium->new(auto_stop => 0);
 
44
    $sel->open('/');
 
45
    $sel->_set_mock_response_content('http://example.com');
 
46
    $sel->get_location;
 
47
    $sel = undef;
 
48
    unlike $Mock_req->new_args->[4], qr/cmd=testComplete/, 'not auto-stop';
 
49
}
 
50
 
 
51
Do_command_open: {
 
52
    my $sel = t::WWW::Selenium->new;
 
53
    $sel->do_command(qw(open /));
 
54
    $sel->_set_mock_response_content('http://example.com');
 
55
    lives_ok { $sel->get_location };
 
56
}
 
57
 
 
58
Set_timeout_before_open: {
 
59
    my $sel = t::WWW::Selenium->new;
 
60
    lives_ok { $sel->set_timeout(3000) };
 
61
}