-
Notifications
You must be signed in to change notification settings - Fork 367
Convert user form to React #8916
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
base: master
Are you sure you want to change the base?
Conversation
2ae26b7 to
4a1034b
Compare
a959e72 to
ffd13db
Compare
444bd81 to
0b91982
Compare
|
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
f181f47 to
55e116c
Compare
|
as mentioned elsewhere, passing |
d34575a to
63b757b
Compare
d37ccfd to
6335671
Compare
|
This pull request is not mergeable. Please rebase and repush. |
6335671 to
d49dcce
Compare
d49dcce to
0cdfa47
Compare
|
Yay. can @elsamaryv merge, or do you need someone else to pull the trigger? |
|
@kbrock I don't think Elsa has merge rights, but also although this pr should be good I was hoping @asirvadAbrahamVarghese can fix the cypress specs first before merging |
|
Let’s try this out: GilbertCherrie#1 |
cd3a66e to
2a03fb0
Compare
2a03fb0 to
aa71eee
Compare
eb75a30 to
4029110
Compare
Co-authored-by: asirvadAbrahamVarghese <Asirvad.Abraham.Varghese@ibm.com> * Rebase to master and fix suggestions * Fix cypress specs
4029110 to
0071f31
Compare
| }); | ||
|
|
||
| afterEach(() => { | ||
| cy.appDbState('restore'); |
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.
Ok, the last remaining sporadic failures, other than the API version of the "undefined method downcase for nil" error caused by API requests overwriting session data used by UI requests, is that the prior navigation appears to NOT wait until the ajax report data is completed.
[----] I, [2025-11-13T11:46:07.004931#58401:f78a0] INFO -- development: Started POST "/ops/accordion_select?id=rbac_accord" for 127.0.0.1 at 2025-11-13 11:46:07 -0500
[----] I, [2025-11-13T11:46:07.016137#58401:f78a0] INFO -- development: Completed 200 OK in 9ms (Views: 0.1ms | ActiveRecord: 3.3ms (10 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:07.461390#58401:f7904] INFO -- development: Started POST "/ops/tree_select?id=xx-u&text=Users" for 127.0.0.1 at 2025-11-13 11:46:07 -0500
[----] I, [2025-11-13T11:46:07.470827#58401:f7904] INFO -- development: Completed 200 OK in 7ms (Views: 0.3ms | ActiveRecord: 1.7ms (6 queries, 0 cached) | GC: 0.6ms)
[----] I, [2025-11-13T11:46:07.492197#58401:f7904] INFO -- development: Started POST "/ops/report_data" for 127.0.0.1 at 2025-11-13 11:46:07 -0500
[----] I, [2025-11-13T11:46:07.505602#58401:f7904] INFO -- development: Completed 200 OK in 11ms (Views: 0.1ms | ActiveRecord: 2.3ms (15 queries, 7 cached) | GC: 0.7ms)
[----] I, [2025-11-13T11:46:07.735820#58401:ef830] INFO -- development: Started POST "/ops/x_button?pressed=rbac_user_add" for 127.0.0.1 at 2025-11-13 11:46:07 -0500
[----] I, [2025-11-13T11:46:07.743649#58401:ef830] INFO -- development: Completed 200 OK in 6ms (Views: 0.2ms | ActiveRecord: 1.6ms (5 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:07.767126#58401:ef830] INFO -- development: Started GET "/api/groups?&expand=resources" for 127.0.0.1 at 2025-11-13 11:46:07 -0500
[----] I, [2025-11-13T11:46:07.784709#58401:ef830] INFO -- development: Completed 200 OK in 15ms (Views: 0.0ms | ActiveRecord: 2.3ms (10 queries, 0 cached) | GC: 2.7ms)
[----] I, [2025-11-13T11:46:11.422267#58401:d598] INFO -- development: Started POST "/api/users" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.454612#58401:d598] INFO -- development: Completed 200 OK in 30ms (Views: 0.0ms | ActiveRecord: 19.0ms (13 queries, 1 cached) | GC: 0.8ms)
[----] I, [2025-11-13T11:46:11.560890#58401:d598] INFO -- development: Started GET "/ops/" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.566759#58401:d598] INFO -- development: Completed 302 Found in 4ms (ActiveRecord: 0.9ms (5 queries, 0 cached) | GC: 0.2ms)
[----] I, [2025-11-13T11:46:11.572127#58401:d598] INFO -- development: Started GET "/ops/explorer" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.609155#58401:d598] INFO -- development: Completed 200 OK in 35ms (Views: 17.0ms | ActiveRecord: 6.6ms (21 queries, 2 cached) | GC: 1.7ms)
[----] I, [2025-11-13T11:46:11.797388#58401:d598] INFO -- development: Started GET "/ws/notifications" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.799345#58401:d598] INFO -- development: Started GET "/ws/notifications" [WebSocket] for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.802006#58401:f7990] INFO -- development: Started GET "/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc&limit=100" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] I, [2025-11-13T11:46:11.813063#58401:f7990] INFO -- development: Completed 200 OK in 8ms (Views: 0.0ms | ActiveRecord: 2.2ms (9 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:11.914043#58401:f7990] INFO -- development: Started POST "/__e2e__/command" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
[----] D, [2025-11-13T11:46:11.916749#58401:f7990] DEBUG -- development: [Cypress] Running db_state restore
[----] I, [2025-11-13T11:46:11.916802#58401:f7990] INFO -- development: [Cypress] DatabaseCleaner restoring
### ^^^ restore started
[----] I, [2025-11-13T11:46:11.940843#58401:f7904] INFO -- development: Started POST "/ops/report_data" for 127.0.0.1 at 2025-11-13 11:46:11 -0500
### ^^^ likely an ajax request comes in late
[----] I, [2025-11-13T11:46:11.958555#58401:f7904] INFO -- development: Completed 200 OK in 15ms (Views: 0.1ms | ActiveRecord: 3.5ms (17 queries, 7 cached) | GC: 0.3ms)
[----] D, [2025-11-13T11:46:12.175919#58401:f7990] DEBUG -- development: output: [null]
### ^^^ restore finished
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.
another example, after rbac_user_add:
[----] I, [2025-11-13T11:46:50.460788#58401:f7990] INFO -- development: Started POST "/ops/x_button?pressed=rbac_user_add" for 127.0.0.1 at 2025-11-13 11:46:50 -0500
[----] I, [2025-11-13T11:46:50.470693#58401:f7990] INFO -- development: Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 1.9ms (5 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:50.516137#58401:f7990] INFO -- development: Started GET "/api/groups?&expand=resources" for 127.0.0.1 at 2025-11-13 11:46:50 -0500
[----] I, [2025-11-13T11:46:50.537965#58401:f7990] INFO -- development: Completed 200 OK in 19ms (Views: 0.0ms | ActiveRecord: 7.2ms (10 queries, 0 cached) | GC: 0.9ms)
[----] I, [2025-11-13T11:46:54.993852#58401:f78a0] INFO -- development: Started POST "/api/users" for 127.0.0.1 at 2025-11-13 11:46:54 -0500
[----] I, [2025-11-13T11:46:55.010451#58401:f78a0] INFO -- development: Completed 200 OK in 14ms (Views: 0.0ms | ActiveRecord: 4.0ms (13 queries, 1 cached) | GC: 0.5ms)
[----] I, [2025-11-13T11:46:55.194157#58401:f78a0] INFO -- development: Started GET "/ops/" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.202310#58401:f78a0] INFO -- development: Completed 302 Found in 5ms (ActiveRecord: 1.0ms (5 queries, 0 cached) | GC: 0.2ms)
[----] I, [2025-11-13T11:46:55.207715#58401:f78a0] INFO -- development: Started GET "/ops/explorer" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.247468#58401:f78a0] INFO -- development: Completed 200 OK in 37ms (Views: 15.6ms | ActiveRecord: 9.6ms (21 queries, 2 cached) | GC: 1.8ms)
[----] I, [2025-11-13T11:46:55.527006#58401:f7904] INFO -- development: Started GET "/ws/notifications" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.528850#58401:f7904] INFO -- development: Started GET "/ws/notifications" [WebSocket] for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.529619#58401:d598] INFO -- development: Started GET "/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc&limit=100" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.541627#58401:d598] INFO -- development: Completed 200 OK in 8ms (Views: 0.0ms | ActiveRecord: 2.1ms (9 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:55.647140#58401:d598] INFO -- development: Started POST "/__e2e__/command" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] D, [2025-11-13T11:46:55.649438#58401:d598] DEBUG -- development: [Cypress] Running db_state restore
[----] I, [2025-11-13T11:46:55.649470#58401:d598] INFO -- development: [Cypress] DatabaseCleaner restoring
[----] I, [2025-11-13T11:46:55.682052#58401:ef830] INFO -- development: Started POST "/ops/report_data" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
### ^^^ Another request comes in while database cleaner is restoring
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.
another a few steps after rbac_user_add:
[----] I, [2025-11-13T11:46:00.874134#58401:ef830] INFO -- development: Started POST "/ops/x_button?pressed=rbac_user_add" for 127.0.0.1 at 2025-11-13 11:46:00 -0500
[----] I, [2025-11-13T11:46:00.888017#58401:ef830] INFO -- development: Completed 200 OK in 12ms (Views: 0.1ms | ActiveRecord: 3.8ms (5 queries, 0 cached) | GC: 0.1ms)
[----] I, [2025-11-13T11:46:00.899298#58401:ef830] INFO -- development: Started GET "/api/groups?&expand=resources" for 127.0.0.1 at 2025-11-13 11:46:00 -0500
[----] I, [2025-11-13T11:46:00.917305#58401:ef830] INFO -- development: Completed 200 OK in 16ms (Views: 0.2ms | ActiveRecord: 2.4ms (10 queries, 0 cached) | GC: 0.4ms)
[----] I, [2025-11-13T11:46:04.357093#58401:d598] INFO -- development: Started POST "/api/users" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.394063#58401:d598] INFO -- development: Completed 200 OK in 34ms (Views: 2.6ms | ActiveRecord: 7.9ms (13 queries, 1 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:04.483768#58401:d598] INFO -- development: Started GET "/ops/" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.490381#58401:d598] INFO -- development: Completed 302 Found in 4ms (ActiveRecord: 1.0ms (5 queries, 0 cached) | GC: 0.1ms)
[----] I, [2025-11-13T11:46:04.496137#58401:d598] INFO -- development: Started GET "/ops/explorer" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.569298#58401:d598] INFO -- development: Completed 200 OK in 71ms (Views: 31.2ms | ActiveRecord: 23.0ms (21 queries, 2 cached) | GC: 0.8ms)
[----] I, [2025-11-13T11:46:04.744412#58401:d598] INFO -- development: Started GET "/ws/notifications" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.746594#58401:d598] INFO -- development: Started GET "/ws/notifications" [WebSocket] for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.748616#58401:f7904] INFO -- development: Started GET "/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc&limit=100" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.760454#58401:f7904] INFO -- development: Completed 200 OK in 7ms (Views: 0.0ms | ActiveRecord: 1.8ms (9 queries, 0 cached) | GC: 0.0ms)
[----] I, [2025-11-13T11:46:04.813573#58401:f7904] INFO -- development: Started POST "/__e2e__/command" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] D, [2025-11-13T11:46:04.816051#58401:f7904] DEBUG -- development: [Cypress] Running db_state restore
[----] I, [2025-11-13T11:46:04.816074#58401:f7904] INFO -- development: [Cypress] DatabaseCleaner restoring
[----] I, [2025-11-13T11:46:04.831803#58401:f7990] INFO -- development: Started POST "/ops/report_data" for 127.0.0.1 at 2025-11-13 11:46:04 -0500
[----] I, [2025-11-13T11:46:04.847168#58401:f7990] INFO -- development: Completed 200 OK in 12ms (Views: 0.1ms | ActiveRecord: 2.4ms (17 queries, 7 cached) | GC: 0.0ms)
[----] D, [2025-11-13T11:46:05.033555#58401:f7904] DEBUG -- development: output: [null]
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.
Ultimately, I think the restore needs to have a global lock preventing other threads from handling requests while it's restoring but in the short term, I believe if we track down the sequence here, we can probably resolve the issue in this cypress test by ensuring the report_data intercept and wait is done. cc @asirvadAbrahamVarghese
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.
Note, I used this grep to search my logs for the output above:
grep -E "Started|Completed|output:|Cypress" log/development.log
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.
After discussing it today, we need to intercept and wait on ajax requests. If we use Rack::Lock, there's still a chance thread 1 starts test teardown by doing the restore, but then when it finishes, the remaining ajax request then comes in through thread 2... that could cause the next test to fail if it wasn't expected that activity. So, the current test needs to wait on the POST "/ops/report_data", perhaps only when adding a user, before moving on to ensure it's run before the test teardown and within the correct test.
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.
@asirvadAbrahamVarghese let me know if you're able to track down the missing intercepts. I think the Rack::Lock solution is an incomplete solution since we could still have these ajax requests processed AFTER the test that caused them
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, [2025-11-13T11:46:50.460788#58401:f7990] INFO -- development: Started POST "/ops/x_button?pressed=rbac_user_add" for 127.0.0.1 at 2025-11-13 11:46:50 -0500
[----] I, [2025-11-13T11:46:50.470693#58401:f7990] INFO -- development: Completed 200 OK in 7ms (Views: 0.1ms | ActiveRecord: 1.9ms (5 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:50.516137#58401:f7990] INFO -- development: Started GET "/api/groups?&expand=resources" for 127.0.0.1 at 2025-11-13 11:46:50 -0500
[----] I, [2025-11-13T11:46:50.537965#58401:f7990] INFO -- development: Completed 200 OK in 19ms (Views: 0.0ms | ActiveRecord: 7.2ms (10 queries, 0 cached) | GC: 0.9ms)
[----] I, [2025-11-13T11:46:54.993852#58401:f78a0] INFO -- development: Started POST "/api/users" for 127.0.0.1 at 2025-11-13 11:46:54 -0500
[----] I, [2025-11-13T11:46:55.010451#58401:f78a0] INFO -- development: Completed 200 OK in 14ms (Views: 0.0ms | ActiveRecord: 4.0ms (13 queries, 1 cached) | GC: 0.5ms)
[----] I, [2025-11-13T11:46:55.194157#58401:f78a0] INFO -- development: Started GET "/ops/" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.202310#58401:f78a0] INFO -- development: Completed 302 Found in 5ms (ActiveRecord: 1.0ms (5 queries, 0 cached) | GC: 0.2ms)
[----] I, [2025-11-13T11:46:55.207715#58401:f78a0] INFO -- development: Started GET "/ops/explorer" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.247468#58401:f78a0] INFO -- development: Completed 200 OK in 37ms (Views: 15.6ms | ActiveRecord: 9.6ms (21 queries, 2 cached) | GC: 1.8ms)
[----] I, [2025-11-13T11:46:55.527006#58401:f7904] INFO -- development: Started GET "/ws/notifications" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.528850#58401:f7904] INFO -- development: Started GET "/ws/notifications" [WebSocket] for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.529619#58401:d598] INFO -- development: Started GET "/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc&limit=100" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] I, [2025-11-13T11:46:55.541627#58401:d598] INFO -- development: Completed 200 OK in 8ms (Views: 0.0ms | ActiveRecord: 2.1ms (9 queries, 0 cached) | GC: 0.3ms)
[----] I, [2025-11-13T11:46:55.647140#58401:d598] INFO -- development: Started POST "/__e2e__/command" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
[----] D, [2025-11-13T11:46:55.649438#58401:d598] DEBUG -- development: [Cypress] Running db_state restore
[----] I, [2025-11-13T11:46:55.649470#58401:d598] INFO -- development: [Cypress] DatabaseCleaner restoring
[----] I, [2025-11-13T11:46:55.682052#58401:ef830] INFO -- development: Started POST "/ops/report_data" for 127.0.0.1 at 2025-11-13 11:46:55 -0500
### ^^^ Another request comes in while database cleaner is restoring
Seeing this 🔝 I am just guessing here, given our current test's flow, the DB restore shouldn’t fire right after/close to adding a user, it probably happened because the test failed due to some reason after add-user event fired and then afterEach hook ran with restore.
So, the current test needs to wait on the POST "/ops/report_data", perhaps only when adding a user, before moving on to ensure it's run before the test teardown and within the correct test.
From the add-user action, these are the requests that get fired. I just tried matching them globally - cy.intercept('*').as('allCalls'); and then forced the test to fail.

So there are other requests besides the /ops/report_data one, these other requests could also end up coming in late right?
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.
So there are other requests besides the
/ops/report_dataone, these other requests could also end up coming in late right?
Yes, I think you're right. If they are ajax requests that come in and not done sequentially, these other requests could be handled in a thread after the test finished and could be in the teardown.
Rack::Lock would help to ensure we don't process concurrent requests in puma, but that just means they could possibly be processed AFTER the afterEach/teardown is done. We would have to intercept and wait on each OR, if one of them is guaranteed to be fired and processed last, we'd need to do just that one.
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.
FYI, I was seeing something similar in the tenant tests. I debugged it and found that we had missing intercepts/waits and in the case of the edit form, there were two API requests to wait on. The add form had a single API wait to do.


Fixes: #6903 and #6904
Converted user form to React and added Cypress tests for the form.
Before:
Edit Admin User Form:




Add User Form:
Edit User Form:
Copy User Form:
After:
Edit Admin User Form:




Add User Form:
Edit User Form:
Copy User Form: