-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(chore) Bump testing dependencies and fix test console warnings #855
Conversation
Size Change: -378 kB (-12%) 👏 Total Size: 2.71 MB
ℹ️ View Unchanged
|
@@ -205,7 +206,8 @@ describe('Configuration', () => { | |||
|
|||
renderConfiguration(); | |||
|
|||
const rowElement = (await screen.findByText('numberFingers')).closest('.cds--structured-list-row'); | |||
screen.findByText('numberFingers'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we have an await
before findBy*?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. LMFT.
}); | ||
|
||
it('should redirect to login if the application is Offline', async () => { | ||
(useConnectivity as jest.Mock).mockReturnValue(false); | ||
render(<RedirectLogout />); | ||
expect(navigate).toBeCalledWith({ to: '${openmrsSpaBase}/login' }); | ||
expect(navigate).toHaveBeenCalledWith({ to: '${openmrsSpaBase}/login' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://jestjs.io/docs/expect#tohavebeencalled
Since these 2 are an alias to one another, we might skip these changes, until I'm missing something. If I am, please correct me.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toBeCalledWith was deprecated.
Thanks @denniskigen for the awesome bumps and cleanups! 🚀 |
@@ -27,14 +27,14 @@ | |||
"coverage": "yarn test --coverage" | |||
}, | |||
"devDependencies": { | |||
"@jest/types": "^29.6.3", | |||
"@playwright/test": "1.39.0", | |||
"@playwright/test": "1.40.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docker file also should be updated when bumping playwright:
https://github.com/openmrs/openmrs-esm-core/blob/main/e2e/support/bamboo/playwright.Dockerfile#L1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, could you please handle that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a PR: #858
|
||
render(<App />); | ||
}); | ||
await act(async () => await promise); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denniskigen What's this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It creates a promise and waits for it to resolve. Waiting for the mocked promise simulates waiting for the asynchronous operation to complete. It's discussed here, among other approaches for fixing the 'not wrapped in act' warning.
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
I've bumped testing dependencies (
@playwright/test
,@testing-library/dom
,@testing-library/jest-dom
,@testing-library/react
,@testing-library/user-event
and typings for jest) to the latest versions. I've also fixed various warnings and errors in the test console output and replaced usages offireEvent
withuserEvent
.Screenshots
test-console-output-before.mp4
test-console-output.mp4
Related Issue
Other