-
Notifications
You must be signed in to change notification settings - Fork 1
SWIS-333: Update account page to be language agnostic
#571
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
Merged
clarissarichard
merged 96 commits into
SWIS-300/language-agnostic-landing
from
SWIS-333/language-agnostic-account
Apr 6, 2026
Merged
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
5d21741
Begin to update personal page so language agnostic
clarissarichard 1e76b53
Update rest of personal page tests
clarissarichard 82ed42d
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 9047985
Merge branch 'SWIS-317/language-agnostic-personal' of https://github.…
clarissarichard 6c55c43
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 79ac2cd
Merge tests
clarissarichard 872d568
Merge branch 'SWIS-317/language-agnostic-personal' of https://github.…
clarissarichard 0c1fe54
Update address page to be language agnostic
clarissarichard 87a3a27
Update e2e tests
clarissarichard 25de907
Remove error messages
clarissarichard 727ac27
Remove error messages
clarissarichard f57bd6d
Add string back to error message locators
clarissarichard 7582b78
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 2deb32c
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard 8ff4591
Combine small tests
clarissarichard a6f00ef
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 55a9f49
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 52d385d
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 31d0e33
Update new Trans component
clarissarichard 62b05da
Add missing chained locator
clarissarichard 3e47473
Add chained locators
clarissarichard ad7ecee
Merge branch 'main' into SWIS-321/language-agnostic-alt
clarissarichard 2230df8
Fix brackets
clarissarichard 35bcb5a
Resolve conflicts
clarissarichard ed9e103
Resolve conflicts
clarissarichard da83990
Resolve conflicts
clarissarichard fd04116
Update alternate address tests
clarissarichard 4ead112
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard 742e203
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 8268664
Update to strings
clarissarichard 0bf2369
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard a3f5464
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 5df5979
Update test name
clarissarichard ad6d215
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard 6a77d8a
Resolve conflicts
clarissarichard f196829
Add spinner checks
clarissarichard 0afb930
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 3273e4a
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 9a62b4e
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard ba023fd
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard baa8b91
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 792cc6e
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard 07ad404
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 9457afa
Update address verification tests
clarissarichard b0d7f22
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 3b23762
Fix import
clarissarichard dca402b
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard 5f9e6ca
Reorder imports
clarissarichard 5270e42
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 97c7303
Merge branch 'SWIS-321/language-agnostic-alt' into SWIS-303/language-…
clarissarichard 9d9004b
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 4eef429
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard a16e0cd
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 117088a
Update locator
clarissarichard fd4f819
Merge branch 'SWIS-321/language-agnostic-alt' into SWIS-303/language-…
clarissarichard 5b2d407
Resolve conflicts
clarissarichard df5e3f1
Resolve conflicts
clarissarichard db82eb5
Resolve conflicts
clarissarichard 8b3c361
Resolve conflicts
clarissarichard fc5a15a
Update translations
clarissarichard facb5dc
Update translations
clarissarichard e762883
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 0bc3a9c
Merge branch 'SWIS-321/language-agnostic-alt' into SWIS-303/language-…
clarissarichard c140069
Update locators
clarissarichard b3192e3
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 93f2dc7
Fix tests
clarissarichard 4c9f724
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 19777d1
Merge branch 'SWIS-317/language-agnostic-personal' into SWIS-318/lang…
clarissarichard bf0f51b
Lint
clarissarichard 943bb12
Merge branch 'SWIS-318/language-agnostic-address' into SWIS-321/langu…
clarissarichard 3c5b372
Merge branch 'SWIS-321/language-agnostic-alt' into SWIS-303/language-…
clarissarichard 147e8f9
Merge branch 'SWIS-303/language-agnostic-verif' into SWIS-333/languag…
clarissarichard dfc99a5
Lint
clarissarichard 5031115
Fix link
clarissarichard f356ec2
Update e2e tests
clarissarichard 47ac36b
Resolve conflicts
clarissarichard 21e7558
Uncomment personal tests
clarissarichard 48d8ed0
Resolve conflicts
clarissarichard 4c6f28a
Merge branch 'SWIS-300/language-agnostic-landing' into SWIS-317/langu…
clarissarichard 62d8c1f
Resolve conflicts
clarissarichard 0074d5f
Resolve conflicts
clarissarichard 2f0d170
Resolve conflicts
clarissarichard e43f503
Resolve conflicts
clarissarichard 6155447
Add status to mock username API and refactor
clarissarichard 1c80ae6
Resolve some conflicts
clarissarichard 0a19b9b
Resolve remaining conflicts
clarissarichard 9405fba
Restore error messages
clarissarichard a6917b2
Separate banner text
clarissarichard 59e0fec
Resolve conflicts
clarissarichard b93baf2
Uncomment alternate address in NY tests
clarissarichard ff9d7bf
Merge branch 'SWIS-321/language-agnostic-alt' into SWIS-303/language-…
clarissarichard e29bae9
Resolve conflicts
clarissarichard 4940ab3
Resolve conflicts
clarissarichard 3eed85d
Remove provideAddress
clarissarichard 626f619
Update link and username message locators
clarissarichard f197fcc
Pass in lang
clarissarichard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { Page, Locator } from "@playwright/test"; | ||
| import { ERROR_MESSAGES } from "../utils/constants"; | ||
| import { apiTranslations } from "../../src/data/apiMessageTranslations"; | ||
| import { apiErrorTranslations } from "../../src/data/apiErrorMessageTranslations"; | ||
|
|
||
| export class AccountPage { | ||
| readonly page: Page; | ||
|
|
@@ -29,78 +30,121 @@ export class AccountPage { | |
| readonly nextButton: Locator; | ||
| readonly previousButton: Locator; | ||
|
|
||
| constructor(page: Page) { | ||
| constructor(page: Page, appContent?: any, lang?: string) { | ||
| this.page = page; | ||
|
|
||
| const required = appContent?.required || "required"; | ||
| const withRequired = (label: string) => `${label} (${required})`; | ||
|
|
||
| this.mainHeading = page.getByRole("heading", { | ||
| name: "Apply for a Library Card Online", | ||
| name: appContent?.banner?.title || "Apply for a Library Card Online", | ||
| level: 1, | ||
| }); | ||
| this.stepHeading = page.getByRole("heading", { | ||
| name: "Step 4 of 5: Customize your account", | ||
| name: appContent?.account?.title || "Step 4 of 5: Customize your account", | ||
| level: 2, | ||
| }); | ||
| this.usernameInput = page.getByRole("textbox", { | ||
| name: "Username (required)", | ||
| name: withRequired(appContent?.account?.username?.label || "Username"), | ||
| exact: true, | ||
| }); | ||
| this.usernameError = page.getByText(ERROR_MESSAGES.USERNAME_INVALID); | ||
| this.usernameError = page.getByText( | ||
| appContent?.account?.errorMessage?.username || | ||
| "There was a problem. Username must be between 5-25 alphanumeric characters." | ||
| ); | ||
| this.availableUsernameButton = page.getByRole("button", { | ||
| name: "Check if username is available", | ||
| name: | ||
| appContent?.account?.username?.checkButton || | ||
| "Check if username is available", | ||
| exact: true, | ||
| }); | ||
| 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." | ||
| ); | ||
|
Comment on lines
61
to
69
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Toxiapo simpler than I thought it would be! |
||
| this.passwordInput = page.getByRole("textbox", { | ||
| name: "Password (required)", | ||
| name: withRequired(appContent?.account?.password?.label || "Password"), | ||
| exact: true, | ||
| }); | ||
| this.passwordError = page.getByText(ERROR_MESSAGES.PASSWORD_INVALID); | ||
| this.passwordError = page.getByText( | ||
| appContent?.account?.errorMessage?.password || | ||
| "There was a problem. Your password must be at least 8 characters, include a mixture of both uppercase and lowercase letters, include a mixture of letters and numbers, and have at least one special character except period (.)" | ||
| ); | ||
| this.verifyPasswordInput = page.getByRole("textbox", { | ||
| name: "Verify password (required)", | ||
| name: withRequired( | ||
| appContent?.account?.verifyPassword?.label || "Verify password" | ||
| ), | ||
| exact: true, | ||
| }); | ||
| this.verifyPasswordError = page.getByText( | ||
| ERROR_MESSAGES.VERIFY_PASSWORD_INVALID | ||
| appContent?.account?.errorMessage?.verifyPassword || | ||
| "There was a problem. The two passwords don't match." | ||
| ); | ||
| this.showPasswordCheckbox = page.getByRole("checkbox", { | ||
| name: "Show password", | ||
| }); | ||
| this.showPasswordCheckboxLabel = page.getByText("Show password", { | ||
| exact: true, | ||
| name: appContent?.account?.showPassword || "Show password", | ||
| }); | ||
| this.showPasswordCheckboxLabel = page.getByText( | ||
| appContent?.account?.showPassword || "Show password", | ||
| { | ||
| exact: true, | ||
| } | ||
| ); | ||
| this.homeLibraryHeading = page.getByRole("heading", { | ||
| name: "Home library", | ||
| name: appContent?.account?.library?.title || "Home library", | ||
| level: 3, | ||
| exact: true, | ||
| }); | ||
| this.nyplLocationLink = page.getByRole("link", { | ||
| name: "NYPL location", | ||
| name: | ||
| appContent?.account?.library?.description?.nyplLocation || | ||
| "NYPL location", | ||
| }); | ||
| this.selectHomeLibrary = page.getByLabel("Select a home library:"); | ||
| this.homeLibraryError = page.getByText(ERROR_MESSAGES.HOME_LIBRARY_ERROR); | ||
| this.selectHomeLibrary = page.getByLabel( | ||
| appContent?.account?.library?.selectLibrary || "Select a home library:" | ||
| ); | ||
| this.homeLibraryError = page.getByText( | ||
| appContent?.account?.errorMessage?.homeLibraryCode || | ||
| "There was a problem. Please select a home library." | ||
| ); | ||
| this.cardholderTerms = page.getByRole("link", { | ||
| name: "Cardholder Terms and Conditions", | ||
| name: | ||
| appContent?.account?.termsAndCondition?.termsConditions || | ||
| "Cardholder Terms and Conditions", | ||
| }); | ||
| this.rulesRegulations = page.getByRole("link", { | ||
| name: "Rules and Regulations", | ||
| name: | ||
| appContent?.account?.termsAndCondition?.rulesRegulations || | ||
| "Rules and Regulations", | ||
| }); | ||
| this.privacyPolicy = page.locator("#mainContent").getByRole("link", { | ||
| name: | ||
| appContent?.account?.termsAndCondition?.privacyPolicy || | ||
| "Privacy Policy", | ||
| }); | ||
| this.privacyPolicy = page | ||
| .locator("#mainContent") | ||
| .getByRole("link", { name: "Privacy Policy" }); | ||
| this.acceptTermsCheckbox = page.getByRole("checkbox", { | ||
| name: "Yes, I accept the terms and conditions.", | ||
| name: | ||
| appContent?.account?.termsAndCondition?.label || | ||
| "Yes, I accept the terms and conditions.", | ||
| }); | ||
| this.acceptTermsCheckboxLabel = page.getByText( | ||
| "Yes, I accept the terms and conditions." | ||
| appContent?.account?.termsAndCondition?.label || | ||
| "Yes, I accept the terms and conditions." | ||
| ); | ||
| this.acceptTermsError = page.getByText(ERROR_MESSAGES.ACCEPT_TERMS_ERROR); | ||
| this.nextButton = page.getByRole("button", { name: "Next", exact: true }); | ||
| this.acceptTermsError = page.getByText( | ||
| appContent?.account?.errorMessage?.acceptTerms || | ||
| "There was a problem. The Terms and Conditions must be checked." | ||
| ); | ||
| this.nextButton = page.getByRole("button", { | ||
| name: appContent?.button?.next || "Next", | ||
| exact: true, | ||
| }); | ||
| this.previousButton = page.getByRole("link", { | ||
| name: "Previous", | ||
| name: appContent?.button?.previous || "Previous", | ||
| exact: true, | ||
| }); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nice!