export class LocatorTimeoutError extends Error {
constructor(locatorName: string, timeoutMs: number) {
super(Element '${locatorName}' did not appear within ${timeoutMs}ms);
this.name = "LocatorTimeoutError";
}
}async function safeClick(action: () => Promise<void>) {
try {
await action();
} catch (error) {
console.error("Action failed:", (error as Error).message);
throw error; // Re-throw to fail the test properly
} finally {
console.log("Cleanup executed");
}
}