Update JS tests to rely on visibility_state.