Fixed Survey test suite 'tagged' check to work with nested data
This commit is contained in:
parent
61832b62b9
commit
5acade845a
2 changed files with 21 additions and 3 deletions
|
|
@ -670,7 +670,8 @@ END_WHY
|
|||
return fail($testCount, $name, "Tag not found: $tagKey");
|
||||
}
|
||||
my $currentTagValue = $currentTags->{$tagKey};
|
||||
if ($currentTagValue != $tagValue) {
|
||||
|
||||
if (!eq_deeply($currentTagValue, $tagValue)) {
|
||||
$self->session->log->debug("Incorrect tag value: $currentTagValue != $tagValue");
|
||||
return fail($testCount, $name, <<END_WHY);
|
||||
Compared tag '$tagKey'
|
||||
|
|
@ -686,7 +687,7 @@ END_WHY
|
|||
my $currentTags = $rJSON->tags;
|
||||
while (my ($tagKey, $tagValue) = each %$tagged) {
|
||||
my $currentTagValue = $currentTags->{$tagKey};
|
||||
if ($currentTagValue != $tagValue) {
|
||||
if (!eq_deeply($currentTagValue, $tagValue)) {
|
||||
$self->session->log->debug("Incorrect tag value: $currentTagValue != $tagValue");
|
||||
return fail($testCount, $name, <<END_WHY);
|
||||
Compared tag '$tagKey'
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 85;
|
||||
plan tests => 88;
|
||||
|
||||
my ( $s, $t1 );
|
||||
|
||||
|
|
@ -424,6 +424,23 @@ try_it( $t1, $spec, { tap => <<END_TAP } );
|
|||
ok 1 - Checking tagged on page containing Section S1 Question S1Q0
|
||||
END_TAP
|
||||
|
||||
# Complex tag object via setup option
|
||||
$spec = <<END_SPEC;
|
||||
[
|
||||
{
|
||||
"test" : {
|
||||
"S1Q0" : "n",
|
||||
"setup" : { tag: { nested: { a: { a: 1 }, b: [ 2 ] } } },
|
||||
"tagged" : { nested: { a: { a: 1 }, b: [ 2 ] } },
|
||||
},
|
||||
},
|
||||
]
|
||||
END_SPEC
|
||||
try_it( $t1, $spec, { tap => <<END_TAP } );
|
||||
1..1
|
||||
ok 1 - Checking tagged on page containing Section S1 Question S1Q0
|
||||
END_TAP
|
||||
|
||||
# setup can also be specified inside test object
|
||||
$spec = <<END_SPEC;
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue