When can I take a test?

I’ve been super nervous and stressed. My period was due on August 4 and it hasn’t come, so I’m now 3 days late and I’m super nervous because I had protected sex twice (once on July 31 and the second time on August 2)....

I’ve been experiencing clear discharge for the past two days and I’m so nervous because I don’t know what to do. How soon can I take a test?