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

(-)a/t/lib/Page/Members/LeftNavigation.pm (+15 lines)
Lines 113-116 sub navigateToDetails { Link Here
113
    return t::lib::Page::Members::Moremember->rebrandFromPageObject($self);
113
    return t::lib::Page::Members::Moremember->rebrandFromPageObject($self);
114
}
114
}
115
115
116
sub navigateToNotices {
117
    my ($self) = @_;
118
    my $d = $self->getDriver();
119
    $self->debugTakeSessionSnapshot();
120
121
    my $elements = $self->_getLeftNavigationActionElements();
122
    $elements->{notices}->click();
123
    $self->debugTakeSessionSnapshot();
124
125
    ok($d->get_title() =~ m/Sent notices/i,
126
       "Intra Navigate to Notices");
127
128
    return t::lib::Page::Members::Notices->rebrandFromPageObject($self);
129
}
130
116
1; #Make the compiler happy!
131
1; #Make the compiler happy!
(-)a/t/lib/Page/Members/Notices.pm (-1 / +132 lines)
Line 0 Link Here
0
- 
1
package t::lib::Page::Members::Notices;
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
use base qw(t::lib::Page::Intra t::lib::Page::Members::Toolbar t::lib::Page::Members::LeftNavigation);
25
26
use Koha::Exception::BadParameter;
27
28
use t::lib::Page::Circulation::Circulation;
29
30
31
sub new {
32
    my ($class, $params) = @_;
33
    unless (ref($params) eq 'HASH' || (blessed($params) && $params->isa('t::lib::Page') )) {
34
        $params = {};
35
    }
36
    $params->{resource} = '/cgi-bin/koha/members/notices.pl';
37
    $params->{type}     = 'staff';
38
39
    $params->{getParams} = [];
40
    #Handle MANDATORY parameters
41
    if ($params->{borrowernumber}) {
42
        push @{$params->{getParams}}, "borrowernumber=".$params->{borrowernumber};
43
    }
44
    else {
45
        Koha::Exception::BadParameter->throw(error => __PACKAGE__."->new():> Parameter 'borrowernumber' is missing.");
46
    }
47
    my $self = $class->SUPER::new($params);
48
49
    return $self;
50
}
51
52
################################################################################
53
=head UI Mapping helper subroutines
54
See. Selenium documentation best practices for UI element mapping to common language descriptions.
55
=cut
56
################################################################################
57
58
sub _getNoticesTable {
59
    my ($self) = @_;
60
    my $d = $self->getDriver();
61
62
    my $e = {};
63
64
    eval {
65
        $e->{noticestable_headers} = $d->find_elements("#noticestable th", 'css');
66
    };
67
    eval {
68
        $e->{noticestable_cells} = $d->find_elements("#noticestable td", 'css');
69
    };
70
71
    return $e;
72
}
73
74
################################################################################
75
=head PageObject Services
76
77
=cut
78
################################################################################
79
80
sub hasDeliveryNoteColumnInNoticesTable {
81
    my ($self) = @_;
82
    my $d = $self->getDriver();
83
    $self->debugTakeSessionSnapshot();
84
85
    my $elements = $self->_getNoticesTable();
86
87
    my $headers = $elements->{noticestable_headers};
88
89
    my $hasDeliveryNote = 0;
90
91
    foreach my $header(@$headers){
92
        $hasDeliveryNote = 1 if ($header->get_text() =~ /^Delivery note$/);
93
    }
94
95
    ok($hasDeliveryNote, "Intra Notices Table has all headings");
96
97
    return $self;
98
}
99
100
sub hasTextInTableCell {
101
    my ($self, $txt) = @_;
102
    my $d = $self->getDriver();
103
    $self->debugTakeSessionSnapshot();
104
105
    my $elements = $self->_getNoticesTable();
106
107
    my $cells = $elements->{noticestable_cells};
108
109
    my $hasText = 0;
110
111
    foreach my $cell(@$cells){
112
        $hasText = 1 if ($cell->get_text() =~ /^$txt$/);
113
    }
114
115
    ok($hasText, "Intra Notices Found text '$txt' from table");
116
117
    return $self;
118
}
119
120
sub verifyNoMessages {
121
    my ($self, $note) = @_;
122
    my $d = $self->getDriver();
123
    $self->debugTakeSessionSnapshot();
124
125
    my $dialog = $d->find_element("div.yui-b div.dialog", 'css')->get_text();
126
127
    ok($dialog =~ /^There is no record of any(.*)$/, "Intra Notices No messages sent");
128
129
    return $self;
130
}
131
132
1;

Return to bug 14536