diff --git a/playwright/pageobjects/account.page.ts b/playwright/pageobjects/account.page.ts
index ee786ae4..dd2a6ced 100644
--- a/playwright/pageobjects/account.page.ts
+++ b/playwright/pageobjects/account.page.ts
@@ -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."
);
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,
});
}
diff --git a/playwright/pageobjects/page-manager.page.ts b/playwright/pageobjects/page-manager.page.ts
index 52e12651..0eb3354e 100644
--- a/playwright/pageobjects/page-manager.page.ts
+++ b/playwright/pageobjects/page-manager.page.ts
@@ -39,7 +39,7 @@ export class PageManager {
}
get accountPage(): AccountPage {
- return new AccountPage(this.page);
+ return new AccountPage(this.page, this.appContent);
}
get reviewPage(): ReviewPage {
@@ -49,6 +49,7 @@ export class PageManager {
get congratsPage(): CongratsPage {
return new CongratsPage(this.page);
}
+
get globalComponents(): GlobalComponentsPage {
return new GlobalComponentsPage(this.page);
}
diff --git a/playwright/tests/e2e-tests/backward-navigation.spec.ts b/playwright/tests/e2e-tests/backward-navigation.spec.ts
index b5355659..5bb863cc 100644
--- a/playwright/tests/e2e-tests/backward-navigation.spec.ts
+++ b/playwright/tests/e2e-tests/backward-navigation.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
TEST_NYC_ADDRESS,
TEST_OOS_ADDRESS,
TEST_PATRON,
@@ -25,42 +25,42 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
pageManager = new PageManager(page, appContent);
});
- // test("navigates backward to landing without entering info", async ({
- // page,
- // }) => {
- // await test.step("begins at account page", async () => {
- // await page.goto(PAGE_ROUTES.ACCOUNT(lang));
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await expect(pageManager.accountPage.previousButton).toBeVisible();
- // await pageManager.accountPage.previousButton.click();
- // });
-
- // await test.step("navigates back to address verification page", async () => {
- // await expect(
- // pageManager.addressVerificationPage.stepHeading
- // ).toBeVisible();
- // await expect(
- // pageManager.addressVerificationPage.previousButton
- // ).toBeVisible();
- // await pageManager.addressVerificationPage.previousButton.click();
- // });
-
- // await test.step("navigates back to address page", async () => {
- // await expect(pageManager.addressPage.stepHeading).toBeVisible();
- // await expect(pageManager.addressPage.previousButton).toBeVisible();
- // await pageManager.addressPage.previousButton.click();
- // });
-
- // await test.step("navigates back to personal information page", async () => {
- // await expect(pageManager.personalPage.stepHeading).toBeVisible();
- // await expect(pageManager.personalPage.previousButton).toBeVisible();
- // await pageManager.personalPage.previousButton.click();
- // });
-
- // await test.step("navigates back to landing page", async () => {
- // await expect(pageManager.landingPage.applyHeading).toBeVisible();
- // });
- // });
+ test("navigates backward to landing without entering info", async ({
+ page,
+ }) => {
+ await test.step("begins at account page", async () => {
+ await page.goto(PAGE_ROUTES.ACCOUNT(lang));
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await expect(pageManager.accountPage.previousButton).toBeVisible();
+ await pageManager.accountPage.previousButton.click();
+ });
+
+ await test.step("navigates back to address verification page", async () => {
+ await expect(
+ pageManager.addressVerificationPage.stepHeading
+ ).toBeVisible();
+ await expect(
+ pageManager.addressVerificationPage.previousButton
+ ).toBeVisible();
+ await pageManager.addressVerificationPage.previousButton.click();
+ });
+
+ await test.step("navigates back to address page", async () => {
+ await expect(pageManager.addressPage.stepHeading).toBeVisible();
+ await expect(pageManager.addressPage.previousButton).toBeVisible();
+ await pageManager.addressPage.previousButton.click();
+ });
+
+ await test.step("navigates back to personal information page", async () => {
+ await expect(pageManager.personalPage.stepHeading).toBeVisible();
+ await expect(pageManager.personalPage.previousButton).toBeVisible();
+ await pageManager.personalPage.previousButton.click();
+ });
+
+ await test.step("navigates back to landing page", async () => {
+ await expect(pageManager.landingPage.applyHeading).toBeVisible();
+ });
+ });
test("retains user-entered info when navigating backward", async ({
page,
@@ -112,11 +112,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
).not.toBeVisible({ timeout: SPINNER_TIMEOUT });
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays review page and navigates back to account page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/e2e-edited.spec.ts b/playwright/tests/e2e-tests/e2e-edited.spec.ts
index 27b0deda..cb756a5b 100644
--- a/playwright/tests/e2e-tests/e2e-edited.spec.ts
+++ b/playwright/tests/e2e-tests/e2e-edited.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
// TEST_EDITED_PATRON,
TEST_OOS_ADDRESS,
TEST_PATRON,
@@ -88,11 +88,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
});
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("edits personal info on review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/e2e-partial.spec.ts b/playwright/tests/e2e-tests/e2e-partial.spec.ts
index b72afd29..f77defb7 100644
--- a/playwright/tests/e2e-tests/e2e-partial.spec.ts
+++ b/playwright/tests/e2e-tests/e2e-partial.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
// TEST_EDITED_ACCOUNT,
TEST_NYC_ADDRESS,
TEST_OOS_ADDRESS,
@@ -70,11 +70,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
});
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays error on review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
@@ -83,75 +83,75 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
// });
});
- // test("displays updated account info after editing addresses", async ({
- // page,
- // }) => {
- // await test.step("enters account information", async () => {
- // await page.goto(PAGE_ROUTES.ACCOUNT(lang));
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ test("displays updated account info after editing addresses", async ({
+ page,
+ }) => {
+ await test.step("enters account information", async () => {
+ await page.goto(PAGE_ROUTES.ACCOUNT(lang));
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
- // await test.step("edits address from review page", async () => {
- // await expect(pageManager.reviewPage.stepHeading).toBeVisible();
- // await pageManager.reviewPage.editAddressButton.click();
- // });
+ // await test.step("edits address from review page", async () => {
+ // await expect(pageManager.reviewPage.stepHeading).toBeVisible();
+ // await pageManager.reviewPage.editAddressButton.click();
+ // });
- // await test.step("enters home address", async () => {
- // await expect(pageManager.addressPage.stepHeading).toBeVisible();
- // await fillAddress(pageManager.addressPage, TEST_NYC_ADDRESS);
- // await pageManager.addressPage.nextButton.click();
- // await expect(pageManager.addressPage.spinner).not.toBeVisible({
- // timeout: SPINNER_TIMEOUT,
- // });
- // });
+ // await test.step("enters home address", async () => {
+ // await expect(pageManager.addressPage.stepHeading).toBeVisible();
+ // await fillAddress(pageManager.addressPage, TEST_NYC_ADDRESS);
+ // await pageManager.addressPage.nextButton.click();
+ // await expect(pageManager.addressPage.spinner).not.toBeVisible({
+ // timeout: SPINNER_TIMEOUT,
+ // });
+ // });
- // await test.step("skips alternate address", async () => {
- // await expect(
- // pageManager.alternateAddressPage.stepHeading
- // ).toBeVisible();
- // await pageManager.alternateAddressPage.nextButton.click();
- // await expect(pageManager.alternateAddressPage.spinner).not.toBeVisible({
- // timeout: SPINNER_TIMEOUT,
- // });
- // });
+ // await test.step("skips alternate address", async () => {
+ // await expect(
+ // pageManager.alternateAddressPage.stepHeading
+ // ).toBeVisible();
+ // await pageManager.alternateAddressPage.nextButton.click();
+ // await expect(pageManager.alternateAddressPage.spinner).not.toBeVisible({
+ // timeout: SPINNER_TIMEOUT,
+ // });
+ // });
- // await test.step("verifies home address", async () => {
- // await expect(
- // pageManager.addressVerificationPage.stepHeading
- // ).toBeVisible();
- // await pageManager.addressVerificationPage
- // .getHomeAddressOption(TEST_NYC_ADDRESS.street)
- // .click();
- // await pageManager.addressVerificationPage.nextButton.click();
- // await expect(
- // pageManager.addressVerificationPage.spinner
- // ).not.toBeVisible({
- // timeout: SPINNER_TIMEOUT,
- // });
- // });
+ // await test.step("verifies home address", async () => {
+ // await expect(
+ // pageManager.addressVerificationPage.stepHeading
+ // ).toBeVisible();
+ // await pageManager.addressVerificationPage
+ // .getHomeAddressOption(TEST_NYC_ADDRESS.street)
+ // .click();
+ // await pageManager.addressVerificationPage.nextButton.click();
+ // await expect(
+ // pageManager.addressVerificationPage.spinner
+ // ).not.toBeVisible({
+ // timeout: SPINNER_TIMEOUT,
+ // });
+ // });
- // await test.step("edits account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_EDITED_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ // await test.step("edits account information", async () => {
+ // await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ // await fillAccountInfo(pageManager.accountPage, TEST_EDITED_ACCOUNT);
+ // await pageManager.accountPage.nextButton.click();
+ // });
- // await test.step("displays updated account info on review page", async () => {
- // await expect(pageManager.reviewPage.stepHeading).toBeVisible();
- // await expect(
- // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.username)
- // ).toBeVisible();
- // await pageManager.reviewPage.showPasswordCheckboxLabel.click();
- // await expect(
- // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.password)
- // ).toBeVisible();
- // await expect(
- // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.homeLibrary)
- // ).toBeVisible();
- // });
- // });
+ // await test.step("displays updated account info on review page", async () => {
+ // await expect(pageManager.reviewPage.stepHeading).toBeVisible();
+ // await expect(
+ // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.username)
+ // ).toBeVisible();
+ // await pageManager.reviewPage.showPasswordCheckboxLabel.click();
+ // await expect(
+ // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.password)
+ // ).toBeVisible();
+ // await expect(
+ // pageManager.reviewPage.getText(TEST_EDITED_ACCOUNT.homeLibrary)
+ // ).toBeVisible();
+ // });
+ });
test("retains user-entered info after clicking breadcrumb", async ({
page,
@@ -205,11 +205,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
});
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays review page and verifies receive info checkbox is unchecked", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/nyc-e2e-mocked.spec.ts b/playwright/tests/e2e-tests/nyc-e2e-mocked.spec.ts
index 5a169a68..0213c3b7 100644
--- a/playwright/tests/e2e-tests/nyc-e2e-mocked.spec.ts
+++ b/playwright/tests/e2e-tests/nyc-e2e-mocked.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
// PATRON_TYPES,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
// TEST_BARCODE_NUMBER,
TEST_NYC_ADDRESS,
TEST_PATRON,
@@ -67,11 +67,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
await pageManager.addressVerificationPage.nextButton.click();
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/nyc-e2e.spec.ts b/playwright/tests/e2e-tests/nyc-e2e.spec.ts
index 1cc3cf7c..8fbb3d36 100644
--- a/playwright/tests/e2e-tests/nyc-e2e.spec.ts
+++ b/playwright/tests/e2e-tests/nyc-e2e.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -12,7 +12,7 @@ import {
// PATRON_TYPES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
TEST_NYC_ADDRESS,
TEST_PATRON,
} from "../../utils/constants";
@@ -90,11 +90,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
});
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays personal information on review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/nys-e2e-mocked.spec.ts b/playwright/tests/e2e-tests/nys-e2e-mocked.spec.ts
index 3306ce48..d56cf56c 100644
--- a/playwright/tests/e2e-tests/nys-e2e-mocked.spec.ts
+++ b/playwright/tests/e2e-tests/nys-e2e-mocked.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
// PATRON_TYPES,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
// TEST_BARCODE_NUMBER,
TEST_NYS_ADDRESS,
TEST_PATRON,
@@ -67,11 +67,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
await pageManager.addressVerificationPage.nextButton.click();
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/nys-e2e.spec.ts b/playwright/tests/e2e-tests/nys-e2e.spec.ts
index f369ca19..6d39f2a4 100644
--- a/playwright/tests/e2e-tests/nys-e2e.spec.ts
+++ b/playwright/tests/e2e-tests/nys-e2e.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -12,7 +12,7 @@ import {
// PATRON_TYPES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
TEST_NYS_ADDRESS,
TEST_PATRON,
} from "../../utils/constants";
@@ -100,11 +100,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
});
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays personal information on review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/oos-e2e-mocked.spec.ts b/playwright/tests/e2e-tests/oos-e2e-mocked.spec.ts
index d1dda9b4..76b9e8fd 100644
--- a/playwright/tests/e2e-tests/oos-e2e-mocked.spec.ts
+++ b/playwright/tests/e2e-tests/oos-e2e-mocked.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -9,7 +9,7 @@ import {
PAGE_ROUTES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
// TEST_BARCODE_NUMBER,
TEST_NYC_ADDRESS,
TEST_OOS_ADDRESS,
@@ -72,13 +72,18 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
.getAlternateAddressOption(TEST_NYC_ADDRESS.street)
.click();
await pageManager.addressVerificationPage.nextButton.click();
+ await expect(
+ pageManager.addressVerificationPage.spinner
+ ).not.toBeVisible({
+ timeout: SPINNER_TIMEOUT,
+ });
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/e2e-tests/oos-e2e.spec.ts b/playwright/tests/e2e-tests/oos-e2e.spec.ts
index e62cc2dd..7659b937 100644
--- a/playwright/tests/e2e-tests/oos-e2e.spec.ts
+++ b/playwright/tests/e2e-tests/oos-e2e.spec.ts
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";
import { PageManager } from "../../pageobjects/page-manager.page";
import {
- // fillAccountInfo,
+ fillAccountInfo,
fillAddress,
fillPersonalInfo,
} from "../../utils/form-helper";
@@ -11,7 +11,7 @@ import {
// PATRON_TYPES,
SPINNER_TIMEOUT,
SUPPORTED_LANGUAGES,
- // TEST_ACCOUNT,
+ TEST_ACCOUNT,
TEST_NYC_ADDRESS,
TEST_OOS_ADDRESS,
TEST_PATRON,
@@ -98,11 +98,11 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
).not.toBeVisible({ timeout: SPINNER_TIMEOUT });
});
- // await test.step("enters account information", async () => {
- // await expect(pageManager.accountPage.stepHeading).toBeVisible();
- // await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
- // await pageManager.accountPage.nextButton.click();
- // });
+ await test.step("enters account information", async () => {
+ await expect(pageManager.accountPage.stepHeading).toBeVisible();
+ await fillAccountInfo(pageManager.accountPage, TEST_ACCOUNT);
+ await pageManager.accountPage.nextButton.click();
+ });
// await test.step("displays personal information on review page", async () => {
// await expect(pageManager.reviewPage.stepHeading).toBeVisible();
diff --git a/playwright/tests/page-tests/account.spec.ts b/playwright/tests/page-tests/account.spec.ts
index d2e8a6cc..534cc702 100644
--- a/playwright/tests/page-tests/account.spec.ts
+++ b/playwright/tests/page-tests/account.spec.ts
@@ -2,166 +2,162 @@ import { test, expect } from "@playwright/test";
import { AccountPage } from "../../pageobjects/account.page";
import { fillAccountInfo } from "../../utils/form-helper";
import {
- ERROR_MESSAGES,
PAGE_ROUTES,
+ SUPPORTED_LANGUAGES,
TEST_ACCOUNT,
} from "../../utils/constants";
import { mockUsernameApi } from "../../utils/mock-api";
-test.beforeEach(async ({ page }) => {
- await page.goto(PAGE_ROUTES.ACCOUNT());
-});
-
-test.describe("displays all form elements on Account page", () => {
- test("displays all headings", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await expect(accountPage.mainHeading).toBeVisible();
- await expect(accountPage.stepHeading).toBeVisible();
- await expect(accountPage.homeLibraryHeading).toBeVisible();
- });
-
- test("displays username and password form", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await expect(accountPage.usernameInput).toBeVisible();
- await expect(accountPage.availableUsernameButton).toBeVisible();
- await expect(accountPage.passwordInput).toBeVisible();
- await expect(accountPage.verifyPasswordInput).toBeVisible();
- await expect(accountPage.showPasswordCheckboxLabel).toBeVisible();
- });
-
- test("displays home library form", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await expect(accountPage.nyplLocationLink).toBeVisible();
- await expect(accountPage.selectHomeLibrary).toBeVisible();
- await expect(accountPage.cardholderTerms).toBeVisible();
- await expect(accountPage.rulesRegulations).toBeVisible();
- await expect(accountPage.privacyPolicy).toBeVisible();
- await expect(accountPage.acceptTermsCheckboxLabel).toBeVisible();
- });
-
- test("displays next and previous buttons", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await expect(accountPage.nextButton).toBeVisible();
- await expect(accountPage.previousButton).toBeVisible();
- });
-
- test("opens links in new tab", async ({ page }) => {
- const accountPage = new AccountPage(page);
- const links = [
- accountPage.nyplLocationLink,
- accountPage.cardholderTerms,
- accountPage.rulesRegulations,
- accountPage.privacyPolicy,
- ];
- for (const link of links) {
- await expect(link).toHaveAttribute("target", "_blank");
- await expect(link).toHaveAttribute("rel", "nofollow noopener noreferrer");
- }
- });
-});
-
-test.describe("enters account information", () => {
- test("displays entered values in form fields", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await fillAccountInfo(accountPage, TEST_ACCOUNT);
- await expect(accountPage.usernameInput).toHaveValue(TEST_ACCOUNT.username);
- await accountPage.showPasswordCheckboxLabel.click();
- await expect(accountPage.passwordInput).toHaveValue(TEST_ACCOUNT.password);
- await expect(accountPage.verifyPasswordInput).toHaveValue(
- TEST_ACCOUNT.password
- );
- await expect(accountPage.selectHomeLibrary).toHaveValue(
- TEST_ACCOUNT.homeLibraryCode
- );
- await expect(accountPage.acceptTermsCheckbox).toBeChecked();
- });
-});
-
-test.describe("mocks API responses on account page", () => {
- test("displays username available message", async ({ page }) => {
- // mock the API call for username availability
- await mockUsernameApi(page, ERROR_MESSAGES.USERNAME_AVAILABLE);
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("AvailableUsername");
- await accountPage.availableUsernameButton.click();
- await expect(accountPage.availableUsernameMessage).toBeVisible();
- });
-
- test("displays username unavailable error message", async ({ page }) => {
- // mock the API call for username unavailability
- await mockUsernameApi(page, ERROR_MESSAGES.USERNAME_UNAVAILABLE);
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("UnavailableUsername");
- await accountPage.availableUsernameButton.click();
- await expect(accountPage.unavailableUsernameMessage).toBeVisible();
- });
-});
-
-test.describe("displays error messages", () => {
- test("displays errors for required fields", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("");
- await accountPage.passwordInput.fill("");
- await accountPage.selectHomeLibrary.click();
- await accountPage.nextButton.click();
- await expect(accountPage.usernameError).toBeVisible();
- await expect(accountPage.passwordError).toBeVisible();
- await expect(accountPage.homeLibraryError).toBeVisible();
- });
-
- test("displays error when special characters in username", async ({
- page,
- }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("User!@#");
- await accountPage.nextButton.click();
- await expect(accountPage.usernameError).toBeVisible();
- });
-
- test("displays error when non-Latin characters in username", async ({
- page,
- }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("用戶名用戶名");
- await accountPage.nextButton.click();
- await expect(accountPage.usernameError).toBeVisible();
- });
-
- test("displays error when passwords do not match", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("ValidUser1");
- await accountPage.passwordInput.fill("ValidPass1!");
- await accountPage.verifyPasswordInput.fill("DifferentPass1!");
- await accountPage.nextButton.click();
- await expect(accountPage.verifyPasswordError).toBeVisible();
- });
-
- test("displays error when terms are not accepted", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("ValidUser1");
- await accountPage.passwordInput.fill("ValidPass1!");
- await accountPage.verifyPasswordInput.fill("ValidPass1!");
- await accountPage.selectHomeLibrary.click();
- await accountPage.selectHomeLibrary.selectOption("vr");
- await accountPage.nextButton.click();
- await expect(accountPage.acceptTermsError).toBeVisible();
- });
-
- test("displays error with too many characters", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- await accountPage.passwordInput.fill("123456789012345678901234567890123");
- await accountPage.nextButton.click();
- await expect(accountPage.usernameError).toBeVisible();
- await expect(accountPage.passwordError).toBeVisible();
- });
-
- test("displays error with too few characters", async ({ page }) => {
- const accountPage = new AccountPage(page);
- await accountPage.usernameInput.fill("A");
- await accountPage.passwordInput.fill("1!");
- await accountPage.nextButton.click();
- await expect(accountPage.usernameError).toBeVisible();
- await expect(accountPage.passwordError).toBeVisible();
+for (const { lang, name } of SUPPORTED_LANGUAGES) {
+ test.describe(`account page tests in ${name} (${lang})`, () => {
+ let accountPage: AccountPage;
+ let appContent: any;
+
+ test.beforeEach(async ({ page }) => {
+ appContent = require(`../../../public/locales/${lang}/common.json`);
+ accountPage = new AccountPage(page, appContent, lang);
+ await page.goto(PAGE_ROUTES.ACCOUNT(lang));
+ });
+
+ test.describe("displays elements", () => {
+ test("displays headings and buttons", async () => {
+ await expect(accountPage.mainHeading).toBeVisible();
+ await expect(accountPage.stepHeading).toBeVisible();
+ await expect(accountPage.homeLibraryHeading).toBeVisible();
+ await expect(accountPage.nextButton).toBeVisible();
+ await expect(accountPage.previousButton).toBeVisible();
+ });
+
+ test("displays username and password form", async () => {
+ await expect(accountPage.usernameInput).toBeVisible();
+ await expect(accountPage.availableUsernameButton).toBeVisible();
+ await expect(accountPage.passwordInput).toBeVisible();
+ await expect(accountPage.verifyPasswordInput).toBeVisible();
+ await expect(accountPage.showPasswordCheckboxLabel).toBeVisible();
+ });
+
+ test("displays home library form", async () => {
+ await expect(accountPage.nyplLocationLink).toBeVisible();
+ await expect(accountPage.selectHomeLibrary).toBeVisible();
+ await expect(accountPage.cardholderTerms).toBeVisible();
+ await expect(accountPage.rulesRegulations).toBeVisible();
+ await expect(accountPage.privacyPolicy).toBeVisible();
+ await expect(accountPage.acceptTermsCheckboxLabel).toBeVisible();
+ });
+
+ test("confirms links open in new tab", async () => {
+ const links = [
+ accountPage.nyplLocationLink,
+ accountPage.cardholderTerms,
+ accountPage.rulesRegulations,
+ accountPage.privacyPolicy,
+ ];
+ for (const link of links) {
+ await expect(link).toHaveAttribute("target", "_blank");
+ await expect(link).toHaveAttribute(
+ "rel",
+ "nofollow noopener noreferrer"
+ );
+ }
+ });
+ });
+
+ test.describe("enters account information", () => {
+ test("displays entered values in form fields", async () => {
+ await fillAccountInfo(accountPage, TEST_ACCOUNT);
+ await expect(accountPage.usernameInput).toHaveValue(
+ TEST_ACCOUNT.username
+ );
+ await accountPage.showPasswordCheckboxLabel.click();
+ await expect(accountPage.passwordInput).toHaveValue(
+ TEST_ACCOUNT.password
+ );
+ await expect(accountPage.verifyPasswordInput).toHaveValue(
+ TEST_ACCOUNT.password
+ );
+ await expect(accountPage.selectHomeLibrary).toHaveValue(
+ TEST_ACCOUNT.homeLibraryCode
+ );
+ await expect(accountPage.acceptTermsCheckbox).toBeChecked();
+ });
+ });
+
+ test.describe("mocks API responses on account page", () => {
+ test("displays username available message", async ({ page }) => {
+ // mock the API call for username availability
+ await mockUsernameApi(page, "available");
+ await accountPage.usernameInput.fill("AvailableUsername");
+ await accountPage.availableUsernameButton.click();
+ await expect(accountPage.availableUsernameMessage).toBeVisible();
+ });
+
+ test("displays username unavailable error message", async ({ page }) => {
+ // mock the API call for username unavailability
+ await mockUsernameApi(page, "unavailable");
+ await accountPage.usernameInput.fill("UnavailableUsername");
+ await accountPage.availableUsernameButton.click();
+ await expect(accountPage.unavailableUsernameMessage).toBeVisible();
+ });
+ });
+
+ test.describe("displays error messages", () => {
+ test("displays errors for required fields", async () => {
+ await accountPage.usernameInput.fill("");
+ await accountPage.passwordInput.fill("");
+ await accountPage.selectHomeLibrary.click();
+ await accountPage.nextButton.click();
+ await expect(accountPage.usernameError).toBeVisible();
+ await expect(accountPage.passwordError).toBeVisible();
+ await expect(accountPage.homeLibraryError).toBeVisible();
+ });
+
+ test("displays error when special characters in username", async () => {
+ await accountPage.usernameInput.fill("User!@#");
+ await accountPage.nextButton.click();
+ await expect(accountPage.usernameError).toBeVisible();
+ });
+
+ test("displays error when non-Latin characters in username", async () => {
+ await accountPage.usernameInput.fill("用戶名用戶名");
+ await accountPage.nextButton.click();
+ await expect(accountPage.usernameError).toBeVisible();
+ });
+
+ test("displays error when passwords do not match", async () => {
+ await accountPage.usernameInput.fill("ValidUser1");
+ await accountPage.passwordInput.fill("ValidPass1!");
+ await accountPage.verifyPasswordInput.fill("DifferentPass1!");
+ await accountPage.nextButton.click();
+ await expect(accountPage.verifyPasswordError).toBeVisible();
+ });
+
+ test("displays error when terms are not accepted", async () => {
+ await accountPage.usernameInput.fill("ValidUser1");
+ await accountPage.passwordInput.fill("ValidPass1!");
+ await accountPage.verifyPasswordInput.fill("ValidPass1!");
+ await accountPage.selectHomeLibrary.click();
+ await accountPage.selectHomeLibrary.selectOption("vr");
+ await accountPage.nextButton.click();
+ await expect(accountPage.acceptTermsError).toBeVisible();
+ });
+
+ test("displays error with too many characters", async () => {
+ await accountPage.usernameInput.fill("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ await accountPage.passwordInput.fill(
+ "123456789012345678901234567890123"
+ );
+ await accountPage.nextButton.click();
+ await expect(accountPage.usernameError).toBeVisible();
+ await expect(accountPage.passwordError).toBeVisible();
+ });
+
+ test("displays error with too few characters", async () => {
+ await accountPage.usernameInput.fill("A");
+ await accountPage.passwordInput.fill("1!");
+ await accountPage.nextButton.click();
+ await expect(accountPage.usernameError).toBeVisible();
+ await expect(accountPage.passwordError).toBeVisible();
+ });
+ });
});
-});
+}
diff --git a/playwright/tests/page-tests/address-verification.spec.ts b/playwright/tests/page-tests/address-verification.spec.ts
index 58f29ec5..946d7def 100644
--- a/playwright/tests/page-tests/address-verification.spec.ts
+++ b/playwright/tests/page-tests/address-verification.spec.ts
@@ -58,7 +58,7 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
await fillAddress(pageManager.alternateAddressPage, TEST_NYC_ADDRESS);
await pageManager.alternateAddressPage.nextButton.click();
await expect(
- pageManager.addressVerificationPage.spinner
+ pageManager.alternateAddressPage.spinner
).not.toBeVisible({
timeout: SPINNER_TIMEOUT,
});
@@ -101,7 +101,7 @@ for (const { lang, name } of SUPPORTED_LANGUAGES) {
);
await pageManager.alternateAddressPage.nextButton.click();
await expect(
- pageManager.addressVerificationPage.spinner
+ pageManager.alternateAddressPage.spinner
).not.toBeVisible({
timeout: SPINNER_TIMEOUT,
});
diff --git a/playwright/tests/page-tests/review.spec.ts b/playwright/tests/page-tests/review.spec.ts
index f85379ad..2ee88c84 100644
--- a/playwright/tests/page-tests/review.spec.ts
+++ b/playwright/tests/page-tests/review.spec.ts
@@ -7,7 +7,6 @@ import {
fillPersonalInfo,
} from "../../utils/form-helper";
import {
- ERROR_MESSAGES,
PAGE_ROUTES,
SPINNER_TIMEOUT,
TEST_ACCOUNT,
@@ -244,7 +243,7 @@ test.describe("edits patron information on review page", () => {
test.describe("mocks API responses on review page", () => {
test("displays username available message", async ({ page }) => {
// mock the API call for username availability
- await mockUsernameApi(page, ERROR_MESSAGES.USERNAME_AVAILABLE);
+ await mockUsernameApi(page, "available");
const reviewPage = new ReviewPage(page);
await reviewPage.editAccountButton.click();
await reviewPage.usernameInput.fill("AvailableUsername");
@@ -254,7 +253,7 @@ test.describe("mocks API responses on review page", () => {
test("displays username unavailable error message", async ({ page }) => {
// mock the API call for username unavailability
- await mockUsernameApi(page, ERROR_MESSAGES.USERNAME_UNAVAILABLE);
+ await mockUsernameApi(page, "unavailable");
const reviewPage = new ReviewPage(page);
await reviewPage.editAccountButton.click();
await reviewPage.usernameInput.fill("UnavailableUsername");
diff --git a/playwright/utils/mock-api.ts b/playwright/utils/mock-api.ts
index ca25f611..4ad61352 100644
--- a/playwright/utils/mock-api.ts
+++ b/playwright/utils/mock-api.ts
@@ -2,10 +2,25 @@ import { Page } from "@playwright/test";
import { PATRON_TYPES } from "./constants";
import { AddressData } from "./types";
-export async function mockUsernameApi(page: Page, message: string) {
+export async function mockUsernameApi(
+ page: Page,
+ availability: "available" | "unavailable"
+) {
+ const usernameResponse = {
+ available: {
+ status: 200,
+ message: "This username is available.",
+ },
+ unavailable: {
+ status: 409,
+ message: "This username is unavailable. Please try another.",
+ },
+ };
+
await page.route("**/library-card/api/username", async (route) => {
+ const { status, message } = usernameResponse[availability];
await route.fulfill({
- status: 200,
+ status,
contentType: "application/json",
body: JSON.stringify({ message }),
});
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index a27cf1ea..66f6177d 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -117,13 +117,17 @@
"title": "Home library",
"description": {
"part1": "Choosing a home library will help us make sure you're getting everything you need from a branch that's most convenient for you.",
- "part2": "Please select an NYPL location from the dropdown menu below to be your home library. If you do not have a home library, please select “Virtual.” You may update this at any time through your account settings.",
+ "part2": "Please select an {{nyplLocation}} from the dropdown menu below to be your home library. If you do not have a home library, please select “Virtual.” You may update this at any time through your account settings.",
+ "nyplLocation": "NYPL location",
"part3": "To borrow physical items, you must visit an NYPL location to verify your info and receive a physical card."
}
},
"termsAndCondition": {
"label": "Yes, I accept the terms and conditions.",
- "text": "By submitting an application, you understand and agree to our Cardholder Terms and Conditions and agree to our Rules and Regulations. To learn more about the Library’s use of personal information, please read our Privacy Policy."
+ "text": "By submitting an application, you understand and agree to our {{termsConditions}} and agree to our {{rulesRegulations}}. To learn more about the Library’s use of personal information, please read our {{privacyPolicy}}.",
+ "termsConditions": "Cardholder Terms and Conditions",
+ "rulesRegulations": "Rules and Regulations",
+ "privacyPolicy": "Privacy Policy"
},
"errorMessage": {
"username": "There was a problem. Username must be between 5-25 alphanumeric characters.",
diff --git a/public/locales/es/common.json b/public/locales/es/common.json
index d25f9d7e..f1e56963 100644
--- a/public/locales/es/common.json
+++ b/public/locales/es/common.json
@@ -110,13 +110,17 @@
"title": "Biblioteca local",
"description": {
"part1": "Elegir una biblioteca local, nos ayudará a asegurarnos de que usted obtenga todo lo que necesita de la biblioteca que le resulte más conveniente.",
- "part2": "En el menú desplegable a continuación, seleccione una biblioteca de la NYPL como su biblioteca principal. Si no tiene una biblioteca principal, seleccione “Virtual”. Puede actualizar esta información en cualquier momento desde la configuración de su cuenta.",
+ "part2": "En el menú desplegable a continuación, seleccione una {{nyplLocation}} como su biblioteca principal. Si no tiene una biblioteca principal, seleccione “Virtual”. Puede actualizar esta información en cualquier momento desde la configuración de su cuenta.",
+ "nyplLocation": "biblioteca de la NYPL",
"part3": "Para pedir prestados materiales físicos, puede visitar cualquier biblioteca de la NYPL para verificar su información y recibir una tarjeta física."
}
},
"termsAndCondition": {
"label": "Sí, acepto los términos y condiciones.",
- "text": "Al enviar una solicitud, comprende y acepta nuestros Términos y condiciones del titular de la tarjeta (en inglés) y acepta nuestras Normas y reglamentos generales. Para obtener más información sobre el uso de información personal por parte de la Biblioteca, lea nuestra Política de privacidad."
+ "text": "Al enviar una solicitud, comprende y acepta nuestros {{termsConditions}} (en inglés) y acepta nuestras {{rulesRegulations}}. Para obtener más información sobre el uso de información personal por parte de la Biblioteca, lea nuestra {{privacyPolicy}}.",
+ "termsConditions": "Términos y condiciones del titular de la tarjeta",
+ "rulesRegulations": "Normas y reglamentos generales",
+ "privacyPolicy": "Política de privacidad"
},
"errorMessage": {
"username": "Hubo un problema. El nombre de usuario debe tener entre 5 y 25 caracteres alfanuméricos.",
diff --git a/src/components/AcceptTermsFormFields/index.tsx b/src/components/AcceptTermsFormFields/index.tsx
index 6b3019d9..dba3084e 100644
--- a/src/components/AcceptTermsFormFields/index.tsx
+++ b/src/components/AcceptTermsFormFields/index.tsx
@@ -1,4 +1,4 @@
-import { Checkbox, Link } from "@nypl/design-system-react-components";
+import { Checkbox, Link as DSLink } from "@nypl/design-system-react-components";
import { Trans, useTranslation } from "next-i18next";
import React from "react";
import { Controller, useFormContext } from "react-hook-form";
@@ -23,7 +23,12 @@ const AcceptTermsForm: React.FC = () => {
}}
+ components={{ a: }}
+ values={{
+ termsConditions: t("account.termsAndCondition.termsConditions"),
+ rulesRegulations: t("account.termsAndCondition.rulesRegulations"),
+ privacyPolicy: t("account.termsAndCondition.privacyPolicy"),
+ }}
/>
diff --git a/src/components/LibraryListFormFields/index.tsx b/src/components/LibraryListFormFields/index.tsx
index c7bf7de7..e17348ee 100644
--- a/src/components/LibraryListFormFields/index.tsx
+++ b/src/components/LibraryListFormFields/index.tsx
@@ -52,6 +52,9 @@ const LibraryListForm = ({ libraryList = [] }: LibraryListFormProps) => {
}}
+ values={{
+ nyplLocation: t("account.library.description.nyplLocation"),
+ }}
/>