Skip to content

Refactor ui tests to use @testing-library - #5355

Merged
jkongie merged 7 commits into
developfrom
use-react-testing-library
Nov 5, 2021
Merged

Refactor ui tests to use @testing-library#5355
jkongie merged 7 commits into
developfrom
use-react-testing-library

Conversation

@jkongie

@jkongie jkongie commented Nov 3, 2021

Copy link
Copy Markdown
Contributor

Replaces enzyme with @testing-library/react to provide an easier to use testing library.

With this library we are now testing what the user interacts with in the UI.

This commit does not change any implementation logic and is purely focused on refactoring the tests.

@jkongie
jkongie marked this pull request as draft November 3, 2021 16:49
@github-actions

github-actions Bot commented Nov 3, 2021

Copy link
Copy Markdown
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@jkongie
jkongie force-pushed the use-react-testing-library branch 2 times, most recently from b44167d to 6ee7924 Compare November 3, 2021 23:18
@jkongie
jkongie marked this pull request as ready for review November 4, 2021 06:18
@jkongie jkongie added the ready for review PR is ready for code review label Nov 4, 2021
@cl-homu

cl-homu commented Nov 4, 2021

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #5360) made this pull request unmergeable. Please resolve the merge conflicts.

Comment thread package.json
"**/sha3": "^2.0.7",
"**/solc": "^0.6.4",
"**/source-map-support": "0.5.16",
"**/yargs-parser": "^15.0.1",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No longer needed as all sub dependencies now resolve to versions which include the vulnerability patch

Comment thread operator_ui/package.json
Comment thread operator_ui/src/PrivateRoute.test.js
Comment thread operator_ui/src/components/BaseLink.test.tsx Outdated
Comment thread operator_ui/src/components/BaseLink.test.tsx Outdated
Comment thread operator_ui/src/pages/Bridges/Index.test.js Outdated
@jkongie
jkongie force-pushed the use-react-testing-library branch from 1901656 to 7edf5b2 Compare November 5, 2021 11:44
Comment thread operator_ui/src/pages/Jobs/New.test.tsx Outdated
Comment on lines +62 to +63
// const jobSpec2 =
// 'observationSource = """ ds [type=ds]; ds_parse [type=ds_parse]; ds_multiply [type=ds_multiply]; """'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't have commented out code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This has been uncommented now because it is used in the fixed test

Comment thread operator_ui/src/pages/Jobs/New.test.tsx Outdated
Comment on lines +77 to +84
// This tests the update of the textbox but it doesn't currently work
// userEvent.paste(getByRole('textbox', { name: /TOML blob/i }), jobSpec2)

// expect(
// await findByText('ds_multiple', {}, { timeout: 1000 }),
// ).toBeInTheDocument()
// expect(await findByText('ds_parse')).toBeInTheDocument()
// expect(await findByText('ds')).toBeInTheDocument()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't have commented out code. Also, why doesn't it work? 🙂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah I spent too long on this one and was meant to circle back to it but I totally blanked on it. I've fixed it now

})
.finally(() => {
setLoading(false)
setValid(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this change? It seems like only doing setLoading(false) on error would not disable loading state on success?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was part of my debugging of tests that I was meant to come back to. Thanks for picking that up

Comment thread operator_ui/src/pages/Notifications.test.js
Comment thread operator_ui/support/test-utils.tsx Outdated
@jkongie
jkongie merged commit becbb0f into develop Nov 5, 2021
@jkongie
jkongie deleted the use-react-testing-library branch November 5, 2021 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PR is ready for code review S-waiting-on-author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants