diff --git a/.changelog/1995.trivial.md b/.changelog/1995.trivial.md new file mode 100644 index 0000000000..cd49db04f3 --- /dev/null +++ b/.changelog/1995.trivial.md @@ -0,0 +1 @@ +Speedup CountdownButton in tests diff --git a/src/app/components/CountdownButton/index.tsx b/src/app/components/CountdownButton/index.tsx index e93804c5a0..9cf3c344d6 100644 --- a/src/app/components/CountdownButton/index.tsx +++ b/src/app/components/CountdownButton/index.tsx @@ -6,13 +6,16 @@ export const CountdownButton = (props: Omit) => const isDisabled = countdown > 0 useEffect(() => { - const timerId = setInterval(() => { - setCountdown(prevCountdown => { - const newCount = prevCountdown - 1 - if (newCount <= 0) clearInterval(timerId) - return newCount - }) - }, 1000) + const timerId = setInterval( + () => { + setCountdown(prevCountdown => { + const newCount = prevCountdown - 1 + if (newCount <= 0) clearInterval(timerId) + return newCount + }) + }, + process.env.REACT_APP_E2E_TEST ? 200 : 1000, + ) return () => clearInterval(timerId) }, [])