Sorry, but where does it say that the random testing happened on the flight deck? I've only ever heard of it occurring at sign-on/flight planning.
Has happened to me twice. Both times on a turnaround the testing team came on board and DAMP tested all crew.
One occasion caused a delay, one did not.