Test/Selenium/Remote/WebElement.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 100% 2 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 88.8% 32 / 36 CC 4 SCAR 6.5
CC
4
Cov
96%
BUILD
3.0
has_args
2.0
__ANON__
1.1
CRAP 1.9
« Selenium/Remote/driver-example.pl ↑ Summary Selenium/Chrome.pm »
1 package Test::Selenium::Remote::WebElement;
2 14 $Test::Selenium::Remote::WebElement::VERSION = '1.50';
3 # ABSTRACT: A sub-class of L<Selenium::Remote::WebElement>, with several test-specific method additions.
4  
5 14 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use Sub::Install;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 extends 'Selenium::Remote::WebElement';
8  
9 =for Pod::Coverage *EVERYTHING*
10  
11 =cut
12  
13 # list of test functions to be built
14  
15 has func_list => (
16 is => 'lazy',
17 33 ▶ builder => sub {
Subroutine _build_func_list: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=1.2
18 return [
19 0 'clear_ok', 'click_ok', 'send_keys_ok',
20 'is_displayed_ok', 'is_enabled_ok', 'is_selected_ok',
21 'submit_ok', 'text_is', 'text_isnt',
22 'text_like', 'text_unlike', 'attribute_is',
23 'attribute_isnt', 'attribute_like', 'attribute_unlike',
24 'value_is', 'value_isnt', 'value_like',
25 'value_unlike', 'tag_name_is', 'tag_name_isnt',
26 'tag_name_like', 'tag_name_unlike'
27 ];
28 }
29 14 );
30  
31 14 with 'Test::Selenium::Remote::Role::DoesTesting';
32  
33 # helper so we could specify the num of args a method takes (if any)
34  
35 32 ▶sub has_args {
Subroutine has_args: called CC=2 SCAR=6.9
Pod undocumented
36 32 my $self = shift;
37 32 my $fun_name = shift;
38 32 my $hash_fun_args = {
39 'get_attribute' => 1,
40 'send_keys' => 1,
41 };
42 32 ▶ return ( $hash_fun_args->{$fun_name} // 0 );
Condition100%2/2
$hash_fun_args->{$fun_name} // 0
l!l
725
MC/DC100%1/1
$hash_fun_args->{$fun_name} // 0
$hash_fun_args->{$fun_name}
Truth table100%2/2
A
A= $hash_fun_args->{$fun_name}
Aresult
11
00
43 }
44  
45 # install the test methods into the class namespace
46  
47 33 ▶sub BUILD {
Subroutine BUILD: called CC=3 SCAR=11.0
Pod undocumented
48 33 my $self = shift;
49 33 foreach my $method_name ( @{ $self->func_list } ) {
50 759 ▶ unless ( defined( __PACKAGE__->can($method_name) ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined __PACKAGE__->can($method_name)) 69 690 759
51 69 my $sub = $self->_build_sub($method_name);
52 69 Sub::Install::install_sub(
53 {
54 code => $sub,
55 into => __PACKAGE__,
56 as => $method_name
57 }
58 );
59 }
60 }
61 }
62  
63 14 1;
64  
65 __END__
« Selenium/Remote/driver-example.pl ↑ Summary Selenium/Chrome.pm »