Tests for CAPTCHA

This commit is contained in:
swagg boi 2023-08-05 00:14:56 -04:00
parent 540dc829d2
commit 238fae2391
2 changed files with 22 additions and 4 deletions

View file

@ -66,9 +66,15 @@ subtest 'Flagging remark', sub {
->element_exists('a[href*="flag"]')
->text_like(h2 => qr/Remark #1/);
$t->get_ok('/remark/flag/1')->status_is(200)
$t->get_ok('/human/remark/flag/1')->status_is(302)
->header_like(Location => qr/captcha/);
# Solved CAPTCHA
$tx->req->cookies({is_human => 1});
$t->get_ok('/human/thread/flag/1')->status_is(200)
->element_exists('p[class="stash-with-info"]')
->text_like(p => qr/Remark #1 has been flagged/);
->text_like(p => qr/Thread #1 has been flagged/);
};
done_testing;

View file

@ -96,7 +96,13 @@ subtest 'Bumping thread', sub {
->element_exists('a[href*="bump"]')
->text_like(h2 => qr/Thread #1/);
$t->get_ok('/thread/bump/1')->status_is(200)
$t->get_ok('/human/thread/bump/1')->status_is(302)
->header_like(Location => qr/captcha/);
# Solved CAPTCHA
$tx->req->cookies({is_human => 1});
$t->get_ok('/human/thread/bump/1')->status_is(200)
->element_exists('p[class="stash-with-info"]')
->text_like(p => qr/Thread #1 has been bumped/);
};
@ -110,7 +116,13 @@ subtest 'Flagging thread', sub {
->element_exists('a[href*="flag"]')
->text_like(h2 => qr/Thread #1/);
$t->get_ok('/thread/flag/1')->status_is(200)
$t->get_ok('/human/thread/flag/1')->status_is(302)
->header_like(Location => qr/captcha/);
# Solved CAPTCHA
$tx->req->cookies({is_human => 1});
$t->get_ok('/human/thread/flag/1')->status_is(200)
->element_exists('p[class="stash-with-info"]')
->text_like(p => qr/Thread #1 has been flagged/);
};