You let them go to the bathroom but in such a way they're not together, and not allow students to return to items after the responses are submitted. You also don't allow them to leave until they have submitted a response to all presented items up to that point. Present items one at a time, require a response to one before presenting the next, and don't allow returns to previously presented and responded-to items.
If you wanted to be really thorough you'd timestamp everything and maybe offer different versions of the test to different students.