In a few tests running under
LightPlatformCodeInsightFixtureTestCase I started getting strange failures. If I run the single test class all pass. When I run a test suite of multiple test classes these 4 tests in one test class fail consistently. Including getting caret offset in editor > document text length.
These tests get document content to check results of actions. The same as all other tests in the class. The only difference is that the failing tests add
\n into the document text.
Tracing the document content showed that when run in a test suite document content after action modification was reverted to original content on creation, with modification time stamp becoming of -1.
More logging to see if I was cleaning up the editor and file too soon, I added trace on document content and time stamp right after creation and before cleanup. This somehow fixed the issue.
Now I get document text right after creating the file in my test cases and everything is back to normal.
The test initializes file/editor by using the fixture to configure from a file name and text:
// CAUTION: getting document char sequence seems to be needed, without it some tests have document
// content reverted to original after action has modified it causing tests to fail and caret
// offset to be out of sync with content, including > textLength()
Run time and other tests do not have an issue and this only started happening lately with snapshot build of community edition. Is this expected for documents in light platform tests?