What are some good data setup strategies when using Cypress or Playwright?

So I haven’t used either of these tools yet, and whats holding me back is the complex data setup requirements needed for the application I’m testing and whether these tools can cope with it.

E.g. Testing a button loads a list, that is only visible after you have done X, Y and Z.

You could write your cypress or playwright test, and maybe it works with the data you have at that moment in time, but what about testing all the negative scenarios? What if the data changes?

I currently use selenium with C#, and because it’s the same language binding as our server side code I can import all the models/dto’s that are used for creating data. It’s then relatively straight forward to call an api or modify a database record.

This would be possible in node/javascript as well, but would involve re-writing all our models/dto’s to match those on the server. As well as being time consuming it would be susceptible to typo’s. Also the object tree for some of our dto’s that are used in api calls can be quite deep, with upwards of 100 fields used in any one api request. You can see how this might start to get unmanageable.

This must be something others have encountered? What are some good data setup and teardown strategies? Most real world testing scenarios must go beyond the simple click here, click there type stuff that these tools start you with.

Many thanks,