You may remember the Apple slogan (that the company trademarked) that goes “there’s an app for that”. Now, there is one that can actually test for a phone’s water resistance. Though ironically in the context of this paragraph, the app is only available for Android phones.
The app in question is simply called Water Resistance Tester by Ray W. The test is also pretty simple. All you have to do is run the app, leave it alone for awhile, then press down on two parts of your phone’s screen when prompted.
The way it works is by using the barometer that some phones have, to help track vertical location. If the phone is sealed well enough for water resistance, this will build up pressure inside the phone, which the app will tell you about.
Ray W also has a post on Reddit detailing a number of scenarios where it will be useful. Most notably, if you’ve sent your phone for servicing or repair, you can use the app to check if the people doing that sealed the phone back up properly. If you have an old phone and suspect it’s no longer water resistant, the Water Resistance Tester app will also let you know.
All that being said, because it is a third party app, don’t expect it to be something you can use to get a warranty claim if your supposedly waterproof phone drowns. Even if phone makers these days tout their devices as waterproof, these have generally not been covered by warranty ever since Sony reversed its waterproof stance with the Xperia Z3 back in the day.