-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from the-markup/fix-tests
Fix Keylogging Tests
- Loading branch information
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" }, | ||
{ | ||
|
@@ -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) => { | ||
|
@@ -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( | ||
|
@@ -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() | ||
|