Skip to content

Commit

Permalink
Merge pull request #5392 from Martchus/comments-test
Browse files Browse the repository at this point in the history
Add additional check in `t/ui/15-comments.t` for easier debugging
  • Loading branch information
mergify[bot] authored Dec 8, 2023
2 parents db07886 + e5a9cfd commit 71dfa1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions t/ui/15-comments.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ my $test_case = OpenQA::Test::Case->new;
my $schema_name = OpenQA::Test::Database->generate_schema_name;
my $schema
= $test_case->init_data(schema_name => $schema_name, fixtures_glob => '01-jobs.pl 03-users.pl 04-products.pl');
my $comments = $schema->resultset('Comments');

my $t = Test::Mojo->new('OpenQA::WebAPI');

Expand Down Expand Up @@ -483,6 +484,11 @@ subtest 'editing when logged in as regular user' => sub {
$driver->get($group_url);
is(scalar @{$driver->find_elements('.pinned-comment-row')}, 1, 'there shouldn\'t appear more pinned comments');

# verify the number of comments we have added so far for easier debugging in case subsequent tests fail
my $group_id = (split('/', $group_url))[-1];
my %cond = (-or => [{group_id => $group_id}, {parent_group_id => $group_id}]);
is $comments->search(\%cond)->count, 5, 'expected number of comments present in database at this point';

# pagination present
is(scalar @{$driver->find_elements('.comments-pagination a')}, 1, 'one pagination button present');
$driver->get($group_url . '?comments_limit=2');
Expand Down

0 comments on commit 71dfa1b

Please sign in to comment.