How many days before

How many days before your period are you supposed to take a pregnancy test? My period is due in nine days when can I test? ♥️♥️