View | Details | Raw Unified | Return to bug 21479
Collapse All | Expand All

(-)a/t/db_dependent/selenium/regressions.t (-3 / +33 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use C4::Context;
20
use C4::Context;
21
21
22
use Test::More tests => 1;
22
use Test::More tests => 2;
23
23
24
use Koha::AuthUtils;
24
use Koha::AuthUtils;
25
use t::lib::Selenium;
25
use t::lib::Selenium;
Lines 31-37 skip "Selenium::Remote::Driver is needed for selenium tests.", 1 if $@; Link Here
31
my $s = t::lib::Selenium->new;
31
my $s = t::lib::Selenium->new;
32
32
33
my $driver = $s->driver;
33
my $driver = $s->driver;
34
my $base_url = $s->base_url;
34
my $opac_base_url = $s->opac_base_url;
35
my $builder = t::lib::TestBuilder->new;
35
my $builder = t::lib::TestBuilder->new;
36
36
37
our @cleanup;
37
our @cleanup;
Lines 55-60 subtest 'OPAC - borrowernumber and branchcode as html attributes' => sub { Link Here
55
    push @cleanup, $patron->library;
55
    push @cleanup, $patron->library;
56
};
56
};
57
57
58
subtest 'OPAC - Remove from cart' => sub {
59
    plan tests => 4;
60
61
    $driver->get( $opac_base_url . "opac-search.pl?q=d" );
62
63
    my $basket_count_elt;
64
    eval {
65
        # FIXME This will produce a STRACE
66
        # A better way to do that would be to modify the way we display the basket count
67
        # We should show/hide the count instead or recreate the node
68
        $basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span')
69
    };
70
    like($@, qr{An element could not be located on the page}, 'Basket should be empty');
71
72
    $driver->find_element('//a[@class="addtocart cart1"]')->click;
73
    $basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
74
    is( $basket_count_elt->get_text(),
75
        1, 'One element should have been added to the cart' );
76
77
    $driver->find_element('//a[@class="addtocart cart3"]')->click;
78
    $driver->find_element('//a[@class="addtocart cart5"]')->click;
79
    $basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
80
    is( $basket_count_elt->get_text(),
81
        3, '3 elements should have been added to the cart' );
82
83
    $driver->find_element('//a[@class="cartRemove cartR3"]')->click;
84
    $basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
85
    is( $basket_count_elt->get_text(),
86
        2, '1 element should have been removed from the cart' );
87
};
88
58
END {
89
END {
59
    $_->delete for @cleanup;
90
    $_->delete for @cleanup;
60
};
91
};
61
- 

Return to bug 21479