Repository: freeCodeCamp/freeCodeCamp
File: e2e/donate-page-default.spec.ts (TypeScript)

Code before:
import { test, expect, type Page } from '@playwright/test';

const frequentlyAskedQuestions = [
  'How can I get help with my donations?',
  'How transparent is freeCodeCamp.org?',
  'How efficient is freeCodeCamp?',
  'How can I make a one-time donation?',
  'Does freeCodeCamp accept donations in Bitcoin or other cryptocurrencies?',
  'Can I mail a physical check?',
  'How can I set up matching gifts from my employer, or payroll deductions?',
  'How can I set up an Endowment Gift to freeCodeCamp.org?',
  'How can I set up a Legacy gift to freeCodeCamp.org?',
  'How can I donate stock to freeCodeCamp.org?',
  'I set up a monthly donation, but I need to update or pause the monthly recurrence. How can I do this?',
  'Is there anything else I can learn about donating to freeCodeCamp.org?'
];

let page: Page;
test.beforeAll(async ({ browser }) => {
  page = await browser.newPage();
  await page.goto('/donate');
});

test.afterAll(async () => {
  await page.close();
});

test.describe('Should render the donation page correctly', () => {
  test('should display the correct title', async () => {
    await expect(page).toHaveTitle('Support our charity | freeCodeCamp.org');
  });

  test('should display the main heading', async () => {
    const mainHeading = page.getByTestId('main-head');
    expect(mainHeading).not.toBeNull();
    expect(await mainHeading.textContent()).toBe('Help us do more');
  });

  test('should display donation page upper text 1', async () => {
    const donateText1 = page.getByTestId('donate-text-1');
    await expect(donateText1).toHaveText(

Review comment (suggestion):
This is totally okay. But we could also pull out the strings from the `translations.json` file instead, to use it as the single source of truth. It is so that if we change the strings in the future (in `translations.json`) we won't have to go to this file and update them, too.

```ts
import translations from '../client/i18n/locales/english/translations.json';

const frequentlyAskedQuestions = [
  translations.donate['get-help'],
  translations.donate['how-transparent'],
  // ...
];
```

Code after:
import { test, expect, type Page } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';

const frequentlyAskedQuestions = [
  translations.donate['get-help'],
  translations.donate['how-transparent'],
  translations.donate['how-efficient'],
  translations.donate['how-one-time'],
  translations.donate['does-crypto'],
  translations.donate['can-check'],
  translations.donate['how-matching-gift'],
  translations.donate['how-endowment'],
  translations.donate['how-legacy'],
  translations.donate['how-stock'],
  translations.donate['how-update'],
  translations.donate['anything-else']
];

let page: Page;
test.beforeAll(async ({ browser }) => {
  page = await browser.newPage();
  await page.goto('/donate');
});

test.afterAll(async () => {
  await page.close();
});

test.describe('Donate Page', () => {
  test('should display the correct title', async () => {
    await expect(page).toHaveTitle('Support our charity | freeCodeCamp.org');
  });

  test('should display the main heading', async () => {
    const mainHeading = page.getByTestId('main-head');
    expect(mainHeading).not.toBeNull();
    expect(await mainHeading.textContent()).toBe('Help us do more');
  });

  test('should display donation page upper text 1', async () => {
    const donateText1 = page.getByTestId('donate-text-1');