Closed keirbowden closed 7 years ago
There is no test context or auto rollback in this case as the tests are running on clientside, potentially doing multiple round trips to server if the actions are not mocked.
A couple of examples here and here refer to this.
We are also considering recommending and/or restricting execution of component tests to non active (DE, scratch, sandboxes etc.) orgs.
Hmmm. At one point I'm certain I wrote up the important caveat that there's no transaction wrapper or test context, and you should not perform DML in a test on existing data. Don't use in production. I'm not finding that passage, so I wonder if it got lost in a merge somewhere.
At any rate, you have the answer: Your tests have permanent effects. Run them accordingly. :-)
Cool - thanks.
It's not clear to me if the lightning tests run in a test context like the Apex unit tests do. By this I mean are any changes made to the database from the front end are rolled back rather than committed.
I wouldn't expect to be writing tests that have these kind of side effects, but there's always the chance that code changes underneath my tests and suddenly something that was locally cached is persisted.