Repository: freeCodeCamp/freeCodeCamp
File: e2e/link-ms-user.spec.ts (TypeScript)

Code before:
  page = await browser.newPage();
  await page.goto(
    '/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/trophy-write-your-first-code-using-c-sharp'
  );
});

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

test.describe('Link MS user component (unlinked signedOut user)', () => {
  test('Component has proper main heading and relevant sections', async () => {
    const mainHeading = page.getByRole('heading', {
      name: translations.learn.ms['link-header']
    });
    await expect(mainHeading).toBeVisible();

    const linkSignInText = page.getByTestId('link-signin-text');
    await expect(linkSignInText).toBeVisible();
  });
});

test.describe('Link MS user component (unlinked signedIn user)', () => {
  test.use({ storageState: 'playwright/.auth/certified-user.json' });

  test('Component has proper main heading and relevant sections', async () => {
    const mainHeading = page.getByRole('heading', {
      name: translations.learn.ms['link-header']
    });
    await expect(mainHeading).toBeVisible();

    const linkSignInText = page.getByTestId('unlinked-text');
    await expect(linkSignInText).toBeVisible();
  });

  test('Component has proper list of actions', async () => {
    const linkText1 = page.getByTestId('link-li-1-text');
    await expect(linkText1).toBeVisible();
    await expect(linkText1).toContainText(
      'Using a browser where you are logged into your Microsoft account, go to https://learn.microsoft.com/users/me/transcript'
    );

    const linkText2 = page.getByTestId('link-li-2-text');
    await expect(linkText2).toBeVisible();
    await expect(linkText2).toHaveText(translations.learn.ms['link-li-2']);

    const linkText3 = page.getByTestId('link-li-3-text');
    await expect(linkText3).toBeVisible();
    await expect(linkText3).toHaveText(translations.learn.ms['link-li-3']);

    const linkText4 = page.getByTestId('link-li-4-text');

Review comment (suggestion):
```suggestion
  test('Component has proper main heading and relevant sections', async ({ page }) => {
```

Code after:
  );
});

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

test.describe('Link MS user component (unlinked signedOut user)', () => {
  test('Component has proper main heading and relevant sections', async ({
    page
  }) => {
    const mainHeading = page.getByRole('heading', {
      name: translations.learn.ms['link-header']
    });
    await expect(mainHeading).toBeVisible();

    const linkSignInText = page.getByTestId('link-signin-text');
    await expect(linkSignInText).toBeVisible();
  });
});

test.describe('Link MS user component (unlinked signedIn user)', () => {
  test.use({ storageState: 'playwright/.auth/certified-user.json' });

  test('Component has proper main heading and relevant sections', async ({
    page
  }) => {
    const mainHeading = page.getByRole('heading', {
      name: translations.learn.ms['link-header']
    });
    await expect(mainHeading).toBeVisible();

    const linkSignInText = page.getByTestId('unlinked-text');
    await expect(linkSignInText).toBeVisible();
  });

  test('Component has proper list of actions', async ({ page }) => {
    const linkText1 = page.getByTestId('link-li-1-text');
    await expect(linkText1).toBeVisible();
    await expect(linkText1).toContainText(
      'Using a browser where you are logged into your Microsoft account, go to https://learn.microsoft.com/users/me/transcript'
    );

    const linkText2 = page.getByTestId('link-li-2-text');
    await expect(linkText2).toBeVisible();
    await expect(linkText2).toHaveText(translations.learn.ms['link-li-2']);

    const linkText3 = page.getByTestId('link-li-3-text');
    await expect(linkText3).toBeVisible();
    await expect(linkText3).toHaveText(translations.learn.ms['link-li-3']);