You said that you want to check that it is fully working in order to be sold.
I don't think that checking for discharged capacitors would be part of that prep for sale...(?)
Typically, removing the power cord, and holding the power button for 15-20 seconds should hasten any discharge.
But, if you can boot up without issue, and the iMac seems to power off when you want it off, then the power circuitry is likely working good enough for you to say that "It works!" --- and caps discharge would not really need to be part of your criteria for deciding that the old iMac is working OK, so you wipe the drive, clean install some system, sell the iMac, and, done...
I suppose you want to check inside the iMac for dust build-up or other kinds of possible problems with foreign material, just inspecting, or maybe providing the possible next owner with a brand new SSD. In that case, you might disassemble enough that you need to remove the power supply... and there's always the good tip to avoid touching the open face of the power supply with your naked fingers. Follow that idea, if you have to remove the power supply for some reason. That's also an extension of the idea that you should treat those connections as if there is a fault in the power supply that prevents the cap discharge.
(You probably don't need to touch the power supply, just to check for cleanliness inside the iMac. Well, unless you suspect there's a problem with the power supply?)