|
Lines 61-75
sub _getInputFieldsForValidation {
Link Here
|
| 61 |
my ($self) = @_; |
61 |
my ($self) = @_; |
| 62 |
my $d = $self->getDriver(); |
62 |
my $d = $self->getDriver(); |
| 63 |
|
63 |
|
| 64 |
my $emailInput = $d->find_element('#email'); |
64 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber); |
| 65 |
my $emailProInput = $d->find_element('#emailpro'); |
65 |
eval { |
| 66 |
my $email_BInput = $d->find_element('#B_email'); |
66 |
$emailInput = $d->find_element('#email'); |
|
|
67 |
}; |
| 68 |
eval { |
| 69 |
$emailProInput = $d->find_element('#emailpro'); |
| 70 |
}; |
| 71 |
eval { |
| 72 |
$email_BInput = $d->find_element('#B_email'); |
| 73 |
}; |
| 74 |
eval { |
| 75 |
$phoneInput = $d->find_element('#phone'); |
| 76 |
}; |
| 77 |
eval { |
| 78 |
$phoneProInput = $d->find_element('#phonepro'); |
| 79 |
}; |
| 80 |
eval { |
| 81 |
$phone_BInput = $d->find_element('#B_phone'); |
| 82 |
}; |
| 83 |
eval { |
| 84 |
$SMSnumber = $d->find_element('#SMSnumber'); |
| 85 |
}; |
| 67 |
|
86 |
|
| 68 |
my $phoneInput = $d->find_element('#phone'); |
87 |
return ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber); |
| 69 |
my $phoneProInput = $d->find_element('#phonepro'); |
88 |
} |
| 70 |
my $phone_BInput = $d->find_element('#B_phone'); |
89 |
|
|
|
90 |
sub _getMessagingPreferenceCheckboxes { |
| 91 |
my ($self) = @_; |
| 92 |
my $d = $self->getDriver(); |
| 93 |
|
| 94 |
my @email_prefs = $d->find_elements('input[type="checkbox"][id^="email"]'); |
| 95 |
my @phone_prefs = $d->find_elements('input[type="checkbox"][id^="phone"]'); |
| 96 |
my @sms_prefs = $d->find_elements('input[type="checkbox"][id^="sms"]'); |
| 71 |
|
97 |
|
| 72 |
return ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput); |
98 |
return { email => \@email_prefs, phone => \@phone_prefs, sms => \@sms_prefs }; |
| 73 |
} |
99 |
} |
| 74 |
|
100 |
|
| 75 |
|
101 |
|
|
Lines 79-90
sub _getInputFieldsForValidation {
Link Here
|
| 79 |
=cut |
105 |
=cut |
| 80 |
################################################################################ |
106 |
################################################################################ |
| 81 |
|
107 |
|
|
|
108 |
sub checkMessagingPreferencesSet { |
| 109 |
my ($self, $valid, @prefs) = @_; |
| 110 |
my $d = $self->getDriver(); |
| 111 |
$self->debugTakeSessionSnapshot(); |
| 112 |
|
| 113 |
foreach my $type (@prefs){ |
| 114 |
my @this_pref = $d->find_elements('input[type="checkbox"][id^="'.$type.'"]'); |
| 115 |
|
| 116 |
my $ok = 0; |
| 117 |
|
| 118 |
foreach my $checkbox (@this_pref){ |
| 119 |
ok(0, "Intra Memberentry $type messaging checkbox ".$checkbox->get_attribute('id')." not checked") if !$checkbox->is_selected() and $valid; |
| 120 |
ok(0, "Intra Memberentry $type messaging checkbox ".$checkbox->get_attribute('id')." checked (not supposed to be)") if $checkbox->is_selected() and !$valid; |
| 121 |
$ok = 1; |
| 122 |
} |
| 123 |
ok($ok, "Intra Memberentry $type messaging checkboxes ok (all " . (($valid) ? 'checked':'unchecked') . ")"); |
| 124 |
} |
| 125 |
|
| 126 |
return $self; |
| 127 |
} |
| 128 |
|
| 129 |
sub clearMessagingContactFields { |
| 130 |
my ($self, @fields) = @_; |
| 131 |
my $d = $self->getDriver(); |
| 132 |
$self->debugTakeSessionSnapshot(); |
| 133 |
|
| 134 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber) = $self->_getInputFieldsForValidation(); |
| 135 |
|
| 136 |
if (@fields) { |
| 137 |
for my $field (@fields){ |
| 138 |
$emailInput->clear() if $field eq "email"; |
| 139 |
$emailProInput->clear() if $field eq "emailpro"; |
| 140 |
$email_BInput->clear() if $field eq "B_email"; |
| 141 |
$phoneInput->clear() if $field eq "phone"; |
| 142 |
$phoneProInput->clear() if $field eq "phonepro"; |
| 143 |
$phone_BInput->clear() if $field eq "B_phone"; |
| 144 |
$SMSnumber->clear() if $field eq "SMSnumber"; |
| 145 |
} |
| 146 |
ok(1, "Intra Memberentry contact fields (@fields) cleared"); |
| 147 |
} else { |
| 148 |
$emailInput->clear(); |
| 149 |
$emailProInput->clear(); |
| 150 |
$email_BInput->clear(); |
| 151 |
$phoneInput->clear(); |
| 152 |
$phoneProInput->clear(); |
| 153 |
$phone_BInput->clear(); |
| 154 |
$SMSnumber->clear(); |
| 155 |
ok(1, "Intra Memberentry contact fields (email, emailpro, email_B, phone, phonepro, phone_B, SMSnumber) cleared"); |
| 156 |
} |
| 157 |
|
| 158 |
return $self; |
| 159 |
} |
| 160 |
|
| 161 |
sub checkPreferences { |
| 162 |
my ($self, $valid, $type) = @_; |
| 163 |
my $d = $self->getDriver(); |
| 164 |
$self->debugTakeSessionSnapshot(); |
| 165 |
|
| 166 |
my $checkboxes = $self->_getMessagingPreferenceCheckboxes(); |
| 167 |
|
| 168 |
ok (0, "Intra $type checkboxes not defined") if not defined $checkboxes->{$type}; |
| 169 |
return 0 if not defined $checkboxes->{$type}; |
| 170 |
|
| 171 |
foreach my $checkbox (@{ $checkboxes->{$type} }){ |
| 172 |
ok(0, "Intra Memberentry $type messaging checkbox ".$checkbox->get_attribute('id')." not available") if !$checkbox->is_enabled() and $valid; |
| 173 |
ok(0, "Intra Memberentry $type messaging checkbox ".$checkbox->get_attribute('id')." available (not supposed to be)") if $checkbox->is_enabled() and !$valid; |
| 174 |
|
| 175 |
$checkbox->click() if not $checkbox->is_selected(); |
| 176 |
} |
| 177 |
ok (1, "Intra Memberentry $type messaging checkboxes checked") if $valid; |
| 178 |
|
| 179 |
return $self; |
| 180 |
} |
| 82 |
sub setEmail { |
181 |
sub setEmail { |
| 83 |
my ($self, $input) = @_; |
182 |
my ($self, $input) = @_; |
| 84 |
my $d = $self->getDriver(); |
183 |
my $d = $self->getDriver(); |
| 85 |
$self->debugTakeSessionSnapshot(); |
184 |
$self->debugTakeSessionSnapshot(); |
| 86 |
|
185 |
|
| 87 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput) = $self->_getInputFieldsForValidation(); |
186 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber) = $self->_getInputFieldsForValidation(); |
| 88 |
|
187 |
|
| 89 |
$emailInput->clear(); |
188 |
$emailInput->clear(); |
| 90 |
$emailProInput->clear(); |
189 |
$emailProInput->clear(); |
|
Lines 102-108
sub setPhone {
Link Here
|
| 102 |
my $d = $self->getDriver(); |
201 |
my $d = $self->getDriver(); |
| 103 |
$self->debugTakeSessionSnapshot(); |
202 |
$self->debugTakeSessionSnapshot(); |
| 104 |
|
203 |
|
| 105 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput) = $self->_getInputFieldsForValidation(); |
204 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber) = $self->_getInputFieldsForValidation(); |
| 106 |
|
205 |
|
| 107 |
$phoneInput->clear(); |
206 |
$phoneInput->clear(); |
| 108 |
$phoneProInput->clear(); |
207 |
$phoneProInput->clear(); |
|
Lines 115-128
sub setPhone {
Link Here
|
| 115 |
return $self; |
214 |
return $self; |
| 116 |
} |
215 |
} |
| 117 |
|
216 |
|
|
|
217 |
sub setSMSNumber { |
| 218 |
my ($self, $input) = @_; |
| 219 |
my $d = $self->getDriver(); |
| 220 |
$self->debugTakeSessionSnapshot(); |
| 221 |
|
| 222 |
my ($emailInput, $emailProInput, $email_BInput, $phoneInput, $phoneProInput, $phone_BInput, $SMSnumber) = $self->_getInputFieldsForValidation(); |
| 223 |
|
| 224 |
$SMSnumber->clear(); |
| 225 |
$SMSnumber->send_keys($input); |
| 226 |
ok(1, "Intra Memberentry Wrote \"$input\" to SMSnumber."); |
| 227 |
|
| 228 |
return $self; |
| 229 |
} |
| 230 |
|
| 118 |
sub submitForm { |
231 |
sub submitForm { |
| 119 |
my ($self, $valid) = @_; |
232 |
my ($self, $valid) = @_; |
| 120 |
my $d = $self->getDriver(); |
233 |
my $d = $self->getDriver(); |
| 121 |
$self->debugTakeSessionSnapshot(); |
234 |
$self->debugTakeSessionSnapshot(); |
| 122 |
|
235 |
|
| 123 |
my $submitButton = $d->find_element('form#entryform input[type="submit"]'); |
236 |
my $submitButton = $d->find_element('form#entryform input[type="submit"]'); |
| 124 |
$submitButton->click(); |
237 |
$submitButton->submit(); |
| 125 |
|
|
|
| 126 |
$self->debugTakeSessionSnapshot(); |
238 |
$self->debugTakeSessionSnapshot(); |
| 127 |
|
239 |
|
| 128 |
if ($valid) { |
240 |
if ($valid) { |
|
Lines 142-151
sub submitForm {
Link Here
|
| 142 |
$d->refresh(); |
254 |
$d->refresh(); |
| 143 |
return $self; |
255 |
return $self; |
| 144 |
} |
256 |
} |
| 145 |
|
|
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
} |
257 |
} |
| 150 |
|
258 |
|
| 151 |
1; |
259 |
1; |