Skip to content
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

FIX: Partial Loading of Different Screen before the Login Alert Page upon Token Expiration #2683

Closed
wants to merge 17 commits into from

Conversation

Snehil-Shah
Copy link
Collaborator

@Snehil-Shah Snehil-Shah commented Jan 3, 2024

Fixes #2671

Summary

Upon login token expiration, the app now gracefully loads the Login expired alert, instead of partially loading a different page

Test Plan

I actually had some problem in reproducing the login token expiration behaviour in development.
So I took the approach of corrupting the Session's cookie from the devtools by changing the expiration date & renewal token ids to imitate token expiration.
This might be the reason the "Before" recording looks different (and worse) than the recording in the original issue.
I think it should work the same for actual token expiration in production as it relies on the function checkAuthStatusService which primarily checks for token expiration and it handles it pretty well.

I have attached video demos of this issue before & after this PR:

Before (watch till the end)
After

Snehil-Shah and others added 2 commits January 3, 2024 06:00
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 76.43%. Comparing base (0801e50) to head (ccbde71).

Files Patch % Lines
src/common/utils.ts 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2683      +/-   ##
==========================================
+ Coverage   76.41%   76.43%   +0.01%     
==========================================
  Files         299      299              
  Lines        9372     9390      +18     
  Branches     2024     2027       +3     
==========================================
+ Hits         7162     7177      +15     
- Misses       1572     1574       +2     
- Partials      638      639       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Snehil-Shah
Copy link
Collaborator Author

Snehil-Shah commented Jan 5, 2024

Updated Video Preview (Ignore the laggy interface, I am running it on a VM)

@kurund kurund self-requested a review January 10, 2024 09:28
@mdshamoon
Copy link
Member

Let's discuss this in the call tomorrow.

Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
@Snehil-Shah Snehil-Shah force-pushed the issue2671-Login-UI-Fixes branch from 638d650 to 321690e Compare February 1, 2024 18:40
@Snehil-Shah Snehil-Shah requested a review from mdshamoon February 9, 2024 06:18
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
@Snehil-Shah Snehil-Shah force-pushed the issue2671-Login-UI-Fixes branch from fed9601 to b5b5e52 Compare February 25, 2024 15:47
@kurund kurund removed their request for review March 1, 2024 07:14
Signed-off-by: Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com>
Copy link
Member

@mdshamoon mdshamoon left a comment

Choose a reason for hiding this comment

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

Please resolve merge conflicts and feedbacks. Otherwise looks good. Will merge after the changes are done

Comment on lines +112 to +113
// it('it should render <Login /> component and try to renew token if session has expired', async () => {
// vi.mock('services/AuthService', async (importOriginal) => {
Copy link
Member

Choose a reason for hiding this comment

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

Remove commented test case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mdshamoon I actually needed some help with that, this test and the test above it, are both correct. but I think their mocks are conflicting.
when I comment one of them out, the other one works (so the tests are definitely correct), but both of them don't work together, I tried to resetAllMocks beforeEach, but still am not able to make it work

Snehil-Shah and others added 3 commits March 24, 2024 09:42
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
@mdshamoon
Copy link
Member

@Snehil-Shah closing this in favor of #2829. Integration tests were not running against a forked branch. So created a separate branch with these changes. Overall looks good. Merging it after the tests run successfully.

FYI for the test case: vi.mock does not work specific to a test. It updates the module for the whole file. So if you used it twice it picks up the latest one for both the test cases. A better way is to use vi.spy which I have added in the PR.

@mdshamoon mdshamoon closed this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login: UI Fixes
3 participants