Convert the Cypress tests back to PHPUnit
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3541874. --> Reported by: [phenaproxima](https://www.drupal.org/user/205645) Related to !594 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Drupal CMS originally added end-to-end testing with Cypress during the 1.x development cycle. Adding Cypress involved a large number of internal infrastructure changes (to repo layout, DDEV config, CI, and so forth). </p> <p>Since then, the circumstances have changed and I think we should walk the decision back:</p> <ul> <li>Cypress slows our CI process down, because getting it bootstrapped means installing a large number of extra dependencies. At the time we added it, we had no PHPUnit functional JavaScript testing. That changed with the addition of the performance test, which requires WebDriver; we can now do PHPUnit functional JS tests just like regular non-JS PHPUnit tests.</li> <li>Within our local DDEV environment, there's not a ton of benefit to Cypress; since the DDEV containers are headless, you can't watch the tests happen in real time. You can make Cypress run through a remote X server connection, but that's clunky and hard to set up (and only works on machines which can run an X11 server on the host, like macOS and Linux).</li> <li>We chose Cypress largely because Experience Builder did. XB has since switched to Playwright, and they have <em>much</em> greater need for end-to-end testing in a Playwright or Cypress-like environment than we do, given the nature of XB's UI. Core has also settled on migrating to Playwright, which means we are the odd one out by continuing to use Cypress. Source: <a href="https://www.drupal.org/project/drupal/issues/3467492">https://www.drupal.org/project/drupal/issues/3467492</a></li> <li>We thought the use of Cypress would encourage more quality contribution, since writing tests could be done in a framework more familiar to many developers. That was before our direction changed to be more focused on site templates; now, having Cypress tests for our individual recipes is very clearly overkill. The use of Cypress did not appear to have any real effect on contribution, although that may well have more to do with the change in direction than the use of Cypress itself.</li> </ul> <p>There is still a place for end-to-end testing with a JavaScript-based framework, but I think it will need to center around site templates (including visual regression testing, which PHPUnit cannot do) and use Playwright, since we can borrow the underlying work XB already did for that. Our Cypress tests should be converted to PHPUnit functional JavaScript tests, and Playwright should be how we test our site templates in various ways, since those are more "complete sites" and therefore would benefit more from full-fledged end-to-end testing.</p>
issue