ckeditor / ckeditor4-react

Official CKEditor 4 React component.
Other
95 stars 51 forks source link

Fix flaking tests #292

Closed MMMalik closed 1 year ago

MMMalik commented 1 year ago

Hi @jacekbogdanski,

as you noted, unit tests have recently started failing. There were no code nor tests changes since the last time CI was green, so it's really disturbing that this has happened. The only differences I noticed between these CI runs are:

I can reproduce failing tests locally as well.

I don't think it's related to Chrome versions (but I haven't tested though) and it's certainly not related to CKEditor versions (I've tested multiple older versions with the same result). My bet is that a newer version of some dependency must have been installed which introduced some subtle bugs to our setup. This is possible since the setup we use is quite exotic (Karma + Chrome + testing-library + async runtime loading of CKEditor dependencies) and proved to be "flaky" in the past.

While debugging I noticed that our testing setup now started to have troubles with proper cleanup of CKEditor instances between runs. This led to some inconsistencies in the assertions. I couldn't pinpoint the exact cause of that though.

Following mitigations have been applied:

The CI is green again ✅. E2E tests pass correctly and I've additionally tested samples manually. I haven't noticed any issues.

As a long term solution we might discuss a different approach to testing.