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

Code before:

  const landingH2Heading = page.getByTestId('landing-h2-heading');
  await expect(landingH2Heading).toHaveText(
    'Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including:'
  );
});

test('Has 5 brand logos', async () => {
  const logos = page.getByTestId('brand-logo-container');
  expect(await logos.nth(0).isVisible());
  expect(await logos.nth(1).isVisible());
  expect(await logos.nth(2).isVisible());
  expect(await logos.nth(3).isVisible());
  expect(await logos.nth(4).isVisible());
});

test('The campers landing page figure is visbile on desktop and hidden on mobile view', async ({
  isMobile
}) => {
  const landingPageImage = page.getByTestId('landing-page-figure');

  if (!isMobile) {
    await expect(landingPageImage).toBeVisible();
  } else {
    await expect(landingPageImage).toBeHidden();
  }
});

test('The as seen in container is vissible with featured logos', async () => {
  const asSeenInContainer = page.getByTestId('landing-as-seen-in-text');
  await expect(asSeenInContainer).toHaveText('As seen in:');

  const featuredLogos = page.getByTestId('landing-as-seen-in-container-logos');
  await expect(featuredLogos).toBeVisible();
});

test('Testimonial section has a header', async () => {
  const testimonialsHeader = page.getByTestId('testimonials-section-header');
  await expect(testimonialsHeader).toHaveText(
    'Here is what our alumni say about freeCodeCamp:'
  );
});

test('Testimonial endorser people have images, occupation, location and testimony visible', async () => {
  for (let index = 1; index <= 3; index++) {
    const testimonialEndorserImage = page.getByTestId(
      `testimonials-endorser-image-container-${index}`
    );
    const testimonialEndorserLocation = page.getByTestId(
      `testimonials-endorser-location-${index}`
    );

Review comment (suggestion):
```suggestion
  if (isMobile) {
    await expect(landingPageImage).toBeHidden();
  } else {
    await expect(landingPageImage).toBeVisible();
  }
```
Very minor, but the negation isn't necessary.

Code after:

  const landingHeading3 = page.getByTestId('landing-big-heading-3');
  await expect(landingHeading3).toHaveText('Earn certifications.');

  const landingH2Heading = page.getByTestId('landing-h2-heading');
  await expect(landingH2Heading).toHaveText(
    'Since 2014, more than 40,000 freeCodeCamp.org graduates have gotten jobs at tech companies including:'
  );
});

test('Has 5 brand logos', async () => {
  const logos = page.getByTestId('brand-logo-container').locator('svg');
  await expect(logos).toHaveCount(5);
  for (const logo of await logos.all()) {
    await expect(logo).toBeVisible();
  }
});

test('The campers landing page figure is visible on desktop and hidden on mobile view', async ({
  isMobile
}) => {
  const landingPageImage = page.getByTestId('landing-page-figure');

  if (isMobile) {
    await expect(landingPageImage).toBeHidden();
  } else {
    await expect(landingPageImage).toBeVisible();
  }
});

test('The as seen in container is visible with featured logos', async () => {
  const asSeenInContainer = page.getByTestId('landing-as-seen-in-text');
  await expect(asSeenInContainer).toHaveText('As seen in:');

  const featuredLogos = page.getByTestId('landing-as-seen-in-container-logos');
  await expect(featuredLogos).toBeVisible();
});

test('Testimonial section has a header', async () => {
  const testimonialsHeader = page.getByTestId('testimonials-section-header');
  await expect(testimonialsHeader).toHaveText(
    'Here is what our alumni say about freeCodeCamp:'
  );
});

test('Testimonial endorser people have images, occupation, location and testimony visible', async () => {
  const cards = page.getByTestId('testimonial-card');

  await expect(cards).toHaveCount(3);

  for (const card of await cards.all()) {