Bugzilla – Attachment 41524 Details for
Bug 14536
PageObject-pattern base implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14536: (follow-up) Add OpacMessaging, Circulation and LeftNavigation for Members/Circulation pages in Staff Client
Bug-14536---follow-up-Add-OpacMessaging-Circulatio.patch (text/plain), 10.85 KB, created by
Lari Taskula
on 2015-08-17 07:35:15 UTC
(
hide
)
Description:
Bug 14536: (follow-up) Add OpacMessaging, Circulation and LeftNavigation for Members/Circulation pages in Staff Client
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2015-08-17 07:35:15 UTC
Size:
10.85 KB
patch
obsolete
>From 8bf350ebf1121e3192ccad1ce811ef11fb13a961 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Mon, 17 Aug 2015 10:30:20 +0300 >Subject: [PATCH] Bug 14536 - (follow-up) Add OpacMessaging, Circulation and > LeftNavigation for Members/Circulation pages in Staff Client > >--- > t/lib/Page/Circulation/Circulation.pm | 76 ++++++++++++++++++++++ > t/lib/Page/Members/LeftNavigation.pm | 116 ++++++++++++++++++++++++++++++++++ > t/lib/Page/Opac/OpacMessaging.pm | 101 +++++++++++++++++++++++++++++ > 3 files changed, 293 insertions(+) > create mode 100644 t/lib/Page/Circulation/Circulation.pm > create mode 100644 t/lib/Page/Members/LeftNavigation.pm > create mode 100644 t/lib/Page/Opac/OpacMessaging.pm > >diff --git a/t/lib/Page/Circulation/Circulation.pm b/t/lib/Page/Circulation/Circulation.pm >new file mode 100644 >index 0000000..a651a66 >--- /dev/null >+++ b/t/lib/Page/Circulation/Circulation.pm >@@ -0,0 +1,76 @@ >+package t::lib::Page::Circulation::Circulation; >+ >+# Copyright 2015 Open Source Freedom Fighters >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Scalar::Util qw(blessed); >+use Test::More; >+ >+use base qw(t::lib::Page::Intra t::lib::Page::Members::Toolbar t::lib::Page::Members::LeftNavigation); >+ >+use Koha::Exception::BadParameter; >+ >+=head NAME t::lib::Page::Circulation::Circulation >+ >+=head SYNOPSIS >+ >+circulation.pl PageObject providing page functionality as a service! >+ >+=cut >+ >+=head new >+ >+ my $circulation = t::lib::Page::Circulation::Circulation->new({borrowernumber => "1"}); >+ >+Instantiates a WebDriver and loads the circ/circulation.pl. >+@PARAM1 HASHRef of optional and MANDATORY parameters >+MANDATORY extra parameters: >+ borrowernumber => loads the page to display Borrower matching the given borrowernumber >+ >+@RETURNS t::lib::Page::Circulation::Circulation, ready for user actions! >+=cut >+ >+sub new { >+ my ($class, $params) = @_; >+ unless (ref($params) eq 'HASH' || (blessed($params) && $params->isa('t::lib::Page') )) { >+ $params = {}; >+ } >+ $params->{resource} = '/cgi-bin/koha/circ/circulation.pl'; >+ $params->{type} = 'staff'; >+ >+ $params->{getParams} = []; >+ #Handle MANDATORY parameters >+ if ($params->{borrowernumber}) { >+ push @{$params->{getParams}}, "borrowernumber=".$params->{borrowernumber}; >+ } >+ else { >+ Koha::Exception::BadParameter->throw(error => __PACKAGE__."->new():> Parameter 'borrowernumber' is missing."); >+ } >+ >+ my $self = $class->SUPER::new($params); >+ >+ return $self; >+} >+ >+################################################################################ >+=head UI Mapping helper subroutines >+See. Selenium documentation best practices for UI element mapping to common language descriptions. >+=cut >+################################################################################ >+ >+1; >\ No newline at end of file >diff --git a/t/lib/Page/Members/LeftNavigation.pm b/t/lib/Page/Members/LeftNavigation.pm >new file mode 100644 >index 0000000..d9f2405 >--- /dev/null >+++ b/t/lib/Page/Members/LeftNavigation.pm >@@ -0,0 +1,116 @@ >+package t::lib::Page::Members::LeftNavigation; >+ >+# Copyright 2015 Open Source Freedom Fighters >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Scalar::Util qw(blessed); >+use Test::More; >+ >+=head NAME t::lib::Page::Members::LeftNavigation >+ >+=head SYNOPSIS >+ >+Provides the services of the members/circulation left navigation column/frame for the implementing PageObject >+ >+=cut >+ >+################################################################################ >+=head UI Mapping helper subroutines >+See. Selenium documentation best practices for UI element mapping to common language descriptions. >+=cut >+################################################################################ >+ >+=head _getLeftNavigationActionElements >+@RETURNS HASHRef of Selenium::Driver::Webelements matching all the clickable elements >+ in the left navigation frame/column at members and circulation pages. >+=cut >+ >+sub _getLeftNavigationActionElements { >+ my ($self) = @_; >+ my $d = $self->getDriver(); >+ >+ my $e = {}; >+ eval { >+ $e->{checkOut} = $d->find_element("div#menu a[href*='circ/circulation.pl']", 'css'); >+ }; >+ eval { >+ $e->{details} = $d->find_element("div#menu a[href*='members/moremember.pl']", 'css'); >+ }; >+ eval { >+ $e->{fines} = $d->find_element("div#menu a[href*='members/pay.pl']", 'css'); >+ }; >+ eval { >+ $e->{routingLists} = $d->find_element("div#menu a[href*='members/routing-lists.pl']", 'css'); >+ }; >+ eval { >+ $e->{circulationHistory} = $d->find_element("div#menu a[href*='members/readingrec.pl']", 'css'); >+ }; >+ eval { >+ $e->{modificationLog} = $d->find_element("div#menu a[href*='tools/viewlog.pl']", 'css'); >+ }; >+ eval { >+ $e->{notices} = $d->find_element("div#menu a[href*='members/notices.pl']", 'css'); >+ }; >+ eval { >+ $e->{statistics} = $d->find_element("div#menu a[href*='members/statistics.pl']", 'css'); >+ }; >+ eval { >+ $e->{purchaseSuggestions} = $d->find_element("div#menu a[href*='members/purchase-suggestions.pl']", 'css'); >+ }; >+ return $e; >+} >+ >+ >+ >+################################################################################ >+=head PageObject Services >+ >+=cut >+################################################################################ >+ >+sub navigateCheckout { >+ my ($self) = @_; >+ my $d = $self->getDriver(); >+ $self->debugTakeSessionSnapshot(); >+ >+ my $elements = $self->_getLeftNavigationActionElements(); >+ $elements->{checkOut}->click(); >+ $self->debugTakeSessionSnapshot(); >+ >+ ok($d->get_title() =~ m/Checking out to/i, >+ "Intra Navigate to Check out"); >+ >+ return t::lib::Page::Circulation::Circulation->rebrandFromPageObject($self); >+} >+ >+sub navigateToDetails { >+ my ($self) = @_; >+ my $d = $self->getDriver(); >+ $self->debugTakeSessionSnapshot(); >+ >+ my $elements = $self->_getLeftNavigationActionElements(); >+ $elements->{details}->click(); >+ $self->debugTakeSessionSnapshot(); >+ >+ ok($d->get_title() =~ m/Patron details for/i, >+ "Intra Navigate to Details"); >+ >+ return t::lib::Page::Members::Moremember->rebrandFromPageObject($self); >+} >+ >+1; #Make the compiler happy! >diff --git a/t/lib/Page/Opac/OpacMessaging.pm b/t/lib/Page/Opac/OpacMessaging.pm >new file mode 100644 >index 0000000..cd0ea1b >--- /dev/null >+++ b/t/lib/Page/Opac/OpacMessaging.pm >@@ -0,0 +1,101 @@ >+package t::lib::Page::Opac::OpacMessaging; >+ >+# Copyright 2015 Open Source Freedom Fighters >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public Lice strongnse >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Scalar::Util qw(blessed); >+use Test::More; >+ >+use t::lib::Page::Opac::OpacUser; >+ >+use base qw(t::lib::Page::Opac t::lib::Page::Opac::LeftNavigation); >+ >+use Koha::Exception::BadParameter; >+ >+=head NAME t::lib::Page::Opac::OpacMessaging >+ >+=head SYNOPSIS >+ >+PageObject providing page functionality as a service! >+ >+=cut >+ >+=head new >+ >+ my $opacmemberentry = t::lib::Page::Opac::OpacMessaging->new(); >+ >+Instantiates a WebDriver and loads the opac/opac-messaging.pl. >+@PARAM1 HASHRef of optional and MANDATORY parameters >+MANDATORY extra parameters: >+ none atm. >+ >+@RETURNS t::lib::Page::Opac::OpacMessaging, ready for user actions! >+=cut >+ >+sub new { >+ my ($class, $params) = @_; >+ unless (ref($params) eq 'HASH' || (blessed($params) && $params->isa('t::lib::Page') )) { >+ $params = {}; >+ } >+ $params->{resource} = '/cgi-bin/koha/opac-messaging.pl'; >+ $params->{type} = 'opac'; >+ >+ my $self = $class->SUPER::new($params); >+ >+ return $self; >+} >+ >+sub _getMessagingPreferenceCheckboxes { >+ my ($self) = @_; >+ my $d = $self->getDriver(); >+ >+ my @email_prefs = $d->find_elements('input[type="checkbox"][id^="email"]'); >+ my @phone_prefs = $d->find_elements('input[type="checkbox"][id^="phone"]'); >+ my @sms_prefs = $d->find_elements('input[type="checkbox"][id^="sms"]'); >+ >+ return { email => \@email_prefs, phone => \@phone_prefs, sms => \@sms_prefs }; >+} >+ >+################################################################################ >+=head UI Mapping helper subroutines >+See. Selenium documentation best practices for UI element mapping to common language descriptions. >+=cut >+################################################################################ >+ >+sub checkMessagingPreferencesSet { >+ my ($self, $valid, @prefs) = @_; >+ my $d = $self->getDriver(); >+ $self->debugTakeSessionSnapshot(); >+ >+ foreach my $type (@prefs){ >+ my @this_pref = $d->find_elements('input[type="checkbox"][id^="'.$type.'"]'); >+ >+ my $ok = 0; >+ >+ foreach my $checkbox (@this_pref){ >+ ok(0, "Opac Messaging $type checkbox ".$checkbox->get_attribute('id')." not checked") if !$checkbox->is_selected() and $valid; >+ ok(0, "Opac Messaging $type checkbox ".$checkbox->get_attribute('id')." checked (not supposed to be)") if $checkbox->is_selected() and !$valid; >+ $ok = 1; >+ } >+ ok($ok, "Opac Messaging $type checkboxes ok (all " . (($valid) ? 'checked':'unchecked') . ")"); >+ } >+ >+ return $self; >+} >+ >+1; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14536
:
41023
|
41052
|
41057
|
41121
|
41156
|
41254
|
41460
|
41524
|
41525
|
41534
|
41678
|
42060
|
42111
|
42118
|
42136
|
42160
|
42433
|
42435
|
42716
|
44410
|
47254
|
63245