Repository: freeCodeCamp/freeCodeCamp
File: e2e/certification.spec.ts (TypeScript)

Code before:
} from '../shared/config/certification-settings';

let page: Page;
const certificates = Object.values(Certification);
const blackListedCerts = ['upcoming-python-v8'];

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

// Iterate through all the certificates and test for the following:
// 1. The certificate has wrapper, header and footer
// 2. The certificate itslef has relevant information like the title in it.
// 3. The certificate page has certificate/project links in it.
for (const certificate of certificates) {
  // Skip blacklisted certificates. These are certificates that are not
  // currently live, but are still in the codebase.
  if (blackListedCerts.includes(certificate)) {
    continue;
  }

  test.describe(`Certification page -> test for ${certificate}`, () => {
    test.beforeAll(async ({ browser }) => {
      page = await browser.newPage();
      await page.goto(`/certification/certifieduser/${certificate}`);
    });

    test('The certificate has wrapper, header and footer', async () => {
      const wrapper = page.getByTestId('cert-wrapper');
      await expect(wrapper).toBeVisible();

      const header = page.getByTestId('cert-header');
      await expect(header).toBeVisible();

      const footer = page.getByTestId('cert-footer');
      await expect(footer).toBeVisible();
    });

    test('The certificate itslef has relevant information in it', async () => {
      const infoContainer = page.getByTestId('cert-info-container');
      await expect(infoContainer).toBeVisible();

      const certTitle = page.getByTestId('certification-title');
      await expect(certTitle).toHaveText(
        certTypeTitleMap[
          certSlugTypeMap[certificate as keyof typeof certSlugTypeMap]
        ]
      );
    });

    test('The certificate page has certificate/project links', async () => {

Review comment (suggestion):
This is considered an anti-pattern. See more [here](https://github.com/freeCodeCamp/freeCodeCamp/pull/51754#discussion_r1342543051).

Code after:
test.describe('Certification page - Non Microsoft', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('/certification/certifieduser/responsive-web-design');
  });

  test('The certificate page has a donation section', async ({ page }) => {
    const donationSection = page.getByTestId('donation-section');
    await expect(donationSection).toBeVisible();

    const donationText = donationSection.getByTestId('donation-text');
    await expect(donationText).toHaveText(translations.donate['only-you']);

    const donationForm = donationSection.getByTestId('donation-form');
    await expect(donationForm).toBeVisible();
  });

  test('Verify the certificate itself', async ({ page }) => {
    const certWrapper = page.getByTestId('cert-wrapper');
    await expect(certWrapper).toBeVisible();

    const header = certWrapper.getByTestId('cert-header');
    await expect(header).toBeVisible();
    const fccLogo = header.getByTestId('cert-fcc-logo');
    await expect(fccLogo).toBeVisible();
    // Non Microsoft certs should not have this one
    const microsoftLogo = header.getByTestId('cert-microsoft-logo');
    await expect(microsoftLogo).not.toBeVisible();

    const certInfoContainer = certWrapper.getByTestId('cert-info-container');
    await expect(certInfoContainer).toBeVisible();
    const certTitle = certInfoContainer.getByTestId('certification-title');
    await expect(certTitle).toHaveText(
      translations.certification.title['Responsive Web Design']
    );

    const footer = certWrapper.getByTestId('cert-footer');
    await expect(footer).toBeVisible();
    const QunicySignature = footer.getByTestId('quincy-signature');
    await expect(QunicySignature).toBeVisible();
    // Non Microsoft certs should not have this one
    const microsoftSignature = footer.getByTestId('microsoft-signature');
    await expect(microsoftSignature).not.toBeVisible();
  });

  test('Validate certificate/social/project links', async ({ page }) => {
    const certLink = page.getByTestId('cert-links');
    await expect(certLink).toBeVisible();

    const linkedinLink = certLink.getByTestId('linkedin-share-btn');
    await expect(linkedinLink).toBeVisible();
    await expect(linkedinLink).toHaveAttribute(