Rambam's Laws of Testimony 9:8 (written about 800 years ago) describe disqualification for testimony (eidut) due to mental instability. He writes:
The epileptic is disqualified when having a seizure, but valid when not having a seizure; this assumes that when he is not having a seizure, he is completely mentally competent; as some epileptics have mixed-up minds all the time ...
Any guess what modern medical condition the latter would be? (My understanding is that there are many different types of epilepsy out there.)