mirror of
https://github.com/documenso/documenso.git
synced 2026-10-03 10:13:52 +10:00
Selecting password auth failed with a generic "Unauthorized" for users who signed up via OAuth or passkey, with no way to set one. Detect the missing password and email the existing reset link from the signing dialog and security settings. Require a 2FA code and rate limit update-password.
28 lines
828 B
TypeScript
28 lines
828 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
/**
|
|
* Wait for React to hydrate the element matching the given selector.
|
|
*
|
|
* Filling controlled inputs before hydration is racy since React resets them
|
|
* to their default values once it takes over the DOM. React attaches internal
|
|
* fiber keys to DOM nodes during hydration, so their presence is a reliable
|
|
* signal that the element is interactive.
|
|
*/
|
|
export const waitForHydration = async (page: Page, selector: string, timeout = 15_000) => {
|
|
await page.waitForSelector(selector, { timeout });
|
|
|
|
await page.waitForFunction(
|
|
(sel) => {
|
|
const element = document.querySelector(sel);
|
|
|
|
if (!element) {
|
|
return false;
|
|
}
|
|
|
|
return Object.keys(element).some((key) => key.startsWith('__reactFiber'));
|
|
},
|
|
selector,
|
|
{ timeout },
|
|
);
|
|
};
|