fiddle icon indicating copy to clipboard operation
fiddle copied to clipboard

test: migrate `Editors` tests to RTL

Open erikian opened this issue 1 year ago • 1 comments

Ref: #1408.

erikian avatar Aug 04 '24 02:08 erikian

Coverage Status

coverage: 80.201% (+0.04%) from 80.161% when pulling dc72c782727614e9521c8e8615341e1ded1672ba on test/rtl-editors-component into 714aca9132225469f213a14a7fb87f8c277e480b on main.

coveralls avatar Aug 04 '24 02:08 coveralls

There's an additional change in there to avoid relying on the order of the editors when checking for the toolbars.

The proposed change checks if the rendered toolbars that we just got from the document with getAllByRole are still in the document, which should always be true, so we wouldn't be able to tell if some of the expected toolbars is missing.

I replaced that with a lookup for the specific toolbar titles inside the toolbars that are present in the document, which should also eliminate any issues with ordering. We could also just check if we have a certain number of toolbars (or any number larger than 0) if we don't want to hard-code the toolbar titles.

erikian avatar Jul 29 '25 12:07 erikian

@erikian, after your most recent changes, is TestIdContainer still needed here?

dsanders11 avatar Jul 29 '25 18:07 dsanders11

@erikian, after your most recent changes, is TestIdContainer still needed here?

It's not needed in editors.tsx — removed. I'm keeping it around for welcome-tour.tsx, though, since that component was already using a testid anyway and we'll probably need to resort to testid again at some point.

erikian avatar Jul 30 '25 11:07 erikian