How do I protect myself when testing a PCB that involves an AC line?
An isolation transformer will make it safe to touch live, but definitely not live and neutral simultaneously.

Another option is a RCD (residual current device). I purchased a sensitive one which trips at 10mA leakage current to ground, which is safer than the 30mA one which protects the whole house. You will still get a large jolt if you touch the wires, but the RCD will protect your life.

It is also quite useful when using power tools outside: it did trip several times, and it turned out the extension cords had water inside the sockets, that kind of thing. It's a nice safety feature.

None of this protects against the big SPMS input cap, which is the most dangerous component, not only for electrocution, but also if it is shorted accidentally by something, there will be fireworks and bits of molten metal flying around, which is hazardous for eyes.

In the end, working on mains is all about state of mind, common sense and prevention: for example, if you only want to probe the low voltage side of the PCB, tape some insulating plastic sheet on the back of the PCB over the high voltage bits. Mylar photocopier transparent works well. Put some heatshrink over Wires when they're soldered to pins and other connectors, and basically make sure the amount of live exposed metal is kept to a minimum.

EDIT

Some RCD/GFCIs will also act as breakers and detect overcurrent, some won't and must be protected with a circuit breaker. You must check and use the proper combination. Those we use here for residential electric installations require properly dimensioned  circuit breakers.

(In France it is called a "differential breaker" because it measures the difference in currents flowing in Live/Neutral wires. The difference is leakage to Earth, so when it exceeds the threshold, it trips.)

Please note that some will detect DC leakage, some will only detect AC leakage, so if your AC is rectified by a SMPS for example, and you want to protect against a fault to ground after the rectifier, make sure you read the docs to pick the right protection device!

You can also get adjustable circuit breakers which are designed to protect motors. Anyway, for most electronic work, a 2A breaker should do the job just fine unless you're doing high power stuff.

About the order:

If you use an Isolation Transformer then the RCD will be useless. Suppose you touch one of the wires on the secondary: since the transformer provides isolation, no current will flow in your finger, thus the RCD will not trip. However if you touch both live and neutral on the secondary, the RCD will still not trip.

So the isolation transformer is a bit of a compromise. It makes it safer in a way, also you can use your scope to probe mains voltage without blowing it up... but you can't use a RCD.

Using a RCD without transformer means the RCD will trip if enough current runs through your finger, no matter if you touch one wire or live and neutral. So it's safer in a way (but you still get electrocuted a bit).

Also none protect against big capacitors charged to high voltages, which is why I put an emphasis on common sense and prevention...

For example, soldering test points (ie, bits of resistor legs) and then using the scope or multimeter grip tips on that means you don't have to hold the probes with one hand while looking at the scope and fiddling with it. It prevents the risk of having your probe slide, rip across the board and make a short...