-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be more selective about signal redaction (#1106)
- Loading branch information
Showing
19 changed files
with
467 additions
and
107 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
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
51 changes: 51 additions & 0 deletions
51
packages/signals/signals-integration-tests/src/helpers/playwright-utils.ts
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Page } from '@playwright/test' | ||
import type { Compute } from './ts' | ||
|
||
export function waitForCondition( | ||
conditionFn: () => boolean, | ||
{ | ||
checkInterval = 100, | ||
timeout = 10000, | ||
errorMessage = 'Condition was not met within the specified time.', | ||
} = {} | ||
): Promise<void> { | ||
return new Promise((resolve, reject) => { | ||
const startTime = Date.now() | ||
|
||
const interval = setInterval(() => { | ||
try { | ||
if (conditionFn()) { | ||
clearInterval(interval) | ||
resolve() | ||
} else if (Date.now() - startTime >= timeout) { | ||
clearInterval(interval) | ||
reject(new Error(errorMessage)) | ||
} | ||
} catch (error) { | ||
clearInterval(interval) | ||
reject(error) | ||
} | ||
}, checkInterval) | ||
}) | ||
} | ||
|
||
type FillOptions = Compute<Parameters<Page['fill']>[2]> | ||
|
||
export async function fillAndBlur( | ||
page: Page, | ||
selector: string, | ||
text: string, | ||
options: FillOptions = {} | ||
) { | ||
await page.fill(selector, text, options) | ||
// Remove focus so the onChange event is triggered | ||
await page.evaluate( | ||
(args) => { | ||
const input = document.querySelector(args.selector) as HTMLElement | ||
if (input) { | ||
input.blur() | ||
} | ||
}, | ||
{ selector } | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Compute<T> = { [K in keyof T]: T[K] } & {} |
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
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
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
Oops, something went wrong.