Fixes #39492 - Replace enzyme test in SettingsTable, SettingsCell, SettingsName with RTL - #11084
Fixes #39492 - Replace enzyme test in SettingsTable, SettingsCell, SettingsName with RTL#11084kfamilonidis wants to merge 1 commit into
Conversation
e1f49e5 to
8f88452
Compare
|
@kfamilonidis please add more testing cases |
8f88452 to
c75b1ae
Compare
|
Added 4 more tests that check the settings table values (instead of row headers that was before) |
5ff80b6 to
aabfb44
Compare
SummaryGood migration across Critical (must fix before merge)
Suggestions (should fix)
Nice to have (optional)
Checklist gaps
|
3b36353 to
a38df2e
Compare
|
@Lukshio Replaced mock store with a real redux store. |
a38df2e to
a0b5b6f
Compare
| ) | ||
|
|
||
| async function extracted(text = '') { | ||
| const editButton = document.querySelector('button#http_proxy_except_list'); |
There was a problem hiding this comment.
Please use screen.getByRole instead of querySelector. Here and on line 110-120 and 190-191, as per the guideline https://github.com/theforeman/foreman/blob/develop/developer_docs/ui-testing-guidelines.asciidoc
| describe('SettingCell', () => | ||
| testComponentSnapshotsWithFixtures(SettingValue, fixtures)); | ||
| // Render the tooltip content inline instead of through the Popper, so the | ||
| // computed tooltipText can be asserted without hover/async teardown issues. |
There was a problem hiding this comment.
Please unmock with an afterEach here, as per https://github.com/theforeman/foreman/blob/develop/developer_docs/ui-testing-guidelines.asciidoc
| @@ -177,4 +166,75 @@ describe('SettingsTable', () => { | |||
| ); | |||
There was a problem hiding this comment.
On lines 100, 130, 141, 151, and 161 we have toHaveBeenCalledTimes which is incremented after every test. This approach is a bit fragile, imo. A better approach would be to use jest.clearAllMocks in between tests.
There was a problem hiding this comment.
@kfamilonidis this wasn't handled. Please make this change as well
There was a problem hiding this comment.
added the after each hook
There was a problem hiding this comment.
Yes, but the comment was about the use of toHaveBeenCalledTimes instead of toHaveBeenCalled and adding jest.clearAllMocks. Please use toHaveBeenCalled on those.
a0b5b6f to
496fe8e
Compare
| @@ -177,4 +166,75 @@ describe('SettingsTable', () => { | |||
| ); | |||
There was a problem hiding this comment.
@kfamilonidis this wasn't handled. Please make this change as well
496fe8e to
b04b819
Compare
| @@ -177,4 +166,75 @@ describe('SettingsTable', () => { | |||
| ); | |||
There was a problem hiding this comment.
Yes, but the comment was about the use of toHaveBeenCalledTimes instead of toHaveBeenCalled and adding jest.clearAllMocks. Please use toHaveBeenCalled on those.
…ttingsName with RTL
b04b819 to
b33407d
Compare
|
@Lukshio Good to go |
|
@Lukshio |
Fixes #39492: Replace enzyme test in SettingsTable, SettingsCell, SettingsName with RTL