Say I want to assert that a certain option menu is displayed in the front-end of a project. The menu is on screen X and I have to first select data in Y to get to X. Now, it doesn't matter at all what data I select in Y, it will always lead to X.
But sometimes, depending on the data, I will get a screen Z which I can just skip through. Now obviously, if I write the test in a deterministic manner the test may fail if the data I selected leads to screen Z.
The data I'm talking about is test data, set up before every test to the same state. So theoretically, I could just select one data entry that I know will not go to screen Z.
But, I could also simply include a check to see if I'm on screen Z after selecting the data and skip Z. Now, even changes to the test data (though rare, it happens) would not break my test.
Somehow I don't like this approach but I can't really explain why. Adding a method to check for Z would add a (probably) "useless" method to my test framework.
So my question is, are branches to handle conditional behaviour that is not being tested in that specific test okay? Are there any problems with this approach? Is it good to do this?