Areas of seafront designated for bathing have been polluted, tests have found.