Skip to content

Conversation

@nevyangelova
Copy link
Contributor

Summary

Upgraded React from 16.14.0 to 18.2.0
Upgraded react-dom from 16.8.6 to 18.2.0
Upgraded react-redux from 7.2.9 to 8.1.3
Upgraded react-select from 3.2.0 to 5.10.0
Upgraded react-intl from 4.5.0 to 6.8.0
Removed Enzyme and migrated all tests to React Testing Library.
Updated Babel configuration for React 18 automatic JSX runtime.
Fixed react-select type imports for v5 compatibility.

Ticket Link

https://mattermost.atlassian.net/browse/MM-67214

@nevyangelova nevyangelova requested a review from a team as a code owner January 29, 2026 08:49
@nevyangelova nevyangelova added Work In Progress Not yet ready for review Do Not Merge Should not be merged until this label is removed labels Jan 29, 2026
@nevyangelova nevyangelova force-pushed the MM-67214-react-18-upgrade branch from 026919c to bb5cdbf Compare January 29, 2026 11:07
@nevyangelova nevyangelova force-pushed the MM-67214-react-18-upgrade branch from bb5cdbf to a4be6df Compare January 29, 2026 11:38
@nevyangelova nevyangelova added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester and removed Do Not Merge Should not be merged until this label is removed Work In Progress Not yet ready for review labels Jan 29, 2026
Comment on lines 49 to 54
let args = props.searchIssues.mock.calls[0][0];
expect(args).toEqual({
fields: 'customfield_10011',
jql: 'project=KT and issuetype=10000 ORDER BY updated DESC',
q: '',
instance_id: 'https://something.atlassian.net',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we lost the check for the args here and in the one below we are not checking for all of them?

);
});

expect(ref.current).toBeDefined();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check other elements directly? Seems that just checking that the component exists is lowering the quality of the test compared to snapshot

This applies to all cases below where the snapshot has been removed.

Copy link
Contributor Author

@nevyangelova nevyangelova Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issues are with internal validation that runs when the component is fully mounted. This is done when validator collects validation functions from child components. The issue is that with deep rendering child components register their validators and when handleCreate is called validation fails because the child components aren't fully set up.

The tests were designed for shallow rendering which doesn't run full lifecycle. I would propose to add new tests as we develop new features and fix bugs, as direct rewrite would be very difficult and time consuming atm. but if you think it can be prioritised I can do it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marianunez I updated what I could in order to replicate the old tests, I think I covered a pretty good chunk of them!

jest.clearAllMocks();
});

test('should match snapshot', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name should also be updated if no snapshots are being used

"react-redux": "7.2.9",
"react-select": "3.2.0",
"react-redux": "8.1.3",
"react-select": "5.10.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a large jump for the react-select so we need to make sure we have a testing pass on any dropdowns to check for any regressions here @ogi-m

Copy link
Contributor

@avasconcelos114 avasconcelos114 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple of comments of my own but I would +1 on the renaming tests that no longer are related to snapshot testing

I'll likely need to spend more time to look through the changes in the modal tests

When it comes to the data_selectors, considering they're basically HoCs that only change the search logic and value preselection, I agree that full rendering feels like way more trouble than it's worth at this stage -- though maybe we can have a backlog task added to add tests on the BackendSelector itself

Comment on lines 34 to 52
const renderWithRedux = (ui: React.ReactElement, initialState = defaultMockState) => {
const store = mockStore(initialState);
return {
store,
...render(
<IntlProvider locale='en'>
<Provider store={store}>{ui}</Provider>
</IntlProvider>,
),
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like these repeated instances of renderWithRedux could be replaced with the one that was added as a part of test-utils.tsx, or was there a reason for them to have their own declaration in here and jira_epic_selector.test.tsx (among others)?

Comment on lines 46 to 53
const mockTheme = {
centerChannelColor: '#333333',
centerChannelBg: '#ffffff',
buttonBg: '#166de0',
buttonColor: '#ffffff',
linkColor: '#2389d7',
errorTextColor: '#fd5960',
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is another thing that could be a constant provided by test utils to reduce repetition

@nevyangelova nevyangelova force-pushed the MM-67214-react-18-upgrade branch from 9526517 to caef7db Compare February 2, 2026 10:35
Copy link
Contributor

@avasconcelos114 avasconcelos114 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things are looking quite tidy now :) I think this leaves us in a good spot to continue bolstering the testing suite as we make new contributions

@nevyangelova
Copy link
Contributor Author

@marianunez @ogi-m kind reminder to review

@nevyangelova nevyangelova removed the 2: Dev Review Requires review by a core committer label Feb 6, 2026
Copy link

@ogi-m ogi-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ogi-m ogi-m removed the 3: QA Review Requires review by a QA tester label Feb 9, 2026
@ogi-m ogi-m added the 4: Reviews Complete All reviewers have approved the pull request label Feb 9, 2026
@nevyangelova nevyangelova merged commit 1eb57a2 into master Feb 9, 2026
10 of 11 checks passed
@nevyangelova nevyangelova deleted the MM-67214-react-18-upgrade branch February 9, 2026 14:59
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch MM-67214-react-18-upgrade

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4: Reviews Complete All reviewers have approved the pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants