Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ricky2210's avatar

Rollback changes done by Selenium testing?

Is it possible to deploy the Database transaction trait and rollback changes by the Selenium test?

Eg: I have a test using Laracasts\Integrated package using the Selenium extension. The test uses Selenium to create a record by clicking and submitting a form. I'd like to rollback this changes once I finished with my assertion.

The DatabaseTransactions trait will not work here since once Selenium opens a browser that is considered a different "session" than the test class currently running.

0 likes
3 replies
ifpingram's avatar

Would not the DatabaseMigrations trait work instead as this migrates the database before each test?

ricky2210's avatar

It's a simple test involving multiple tables. I don't want to setup migrations just for this.

Please or to participate in this conversation.