if (page.hasAttribute(“Test”)) {…
is when you then decide to change boolean attribute Test to an enum attribute Environment with values Development, Test and Production.Because now you have to hunt down all the page.hasAttribute(“Test”) in your code and replace them with something different. And if your code is creepy enough you will miss one or two and something will break.
So you have to look very carefully whether you repeat the same checks. If you repeat a check in different places and it has some meaning, you should abstract it away.