Line 0
Link Here
|
|
|
1 |
package t::lib::Page::Members::LeftNavigation; |
2 |
|
3 |
# Copyright 2015 Open Source Freedom Fighters |
4 |
# |
5 |
# This file is part of Koha. |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it |
8 |
# under the terms of the GNU General Public License as published by |
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
# GNU General Public License for more details. |
16 |
# |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
20 |
use Modern::Perl; |
21 |
use Scalar::Util qw(blessed); |
22 |
use Test::More; |
23 |
|
24 |
=head NAME t::lib::Page::Members::LeftNavigation |
25 |
|
26 |
=head SYNOPSIS |
27 |
|
28 |
Provides the services of the members/circulation left navigation column/frame for the implementing PageObject |
29 |
|
30 |
=cut |
31 |
|
32 |
################################################################################ |
33 |
=head UI Mapping helper subroutines |
34 |
See. Selenium documentation best practices for UI element mapping to common language descriptions. |
35 |
=cut |
36 |
################################################################################ |
37 |
|
38 |
=head _getLeftNavigationActionElements |
39 |
@RETURNS HASHRef of Selenium::Driver::Webelements matching all the clickable elements |
40 |
in the left navigation frame/column at members and circulation pages. |
41 |
=cut |
42 |
|
43 |
sub _getLeftNavigationActionElements { |
44 |
my ($self) = @_; |
45 |
my $d = $self->getDriver(); |
46 |
|
47 |
my $e = {}; |
48 |
eval { |
49 |
$e->{checkOut} = $d->find_element("div#menu a[href*='circ/circulation.pl']", 'css'); |
50 |
}; |
51 |
eval { |
52 |
$e->{details} = $d->find_element("div#menu a[href*='members/moremember.pl']", 'css'); |
53 |
}; |
54 |
eval { |
55 |
$e->{fines} = $d->find_element("div#menu a[href*='members/pay.pl']", 'css'); |
56 |
}; |
57 |
eval { |
58 |
$e->{routingLists} = $d->find_element("div#menu a[href*='members/routing-lists.pl']", 'css'); |
59 |
}; |
60 |
eval { |
61 |
$e->{circulationHistory} = $d->find_element("div#menu a[href*='members/readingrec.pl']", 'css'); |
62 |
}; |
63 |
eval { |
64 |
$e->{modificationLog} = $d->find_element("div#menu a[href*='tools/viewlog.pl']", 'css'); |
65 |
}; |
66 |
eval { |
67 |
$e->{notices} = $d->find_element("div#menu a[href*='members/notices.pl']", 'css'); |
68 |
}; |
69 |
eval { |
70 |
$e->{statistics} = $d->find_element("div#menu a[href*='members/statistics.pl']", 'css'); |
71 |
}; |
72 |
eval { |
73 |
$e->{purchaseSuggestions} = $d->find_element("div#menu a[href*='members/purchase-suggestions.pl']", 'css'); |
74 |
}; |
75 |
return $e; |
76 |
} |
77 |
|
78 |
|
79 |
|
80 |
################################################################################ |
81 |
=head PageObject Services |
82 |
|
83 |
=cut |
84 |
################################################################################ |
85 |
|
86 |
sub navigateCheckout { |
87 |
my ($self) = @_; |
88 |
my $d = $self->getDriver(); |
89 |
$self->debugTakeSessionSnapshot(); |
90 |
|
91 |
my $elements = $self->_getLeftNavigationActionElements(); |
92 |
$elements->{checkOut}->click(); |
93 |
$self->debugTakeSessionSnapshot(); |
94 |
|
95 |
ok($d->get_title() =~ m/Checking out to/i, |
96 |
"Intra Navigate to Check out"); |
97 |
|
98 |
return t::lib::Page::Circulation::Circulation->rebrandFromPageObject($self); |
99 |
} |
100 |
|
101 |
sub navigateToDetails { |
102 |
my ($self) = @_; |
103 |
my $d = $self->getDriver(); |
104 |
$self->debugTakeSessionSnapshot(); |
105 |
|
106 |
my $elements = $self->_getLeftNavigationActionElements(); |
107 |
$elements->{details}->click(); |
108 |
$self->debugTakeSessionSnapshot(); |
109 |
|
110 |
ok($d->get_title() =~ m/Patron details for/i, |
111 |
"Intra Navigate to Details"); |
112 |
|
113 |
return t::lib::Page::Members::Moremember->rebrandFromPageObject($self); |
114 |
} |
115 |
|
116 |
1; #Make the compiler happy! |