A child can be left unattended in the bathtub once they reach around 5 years old but preferably 7 years old is when you can stop checking in on them and let them alone to bathe, shower or dress themselves.
I would never leave a child alone in the bathtub even at 5 or 6 years old without at least checking in on them every 5 minutes or so.
Even though they are capable of taking a bath themselves or showering they can still drown in the bathtub if they decide to go under the water etc.
So at least check in on them during the bath or shower even though they may not like it.
My mom would not leave me alone in the shower or bathtub until I was 8 years old and I used to be embarrassed by it but now I realize that she was just being a concerned parent making sure I was safe.
But as a general guideline you can usually leave a child alone in the bathtub or shower once they reach at least 5 years of age.
Never leave a child under 5 in the bathtub alone.