Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Keylogging Tests #94

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions __tests__/key-logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { Global } from "../src/types";

declare var global: Global;

const sleep = ms => new Promise(res => setTimeout(res, ms));

const INPUT_VALUES_RESULT = [
{ type: "email", value: "[email protected]", name: "email" },
{
Expand Down Expand Up @@ -673,7 +675,7 @@ describe("KeyLogging", () => {
const testUrl = `${global.__DEV_SERVER__}/input-form.html`;
await page.goto(testUrl, { timeout: 10000 });
await fillForms(page);
await page.waitForTimeout(2000);
await sleep(2000);

const inputValues: any = await page.evaluate(async () => {
return new Promise((res, rej) => {
Expand Down Expand Up @@ -702,9 +704,9 @@ describe("KeyLogging", () => {

await setupKeyLoggingInspector(page, eventHandler);
await page.goto(testUrl, { waitUntil: "networkidle2" });
await page.waitForTimeout(1000);
await sleep(1000);
await fillForms(page);
await page.waitForTimeout(100);
await sleep(100);
await page.close();
// console.log(rows);
expect(rows.filter(r => r.type === "KeyLogging").sort()).toEqual(
Expand Down Expand Up @@ -779,9 +781,9 @@ describe("KeyLogging", () => {
};
await setupKeyLoggingInspector(page, eventHandler);
await page.goto(testUrl, { waitUntil: "networkidle2" });
await page.waitForTimeout(1000);
await sleep(1000);
await fillForms(page);
await page.waitForTimeout(100);
await sleep(100);
await page.close();
expect(rows.filter(r => r.type === "KeyLogging").sort()).toEqual(
DATA_EXFILTRATION_MIXED.sort()
Expand Down
Loading