If you are going to take a ferry to Finland, we would 100% recommend doing the test onboard the ferry. The cost is 39 euros (with cash or card), payable on the ferry itself, or purchased ahead of time. It is also possible to do the antigen test in the Port of Tallinn, though not fully recommended because you have to arrive earlier and wait for the results. If you take the ferry, you have to wait there 2-3 hours anyway, and you don’t have to go out of your way.