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

feat: user experience improvements and e2e test coverage #321

Merged
merged 6 commits into from
Jan 16, 2025
Merged

Conversation

aeneasr
Copy link
Member

@aeneasr aeneasr commented Dec 20, 2024

This patch resolves several issues:

  • Adds test IDs to components used by e2e selectors
  • Transports the return URL across flows (login/registration, recovery) and also when restarting flows (this should solve a lot of pain for users running into errors).

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

@aeneasr aeneasr force-pushed the improve-ux-2 branch 3 times, most recently from 1f21254 to 8deedd6 Compare January 15, 2025 22:24
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 40.47619% with 50 lines in your changes missing coverage. Please review.

Project coverage is 42.80%. Comparing base (f3fad4d) to head (39a6367).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
+ Coverage   42.43%   42.80%   +0.37%     
==========================================
  Files         136      138       +2     
  Lines        2008     2065      +57     
  Branches      288      303      +15     
==========================================
+ Hits          852      884      +32     
- Misses       1149     1172      +23     
- Partials        7        9       +2     
Components Coverage Δ
@ory/elements-react 37.44% <40.47%> (+0.65%) ⬆️
@ory/nextjs 65.97% <ø> (ø)

@jonas-jonas
Copy link
Member

Also, this change makes the init flow helper available to consumers: #326 wdyt about that?

@aeneasr
Copy link
Member Author

aeneasr commented Jan 16, 2025

The PR here is working for all flows, #326 is not. I recommend just merging this PR as it's been open long enough, and really doesn't change a lot of functionality except for fixing all the holes with e2e tests.

#326 did not run against the cloud e2e tests i've been working on, and I don't have enough time to spend to rebase it all. So let's get this one here through, and then we can still apply the missing pieces to #326 and merge those improvements.

@aeneasr aeneasr enabled auto-merge (rebase) January 16, 2025 09:38
@aeneasr aeneasr merged commit f2e4023 into main Jan 16, 2025
8 of 11 checks passed
@aeneasr aeneasr deleted the improve-ux-2 branch January 16, 2025 09:39
Comment on lines +50 to +55
// Login has a special case where we only have one method. Here, we
// do not want to display the chooser.
const authMethods = nodesToAuthMethodGroups(flow.flow.ui.nodes)
if (authMethods.length === 1) {
return { current: "method_active", method: authMethods[0] }
}
Copy link
Member

Choose a reason for hiding this comment

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

This leads to this screen being shown if code is the only option for the user.

And in that case, we either need to auto submit the flow to then immediately show the code input, or do show the method selector so that the user can trigger the code sending.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point! I think auto-submit is the way to go. Ideally, this would be solved in kratos' identifier first

Copy link
Member

Choose a reason for hiding this comment

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

Yea, actually I don't think we should work around this in Elements and just fix it in Kratos. So for now, let's show the method selector and fix it properly later in Kratos.

Copy link
Member Author

Choose a reason for hiding this comment

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

But only for the code method please, not for password etc.

Copy link
Member

Choose a reason for hiding this comment

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

flow: { request_url?: string; return_to?: string },
fallback: string,
) {
return flow.request_url || appendReturnTo(fallback, flow.return_to)
Copy link
Member

Choose a reason for hiding this comment

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

Why does this use the request_url? This URL is the callback URL for OIDC in account linking flows.

E.g. the user clicks on the "back button" in the flow, and is redirected back to the OIDC callback which leads to 404 (or similar).

Copy link
Member Author

Choose a reason for hiding this comment

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

It‘s needed for all other flows and probably needs a fix in kratos account linking

Copy link
Member

Choose a reason for hiding this comment

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

What is it needed for?

Copy link
Member Author

@aeneasr aeneasr Jan 29, 2025

Choose a reason for hiding this comment

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

It's needed to restart any flow (back button functionality, timeouts, flow errors, ...) and properly set return to urls, requested aal, refresh, and other query parameters

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.

2 participants