One basic test, with pg_sleep (works OK)
Use a wait_for function instead of just pg_sleep