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

(-)a/t/lib/Page.pm (+39 lines)
Lines 150-155 sub pause { Link Here
150
    return $self;
150
    return $self;
151
}
151
}
152
152
153
=head poll
154
Polls anonymous subroutine $func at given rate $pauseMillis for given times $polls or
155
until $func succeeds without exceptions.
156
157
In case of an exception, optional anonymous subroutine $success is called to confirm
158
whether or not the action was successful. If this subroutine is not defined or it returns
159
false, polling continues.
160
161
Default pause for polling is 50ms and the polling runs by default for 20 times.
162
163
@PARAM1 $func                  Anonymous subroutine to be polled
164
@PARAM2 $success      OPTIONAL Success function to check if action was successful
165
@PARAM3 $polls        OPTIONAL Defines the times polling will be ran
166
@PARAM4 $pauseMillis  OPTIONAL Defines the wait between two polls
167
168
@RETURNS 1 if polling was success, otherwise die
169
=cut
170
171
sub poll {
172
    my ($self, $func, $success, $polls, $pauseMillis) = @_;
173
    
174
    # initialize default values if not given
175
    $polls = 20 unless defined $polls;
176
    $pauseMillis = 50 unless defined $pauseMillis;
177
    
178
    for (my $i = 0; $i < $polls; $i++){
179
        eval {
180
            &$func();
181
        };
182
        if ($@) {
183
            return 1 if defined $success and &$success();
184
            $self->getDriver()->pause($pauseMillis);
185
            next;
186
        }
187
        return 1 unless $@; # if no errors, return true
188
    }
189
    die $@;
190
}
191
153
=head mockConfirmPopup
192
=head mockConfirmPopup
154
193
155
Workaround to a missing feature in PhantomJS v1.9
194
Workaround to a missing feature in PhantomJS v1.9
(-)a/t/lib/Page/Members/Moremember.pm (-5 / +5 lines)
Lines 139-145 sub navigateToPatronInformationEdit { Link Here
139
139
140
    my $elements = $self->_getEditLinks();
140
    my $elements = $self->_getEditLinks();
141
    $elements->{patron_information}->click();
141
    $elements->{patron_information}->click();
142
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron information");
142
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron information");
143
143
144
    $self->debugTakeSessionSnapshot();
144
    $self->debugTakeSessionSnapshot();
145
145
Lines 153-159 sub navigateToSMSnumberEdit { Link Here
153
153
154
    my $elements = $self->_getEditLinks();
154
    my $elements = $self->_getEditLinks();
155
    $elements->{smsnumber}->click();
155
    $elements->{smsnumber}->click();
156
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron SMS number");
156
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron SMS number");
157
157
158
    $self->debugTakeSessionSnapshot();
158
    $self->debugTakeSessionSnapshot();
159
159
Lines 167-173 sub navigateToLibraryUseEdit { Link Here
167
167
168
    my $elements = $self->_getEditLinks();
168
    my $elements = $self->_getEditLinks();
169
    $elements->{library_use}->click();
169
    $elements->{library_use}->click();
170
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron Library use");
170
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron Library use");
171
171
172
    $self->debugTakeSessionSnapshot();
172
    $self->debugTakeSessionSnapshot();
173
173
Lines 181-187 sub navigateToAlternateAddressEdit { Link Here
181
181
182
    my $elements = $self->_getEditLinks();
182
    my $elements = $self->_getEditLinks();
183
    $elements->{alternate_address}->click();
183
    $elements->{alternate_address}->click();
184
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron Alternate address");
184
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron Alternate address");
185
185
186
    $self->debugTakeSessionSnapshot();
186
    $self->debugTakeSessionSnapshot();
187
187
Lines 195-201 sub navigateToAlternativeContactEdit { Link Here
195
195
196
    my $elements = $self->_getEditLinks();
196
    my $elements = $self->_getEditLinks();
197
    $elements->{alternative_contact}->click();
197
    $elements->{alternative_contact}->click();
198
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron Alternative contact");
198
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron Alternative contact");
199
199
200
    $self->debugTakeSessionSnapshot();
200
    $self->debugTakeSessionSnapshot();
201
201
(-)a/t/lib/Page/Members/Toolbar.pm (-4 / +11 lines)
Lines 132-140 sub navigateEditPatron { Link Here
132
    $self->debugTakeSessionSnapshot();
132
    $self->debugTakeSessionSnapshot();
133
133
134
    my $elements = $self->_getToolbarActionElements();
134
    my $elements = $self->_getToolbarActionElements();
135
    $elements->{edit}->click();
135
    
136
    ok($d->get_title() =~ m/Modify patron/, "Intra Navigate to Modify patron");
136
    my $func = sub {
137
137
        $elements->{edit}->click();
138
    };
139
    my $success = sub {
140
        return $self->getDriver()->get_title() =~ m/Modify(.*)patron/;
141
    };
142
    
143
    $self->poll($func, $success, 20, 50);
144
    
145
    ok($d->get_title() =~ m/Modify(.*)patron/, "Intra Navigate to Modify patron");
138
    $self->debugTakeSessionSnapshot();
146
    $self->debugTakeSessionSnapshot();
139
147
140
    return t::lib::Page::Members::Memberentry->rebrandFromPageObject($self);
148
    return t::lib::Page::Members::Memberentry->rebrandFromPageObject($self);
141
- 

Return to bug 14536