49 lines
1.5 KiB
HTML
49 lines
1.5 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>hCaptcha Auto Completion Detection Test</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
|
<script src="/tests/SimpleTest/GleanTest.js"></script>
|
|
<script src="CaptchaTestingUtils.js"></script>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test"></pre>
|
|
|
|
<script>
|
|
add_task(async function () {
|
|
await GleanTest.testResetFOG();
|
|
|
|
await CaptchaTestingUtils.createIframeAndWaitForMessage(
|
|
"hcaptcha_puzzle.html#frame=challenge",
|
|
document.body,
|
|
"ready"
|
|
);
|
|
|
|
const checkboxFrame =
|
|
await CaptchaTestingUtils.createIframeAndWaitForMessage(
|
|
"hcaptcha_checkbox.html#frame=checkbox",
|
|
document.body,
|
|
"ready"
|
|
);
|
|
|
|
const metricSet = CaptchaTestingUtils.waitForMetricSet();
|
|
checkboxFrame.contentWindow.postMessage("display-checkmark", "*");
|
|
await metricSet;
|
|
|
|
const puzzleCompletedCount =
|
|
await GleanTest.captchaDetection.hcaptchaAc.testGetValue();
|
|
is(puzzleCompletedCount, 1, "The puzzle completion count should be 1");
|
|
|
|
const occurredCount =
|
|
await GleanTest.captchaDetection.hcaptchaOc.testGetValue();
|
|
is(occurredCount, 1, "We should have detected the occurrence");
|
|
|
|
await CaptchaTestingUtils.clearPrefs();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|