-
Notifications
You must be signed in to change notification settings - Fork 10
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
[risk=low][RW-9199] Upgrade React to v17 #7167
Conversation
39241da
to
aeb22a6
Compare
e2e failures make me suspicious that the react-switch change is the problem. I'll try reverting. |
our original version of react-switch (4.1.0) continues to work fine here, so hopefully this resolves the e2e failures. |
6 e2e failures... trying again but not feeling confident |
4 e2e failures: 3 of
and 1 similar error:
I'm assuming these are real errors, and reverting to Draft |
The e2e tests have caught a product failure: the Add Criteria button no longer works with this upgrade. From some brief debugging, I see that cohort-criteria-menu's |
This might be why: https://blog.saeloun.com/2021/07/08/react-17-event-delagation.html |
* */ | ||
await applicationListDropdown.evaluate(b => b.click()) | ||
const applicationListDropdown = await page.waitForSelector('#application-list-dropdown') | ||
await applicationListDropdown.click() |
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.
is this change applicable elsewhere in e2ev2?
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.
No, I do not believe so. It seems like the user-create-test was doing something similar. I ended up switching this to the approach that I found there, and it worked. Keeping that change for consistency.
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.
Github won't let me Approve because I'm still the author of this PR :)
But everything I've seen makes sense. Thanks for putting in all this work!
When making side-by-side comparisons I do still see some styling differences (though some are improvements) and I have some ideas about how to proceed there, but it's a longer discussion. I would prefer not to merge just yet.
version "16.9.14" | ||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.14.tgz#674b8f116645fe5266b40b525777fc6bb8eb3bcd" | ||
integrity sha512-FIX2AVmPTGP30OUJ+0vadeIFJJ07Mh1m+U0rxfgyW34p3rTlXI+nlenvAxNn4BP36YyI9IJ/+UJ7Wu22N1pI7A== | ||
"@types/react-dom@^17": |
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.
these resolutions are looking much better, 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.
Solid.
e2ev2/src/circle-run-tests.sh
Outdated
@@ -31,8 +31,7 @@ set +e | |||
export FAILED_TESTS_LOG=failed-tests.txt | |||
# This should do the right thing. If $FAILED_TESTS is empty, nothing is specified, so Jest runs | |||
# all tests. | |||
yarn test $FAILED_TESTS \ | |||
--reporters=jest-silent-reporter --reporters=./src/failure-reporter.js |
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.
Failure reporter is needed to ensure re-runs don't run every test again. I think you should revert this and we can isolate it into its own PR.
e2ev2/tests/user-create.test.js
Outdated
await page.waitForFunction(() => | ||
document.querySelector('[role="button"][aria-label="Next"]').style.cursor !== 'not-allowed') | ||
|
||
await page.click( '[role="button"][aria-label="Next"]') |
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.
Consider:
await page.waitForFunction(() => | |
document.querySelector('[role="button"][aria-label="Next"]').style.cursor !== 'not-allowed') | |
await page.click( '[role="button"][aria-label="Next"]') | |
await Promise.resolve('[role="button"][aria-label="Next"]').then(sel => { | |
page.waitForFunction(sel => document.querySelector(sel).style.cursor !== 'not-allowed', sel) | |
return sel | |
}).then(sel => page.click(sel)) |
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.
I like it. Thanks.
@@ -133,6 +133,8 @@ it('should reset role value & options when institution is selected', async () => | |||
originalEvent: undefined, | |||
value: 'Broad', | |||
target: { name: '', id: '', value: 'Broad' }, | |||
stopPropagation: () => {}, | |||
preventDefault: () => {}, |
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.
Consider something like:
const eventDefaults = {stopPropagation: () => undefined, preventDefault: () => undefined}
// ...
institutionDropdown.props.onChange({...eventDefaults,
originalEvent: undefined,
value: 'Broad',
target: { name: '', id: '', value: 'Broad' },
})
Updated to React 17.
React 17 makes changes to how event delegation works.
This change to event delegation necessitated that we upgrade to at least Prime React 7, because this is the earliest version that handles event delegation in a way that is compatible with React 17.
Updating our version of PrimeReact involved updating the Growl component to the Toast Component, changing how dropdown's attach their options to the dom, and adjusting many tests to account for selector discrepancies.
PR checklist