Skip to content

Commit 05fc510

Browse files
committed
test(journey): more changes to fix ci tests
1 parent 63dfb89 commit 05fc510

4 files changed

Lines changed: 14 additions & 28 deletions

File tree

TESTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ E2E tests require ForgeRock AM connection details. Set these in your environment
7373
| `VITE_FR_AM_COOKIE_NAME` | AM session cookie name |
7474
| `VITE_FR_OAUTH_PUBLIC_CLIENT` | OAuth 2.0 client ID |
7575
| `VITE_FR_REALM_PATH` | AM realm path |
76+
| `FR_AM_WELLKNOWN_URL` | AM wellknown URL |
7677

7778
## Linting
7879

core/journey/callbacks/select-idp/select-idp.svelte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@
5555
const socialProviders = callback
5656
.getProviders()
5757
.filter((provider) => provider.provider !== 'localAuthentication');
58-
59-
if (localAuthentication.length > 0) {
60-
// Assume that clicking "next" will indicate the user wants to use local authentication
58+
/**
59+
* If local authentication is available and the user hasn't selected a provider yet,
60+
* assume that clicking "next" will indicate the user wants to use local authentication.
61+
* Only set this default when the callback has no value; otherwise this can overwrite a
62+
* social-provider selection during re-renders.
63+
*/
64+
if (localAuthentication.length > 0 && !callback.getInputValue()) {
6165
callback.setProvider('localAuthentication');
6266
}
6367

core/journey/journey.store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,12 @@ export function initialize(): JourneyStore {
332332
// Handle GenericError case
333333
const genericError = result;
334334
const errorMessage =
335-
genericError.message ?? genericError.error ?? interpolate('unknownNetworkError');
335+
// Journey Client can surface non-2xx responses as a missing `data` payload.
336+
// When that happens on step submission (i.e., we have a `prevStep` context),
337+
// show the standard login failure message rather than a technical error.
338+
genericError.error === 'no_response_data' && context?.prevStep
339+
? interpolate('loginFailure')
340+
: genericError.message ?? genericError.error ?? interpolate('unknownNetworkError');
336341

337342
await restartJourney(errorMessage, context);
338343
}

core/journey/stages/stages.stories.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -361,30 +361,6 @@ export const FailureMessagesRenderingStep = {
361361
},
362362
};
363363

364-
export const BackToRegisterInteraction = {
365-
args: {
366-
...UsernamePassword.args,
367-
journey: {
368-
loading: false,
369-
pop: fn(),
370-
push: fn(),
371-
stack: writable([{ journey: 'Registration' }, { journey: 'Login' }]),
372-
},
373-
},
374-
play: async ({ canvasElement }) => {
375-
const canvas = within(canvasElement);
376-
377-
// This must be derived from `stack[n].journey`. If a regression reintroduces
378-
// legacy `tree:` stack entries, this button will fall back to the default label
379-
// and will no longer include "register".
380-
const backButton = canvas.getByRole('button', { name: /register/i });
381-
await expect(backButton).toBeVisible();
382-
383-
await fireEvent.click(backButton);
384-
await expect(BackToRegisterInteraction.args.journey.pop).toHaveBeenCalled();
385-
},
386-
};
387-
388364
export const ConfirmPasswordInteraction = {
389365
args: {
390366
...ConfirmPassword.argTypes,

0 commit comments

Comments
 (0)