Skip to content

SWIS-333: Update account page to be language agnostic#571

Open
clarissarichard wants to merge 96 commits intoSWIS-300/language-agnostic-landingfrom
SWIS-333/language-agnostic-account
Open

SWIS-333: Update account page to be language agnostic#571
clarissarichard wants to merge 96 commits intoSWIS-300/language-agnostic-landingfrom
SWIS-333/language-agnostic-account

Conversation

@clarissarichard
Copy link
Copy Markdown
Collaborator

@clarissarichard clarissarichard commented Feb 25, 2026

Notes

Noting that all commented tests will be resolved by the end before anything is merged to main! This will be a bit of a tedious thing to review - apologies in advance 😅

I'm going merge each PR incrementally into SWIS-300/language-agnostic-landing and merge that PR into main. Please let me know if y'all happen to know a better way to do this!

Description

  • Updates locators on account page to refer to translation keys
  • Adds for loop to account page tests to loop through languages

Tickets:

Motivation and Context

Updates Playwright tests to be language agnostic.

How Has This Been Tested?

Run npm run playwright

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Base automatically changed from SWIS-303/language-agnostic-verif to SWIS-300/language-agnostic-landing March 27, 2026 15:54
Copy link
Copy Markdown
Collaborator

@Toxiapo Toxiapo left a comment

Choose a reason for hiding this comment

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

One small question, otherwise looks great!

<Paragraph m={0}>
<Trans
i18nKey="account.termsAndCondition.text"
components={{ a: <Link variant="external" /> }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good catch. Link is the DSLink in this context, we just never alias it and we probably should for consistency.

If it's not too much work, could you update this and change the import at the top of the file? Thanks!

import { Checkbox, Link as DSLink } from "@nypl/design-system-react-components";

Comment on lines +60 to +61
.getByText("El nombre de usuario está disponible.") // replace when translation available
.or(page.getByText("This username is available."));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still not have the translation for this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ooh right, this was around the time of the translation investigation. I know we were looking into consolidating apiErrorMessageTranslations and apiMessageTranslation, so this was temporary. I've updated this with the current translation files and I'll tag you to confirm that's preferred!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, that makes sense.

this.page = page;

const required = appContent?.required || "required";
const withRequired = (label: string) => `${label} (${required})`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice!

Comment on lines +61 to +70
this.availableUsernameMessage = page
.getByText(apiTranslations["This username is available."].es)
.or(page.getByText(apiTranslations["This username is available."].en));
this.unavailableUsernameMessage = page
.getByText(
apiErrorTranslations[
"This username is unavailable. Please try another."
].es
)
.or(page.getByText("This username is unavailable. Please try another.")); // en not listed
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Toxiapo here are the updated locators referencing the API translation files. We may be able to pass in the lang in the AccountPage object to eliminate the need for the .es and .en, but I feel a bit hesitant changing the structure too much. Thoughts on this?

Comment on lines 61 to 69
this.availableUsernameMessage = page.getByText(
ERROR_MESSAGES.USERNAME_AVAILABLE
apiTranslations["This username is available."][lang] ||
"This username is available."
);
this.unavailableUsernameMessage = page.getByText(
ERROR_MESSAGES.USERNAME_UNAVAILABLE
apiErrorTranslations["This username is unavailable. Please try another."][
lang
] || "This username is unavailable. Please try another."
);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Toxiapo simpler than I thought it would be!

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