Drupal allows writing tests for installation profiles. A profile can have sample content which is created during installation, like umami in Drupal core. Drupal allows writing tests for modules as well. A module can also have sample content which is created during installation or config import.
Drupal Testing Traits allows writing tests for an already installed site. A site with content types and content. You can write tests for the all the pages in your site in different viewports and test user interactions aka JavaScript tests.