Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4032 from ehuelsmann/expand-bdd-ar
Expand bdd ar
- Loading branch information
Showing
10 changed files
with
265 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package PageObject::App::Invoices::Payment; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Carp; | ||
use PageObject; | ||
|
||
|
||
use Moose; | ||
use namespace::autoclean; | ||
extends 'PageObject'; | ||
|
||
use PageObject::App; | ||
|
||
__PACKAGE__->self_register( | ||
'invoice-payment', | ||
'.//tr[contains(@class,"invoice-payment")]', | ||
tag_name => 'tr', | ||
attributes => { | ||
'class' => 'invoice-payment', | ||
}); | ||
|
||
# counterparty_type IN ('customer', 'vendor') | ||
has counterparty_type => (is => 'ro', isa => 'Str', required => 1); | ||
|
||
has field_map => (is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_field_map'); | ||
|
||
sub _verify { | ||
my ($self) = @_; | ||
|
||
###TODO | ||
|
||
return $self; | ||
}; | ||
|
||
sub _build_field_map { | ||
my ($self) = @_; | ||
|
||
return { | ||
'Date' => 'datepaid', | ||
'Source' => 'source', | ||
'Memo' => 'memo', | ||
'Amount' => 'amount', | ||
'Account' => ($self->counterparty_type eq 'customer' ? 'AR' : 'AP') . '_paid', | ||
}; | ||
} | ||
|
||
sub field { | ||
my ($self, $label) = @_; | ||
my $fieldname = $self->field_map->{$label}; | ||
return $self->find(qq{.//*[contains(\@name,"${fieldname}")]}); | ||
} | ||
|
||
sub field_value { | ||
my ($self, $label, $new_value) = @_; | ||
my $fieldname = $self->field_map->{$label}; | ||
my $field = $self->find( | ||
qq{.//input[contains(\@id,"${fieldname}")] | ||
| .//input[\@type="hidden" and | ||
contains(\@name,"${fieldname}")]}); | ||
die "Payment line column ${fieldname} not found" | ||
if not defined $field; | ||
my $rv = $field->value; | ||
|
||
$rv = '' | ||
if ($field->tag_name eq 'input' | ||
&& $field->get_attribute('type') eq 'checkbox' | ||
&& ! $field->selected); | ||
|
||
if (defined $new_value) { | ||
$field->click; | ||
$field->clear; | ||
$field->send_keys($new_value); | ||
} | ||
|
||
return $rv; | ||
} | ||
|
||
|
||
sub is_empty { | ||
my ($self) = @_; | ||
return ($self->field_value('Date') eq ''); | ||
} | ||
|
||
|
||
__PACKAGE__->meta->make_immutable; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package PageObject::App::Invoices::Payments; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Carp; | ||
use PageObject; | ||
use PageObject::App::Invoices::Payment; | ||
|
||
use Moose; | ||
use namespace::autoclean; | ||
extends 'PageObject'; | ||
|
||
__PACKAGE__->self_register( | ||
'invoice-payments', | ||
'.//*[@id="invoice-payments-table"]', | ||
tag_name => 'table', | ||
attributes => { | ||
id => 'invoice-payments-table', | ||
}); | ||
|
||
# counterparty_type IN ('customer', 'vendor') | ||
has counterparty_type => (is => 'ro', isa => 'Str', required => 1); | ||
|
||
|
||
sub _verify { | ||
my ($self) = @_; | ||
|
||
return $self; | ||
} | ||
|
||
sub payment_lines { | ||
my ($self) = @_; | ||
|
||
$self->verify; | ||
return $self->find_all('*invoice-payment', | ||
widget_args => [ counterparty_type => $self->counterparty_type ]); | ||
} | ||
|
||
|
||
__PACKAGE__->meta->make_immutable; | ||
|
||
1; |