Skip to content

Commit

Permalink
Update "Logged in as..." related tests
Browse files Browse the repository at this point in the history
Some tests were expecting the "Logged in as..." message to be displayed.

Since it was replaced by the user's initials, the tests were updated to
expect the new format.
  • Loading branch information
richieri-bps committed Sep 12, 2024
1 parent 8821e6e commit 2dea55d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/RT/Test/Selenium.pm
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ sub logged_in_as {
}
}

$self->body_text_like( qr/Logged in as $user/i, 'Logged in' );
$self->content_like( qr{<span[^>]*class=[^>]*current-user[^>]*alt="[^>]*\Q$user\E"[^>]*>.*?<\/span>}i );
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/RT/Test/Web.pm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sub logged_in_as {
return 0;
}
RT::Interface::Web::EscapeHTML(\$user);
unless ( $self->content =~ m{<span class="current-user">\Q$user\E</span>}i ) {
unless ( $self->content =~ m{<span[^>]*class=[^>]*current-user[^>]*alt="[^>]*\Q$user\E"[^>]*>.*?<\/span>}i ) {
Test::More::diag("Page has no user name");
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion t/externalauth/ldap_escaping.t
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ diag "paren in the username";
# $m->login chokes on ( in 4.0.5
$m->get_ok($m->rt_base_url . "?user=j(doe;pass=password");
$m->content_like(qr/Logout/i, 'contains logout link');
$m->content_contains('<span class="current-user">j&#40;doe</span>', 'contains logged in user name');
$m->content_like(qr/<span[^>]*class=[^>]*current-user[^>]*alt="[^>]*j&#40;doe"[^>]*>.*?<\/span>/i, 'contains logged in user name');

my $testuser = RT::User->new($RT::SystemUser);
my ($ok,$msg) = $testuser->Load( 'j(doe' );
Expand Down
2 changes: 1 addition & 1 deletion t/web/basic_auth.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $m->get($url, $m->auth_header( root => "password" ));
is($m->status, 200, "Request with right creds gets 200");

$m->content_like(
qr{<span class="current-user">\Qroot\E</span>}i,
qr{<span[^>]*class=[^>]*current-user[^>]*alt="[^>]*\Qroot\E"[^>]*>.*?<\/span>}i,
"Has user on the page"
);
$m->content_like(qr/Logout/i, "Has logout button");
Expand Down

0 comments on commit 2dea55d

Please sign in to comment.