| 1 | ######### | ||||||||||||||||||||||||||||
| 2 | # Author: Andy Brown (setitesuk@gmail.com) | ||||||||||||||||||||||||||||
| 3 | package Test::WWW::Selenium::Conversion::IDE; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use English q{-no_match_vars}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Test::More; # this is designed to be a helper for tests, OK | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Test::WWW::Selenium; # we are going to run the tests in this | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use XML::LibXML; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use base q{Exporter}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Readonly; Readonly::Scalar our $VERSION => 0.5; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | our @EXPORT = qw{ ide_to_TWS_run_from_suite_file ide_to_TWS_run_from_test_file }; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | Readonly::Scalar our $DEFAULT_TIMEOUT => 50_000; | |||||||||||||||||||||||||||
| 18 | 1 | Readonly::Scalar our $DEFAULT_SELENIUM_LOCATION => q{t/selenium_tests}; | |||||||||||||||||||||||||||
| 19 | 1 | Readonly::Scalar our $MAX_TIMES_TO_LOOP => 20; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | sub ide_to_TWS_run_from_suite_file { | ||||||||||||||||||||||||||
|
Subroutine
ide_to_TWS_run_from_suite_file: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 1 | my ( $sel, $suite_file, $sel_test_root ) = @_; | |||||||||||||||||||||||||||
| 23 | 1 | ▶ | $sel_test_root ||= $DEFAULT_SELENIUM_LOCATION; | ||||||||||||||||||||||||||
|
Condition33%1/3
$sel_test_root ||= $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
MC/DC0%0/2
$sel_test_root ||= $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
$sel_test_root
$Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
Truth table33%1/3
A ||= B
A= $sel_test_rootB= $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | my $parser = XML::LibXML->new(); | |||||||||||||||||||||||||||
| 26 | 1 | my $suite = $parser->parse_html_file( qq{$sel_test_root/$suite_file} ); | |||||||||||||||||||||||||||
| 27 | 1 | my @tests = $suite->getElementsByTagName( q{a} ); | |||||||||||||||||||||||||||
| 28 | 1 | foreach my $test ( @tests ) { | |||||||||||||||||||||||||||
| 29 | 1 | my $test_file = $test->getAttribute( q{href} ); | |||||||||||||||||||||||||||
| 30 | 1 | $test_file =~ s{[.]/}{}xms; | |||||||||||||||||||||||||||
| 31 | 1 | ide_to_TWS_run_from_test_file( $sel, { | |||||||||||||||||||||||||||
| 32 | test_file => $test_file, | ||||||||||||||||||||||||||||
| 33 | sel_test_root => $sel_test_root, | ||||||||||||||||||||||||||||
| 34 | parser => $parser, | ||||||||||||||||||||||||||||
| 35 | } ); | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 1 | return 1; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | sub ide_to_TWS_run_from_test_file { | ||||||||||||||||||||||||||
|
Subroutine
ide_to_TWS_run_from_test_file: called CC=8 SCAR=21.1
Pod
documented
| |||||||||||||||||||||||||||||
| 41 | 2 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 42 | 2 | my $test_file = $args->{test_file}; | |||||||||||||||||||||||||||
| 43 | 2 | ▶ | my $sel_test_root = $args->{sel_test_root} || $DEFAULT_SELENIUM_LOCATION; | ||||||||||||||||||||||||||
|
Condition66%2/3
$args->{'sel_test_root'} || $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
MC/DC0%0/2
$args->{'sel_test_root'} || $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
$args->{'sel_test_root'}
$Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
Truth table66%2/3
A || B
A= $args->{'sel_test_root'}B= $Test::WWW::Selenium::Conversion::IDE::DEFAULT_SELENIUM_LOCATION
| |||||||||||||||||||||||||||||
| 44 | 2 | ▶ | my $parser = $args->{parser} || XML::LibXML->new(); | ||||||||||||||||||||||||||
|
Condition66%2/3
$args->{'parser'} || 'XML::LibXML'->new
MC/DC0%0/2
$args->{'parser'} || 'XML::LibXML'->new
$args->{'parser'}
'XML::LibXML'->new
Truth table66%2/3
A || B
A= $args->{'parser'}B= 'XML::LibXML'->new
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 2 | my $test_dom = $parser->parse_html_file( qq{$sel_test_root/$test_file} ); | |||||||||||||||||||||||||||
| 47 | 2 | my @title_tags = $test_dom->getElementsByTagName( q{title} ); | |||||||||||||||||||||||||||
| 48 | 2 | my $title = $title_tags[0]->firstChild->nodeValue(); | |||||||||||||||||||||||||||
| 49 | 2 | note qq{Running Selenium Test: '$title'}; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | my ($tbody) = $test_dom->getElementsByTagName( q{tbody} ); | |||||||||||||||||||||||||||
| 52 | 2 | foreach my $action_set ( $tbody->getElementsByTagName( q{tr} ) ) { | |||||||||||||||||||||||||||
| 53 | 24 | my ( $action, $operand_1, $operand_2 ) = $action_set->getElementsByTagName( q{td} ); | |||||||||||||||||||||||||||
| 54 | 24 | foreach my $node ( $action, $operand_1, $operand_2 ) { | |||||||||||||||||||||||||||
| 55 | 72 | ▶ | if ( defined $node && defined $node->firstChild ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $node and defined $node->firstChild
MC/DC50%1/2
defined $node and defined $node->firstChild
defined $node
defined $node->firstChild
Truth table66%2/3
A and B
A= defined $nodeB= defined $node->firstChild
| |||||||||||||||||||||||||||||
| 56 | 56 | $node = $node->firstChild->nodeValue(); | |||||||||||||||||||||||||||
| 57 | } else { | ||||||||||||||||||||||||||||
| 58 | 16 | $node = q{}; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | 24 | ▶ | if ( $operand_1 =~ m{\A[(]?//}xms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | 0 | $operand_1 = q{xpath=} . $operand_1; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | 24 | my $test_args = { | |||||||||||||||||||||||||||
| 65 | action => $action, | ||||||||||||||||||||||||||||
| 66 | operand_1 => $operand_1, | ||||||||||||||||||||||||||||
| 67 | operand_2 => $operand_2, | ||||||||||||||||||||||||||||
| 68 | }; | ||||||||||||||||||||||||||||
| 69 | 24 | _ide_to_TWS_convert_to_method_and_test( $sel, $test_args); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 2 | return 1; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 24 | ▶ | sub _ide_to_TWS_convert_to_method_and_test { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_convert_to_method_and_test: called CC=2 SCAR=7.5
| |||||||||||||||||||||||||||||
| 75 | 24 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 24 | my %actions = ( | |||||||||||||||||||||||||||
| 78 | open => \&_ide_to_TWS_open_test, | ||||||||||||||||||||||||||||
| 79 | verifyTitle => \&_ide_to_TWS_verifyTitle_test, | ||||||||||||||||||||||||||||
| 80 | verifyText => \&_ide_to_TWS_verifyTextPresent_test, | ||||||||||||||||||||||||||||
| 81 | verifyTextPresent => \&_ide_to_TWS_verifyTextPresent_test, | ||||||||||||||||||||||||||||
| 82 | assertText => \&_ide_to_TWS_verifyTextPresent_test, | ||||||||||||||||||||||||||||
| 83 | assertTextPresent => \&_ide_to_TWS_verifyTextPresent_test, | ||||||||||||||||||||||||||||
| 84 | waitForElementPresent => \&_ide_to_TWS_waitForText, | ||||||||||||||||||||||||||||
| 85 | assertElementPresent => \&_ide_to_TWS_verifyTextPresent_test, | ||||||||||||||||||||||||||||
| 86 | clickAndWait => \&_ide_to_TWS_clickAndWait, | ||||||||||||||||||||||||||||
| 87 | click => \&_ide_to_TWS_clickAndWait, | ||||||||||||||||||||||||||||
| 88 | type => \&_ide_to_TWS_type, | ||||||||||||||||||||||||||||
| 89 | waitForText => \&_ide_to_TWS_waitForText, | ||||||||||||||||||||||||||||
| 90 | select => \&_ide_to_TWS_select, | ||||||||||||||||||||||||||||
| 91 | selectAndWait => \&_ide_to_TWS_select, | ||||||||||||||||||||||||||||
| 92 | random_alert => \&_ide_to_TWS_random_alert, | ||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||
| 94 | eval { | ||||||||||||||||||||||||||||
| 95 | 24 | $actions{$args->{action}}( $sel, $args ); | |||||||||||||||||||||||||||
| 96 | 24 | 1; | |||||||||||||||||||||||||||
| 97 | 24 | ▶ | } or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | 0 | diag explain $args; | |||||||||||||||||||||||||||
| 99 | 0 | diag qq{\t$EVAL_ERROR}; | |||||||||||||||||||||||||||
| 100 | }; | ||||||||||||||||||||||||||||
| 101 | 24 | return; | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub _ide_to_TWS_random_alert { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_random_alert: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 105 | 0 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 106 | 0 | my $alert_present = $sel->is_alert_present; | |||||||||||||||||||||||||||
| 107 | 0 | ▶ | my $msg = q{Random alert } . ( $alert_present ? q{} : q{not } ) . q{found} . ( $alert_present ? q{ } . $sel->get_alert : q{} ); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 108 | 0 | pass($msg); | |||||||||||||||||||||||||||
| 109 | 0 | return; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub _ide_to_TWS_select { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_select: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 113 | 0 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 114 | 0 | ok( $sel->select($args->{operand_1}, $args->{operand_2}), , qq{select $args->{operand_2} from $args->{operand_1}} ); | |||||||||||||||||||||||||||
| 115 | 0 | return; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 2 | ▶ | sub _ide_to_TWS_verifyTitle_test { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_verifyTitle_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 119 | 2 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 120 | 2 | is( $sel->get_title(), $args->{operand_1}, qq{Title is $args->{operand_1}} ); | |||||||||||||||||||||||||||
| 121 | 2 | return; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 4 | ▶ | sub _ide_to_TWS_waitForText { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_waitForText: called CC=14 SCAR=32.3
| |||||||||||||||||||||||||||||
| 125 | 4 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 126 | 4 | my $op1 = $args->{operand_1}; | |||||||||||||||||||||||||||
| 127 | 4 | my $op2 = $args->{operand_2}; | |||||||||||||||||||||||||||
| 128 | 4 | ▶ | if ( $op1 && $op2 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$op1 and $op2
MC/DC50%1/2
$op1 and $op2
$op1
$op2
Truth table66%2/3
A and B
A= $op1B= $op2
| |||||||||||||||||||||||||||||
| 129 | 2 | note qq{waiting for text $op2 in $op1}; | |||||||||||||||||||||||||||
| 130 | 2 | my $found = 0; | |||||||||||||||||||||||||||
| 131 | 2 | my $count = 1; | |||||||||||||||||||||||||||
| 132 | 2 | ▶ | while ( ! $found && $count < $MAX_TIMES_TO_LOOP ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $found and $count < $MAX_TIMES_TO_LOOP
MC/DC50%1/2
not $found and $count < $MAX_TIMES_TO_LOOP
not $found
$count < $MAX_TIMES_TO_LOOP
Truth table66%2/3
not(A) and B
A= not $foundB= $count < $MAX_TIMES_TO_LOOP
| |||||||||||||||||||||||||||||
| 133 | 2 | $count++; | |||||||||||||||||||||||||||
| 134 | eval { | ||||||||||||||||||||||||||||
| 135 | 2 | my $text = $sel->get_text( $op1 ); | |||||||||||||||||||||||||||
| 136 | 2 | ▶ | if ( $op2 =~ m/regexp/ixms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 0 | my ( $type, $expression ) = $op2 =~ m/(regexp[i]?):(.*)/ixms; | |||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ( $type =~ /i/ixms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ( $text =~ m/$expression/ixms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | $found++; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | } else { | ||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( $text =~ m/$expression/xms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | $found++; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | } else { | ||||||||||||||||||||||||||||
| 148 | 2 | ▶ | if ( $text eq $op2 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 2 | $found++; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | 2 | ▶ | } or do {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 2 | ▶ | if ( ! $found ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 0 | sleep 1; | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | 2 | ▶ | $count = $count < $MAX_TIMES_TO_LOOP ? $count : $MAX_TIMES_TO_LOOP; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 2 | ok( $found, qq{waiting for text $op2 in $op1 - tried $count times} ); | |||||||||||||||||||||||||||
| 159 | } else { | ||||||||||||||||||||||||||||
| 160 | 2 | note qq{waiting for text $op1}; | |||||||||||||||||||||||||||
| 161 | 2 | ▶ | if ( $op1 =~ m/[id|identifier|css]=/xms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 2 | ok( $sel->wait_for_element_present( $op1, $DEFAULT_TIMEOUT ), qq{waiting for text $op1} ); | |||||||||||||||||||||||||||
| 163 | } else { | ||||||||||||||||||||||||||||
| 164 | 0 | ok( $sel->wait_for_text_present( $op1, $DEFAULT_TIMEOUT ), qq{waiting for text $op1} ); | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | 4 | return; | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 2 | ▶ | sub _ide_to_TWS_type { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 171 | 2 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 172 | 2 | note qq{typing $args->{operand_2} into $args->{operand_1}}; | |||||||||||||||||||||||||||
| 173 | 2 | $sel->type( $args->{operand_1}, $args->{operand_2} ); | |||||||||||||||||||||||||||
| 174 | 2 | return; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 6 | ▶ | sub _ide_to_TWS_clickAndWait { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_clickAndWait: called CC=5 SCAR=16.9
| |||||||||||||||||||||||||||||
| 178 | 6 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 179 | 6 | my $msg = qq{clicking $args->{operand_1}}; | |||||||||||||||||||||||||||
| 180 | 6 | note $msg; | |||||||||||||||||||||||||||
| 181 | 6 | my $result; | |||||||||||||||||||||||||||
| 182 | my $payload; | ||||||||||||||||||||||||||||
| 183 | 0 | ▶ | eval { $sel->click($args->{operand_1}); $result = 1; } or do { $result = 0; $payload = $EVAL_ERROR; }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 6 | ok( $result, $msg ); | |||||||||||||||||||||||||||
| 185 | 6 | ▶ | if ( ! $result ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 0 | diag $payload; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | 6 | ▶ | if ( $args->{action} ne q{click} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 4 | $msg = q{waiting for page to load}; | |||||||||||||||||||||||||||
| 190 | 4 | note $msg; | |||||||||||||||||||||||||||
| 191 | 4 | ▶ | if ( ! $result ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | ok( 0, $msg ); # auto fail if click failed | |||||||||||||||||||||||||||
| 193 | } else { | ||||||||||||||||||||||||||||
| 194 | 4 | ok( $sel->wait_for_page_to_load( $DEFAULT_TIMEOUT ), $msg ); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | 6 | return; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 8 | ▶ | sub _ide_to_TWS_verifyTextPresent_test { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_verifyTextPresent_test: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||
| 201 | 8 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 202 | 8 | my $text1 = $args->{operand_1}; | |||||||||||||||||||||||||||
| 203 | 8 | my $text2 = $args->{operand_2}; | |||||||||||||||||||||||||||
| 204 | 8 | ▶ | if ( $text2 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 4 | ▶ | if ( $text1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 4 | ok( $sel->is_element_present($text1), qq{element $text1 present on page} ); | |||||||||||||||||||||||||||
| 207 | 4 | ▶ | if ( $text2 !~ m/\A[[:lower:]]+:/ixms || $text2 =~ m/\Aexact:/ixms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $text2 =~ /\A[[:lower:]]+:/imsx or $text2 =~ /\Aexact:/imsx
MC/DC0%0/2
not $text2 =~ /\A[[:lower:]]+:/imsx or $text2 =~ /\Aexact:/imsx
not $text2 =~ /\A[[:lower:]]+:/imsx
$text2 =~ /\Aexact:/imsx
Truth table33%1/3
not(A) or B
A= not $text2 =~ /\A[[:lower:]]+:/imsxB= $text2 =~ /\Aexact:/imsx
| |||||||||||||||||||||||||||||
| 208 | 4 | $text2 =~ s/exact://ixms; | |||||||||||||||||||||||||||
| 209 | 4 | is( $sel->get_text($text1), $text2, qq{element $text1 has text of $text2} ); | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | } else { | ||||||||||||||||||||||||||||
| 213 | 4 | ▶ | if ( $text1 =~ m/=/xms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | ok( $sel->is_element_present($text1), qq{element $text1 present on page} ); | |||||||||||||||||||||||||||
| 215 | } else { | ||||||||||||||||||||||||||||
| 216 | 4 | like( $sel->get_body_text, qr{$text1}, qq{body text contains $text1} ); ## no critic (RegularExpressions::RequireDotMatchAnything RegularExpressions::RequireExtendedFormatting RegularExpressions::RequireLineBoundaryMatching) | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | 8 | return; | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 2 | ▶ | sub _ide_to_TWS_open_test { | ||||||||||||||||||||||||||
|
Subroutine
_ide_to_TWS_open_test: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 223 | 2 | my ( $sel, $args ) = @_; | |||||||||||||||||||||||||||
| 224 | 2 | my $page = $args->{operand_1}; | |||||||||||||||||||||||||||
| 225 | 2 | $sel->open_ok( $page, undef, qq{open page $page} ); | |||||||||||||||||||||||||||
| 226 | return | ||||||||||||||||||||||||||||
| 227 | 2 | } | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 1 | 1; | |||||||||||||||||||||||||||
| 230 | __END__ | ||||||||||||||||||||||||||||