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

Code before:
  test('should contain syntax error output when var is entered in editor', async ({
    page,
    isMobile
  }) => {
    await insertTextInCodeEditor(page, isMobile, 'var');
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(outputTexts.syntaxError);
  });

  test('should contain reference error output when var is entered in editor', async ({
    page,
    isMobile
  }) => {
    const referenceErrorRegex =
      /ReferenceError: (myName is not defined|Can't find variable: myName)/;
    await insertTextInCodeEditor(page, isMobile, 'myName');
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(referenceErrorRegex);
  });
  test('should contain final output after test fail', async ({
    page,
    isMobile
  }) => {
    await runChallengeTest(page, isMobile);
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(outputTexts.empty);
  });
  test('should contain final output after test pass', async ({
    page,
    isMobile
  }) => {
    const closeButton = page.getByRole('button', { name: 'Close' });

    await insertTextInCodeEditor(page, isMobile, 'var myName;');
    await runChallengeTest(page, isMobile);
    await closeButton.click();
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(outputTexts.passed);
  });

Review comment (bug):
For readability, we should separate test cases with an empty line.

```suggestion
  });
  
  test('should contain final output after test fail', async ({
```

Code after:
      name: translations.learn['editor-tabs'].console
    });
    await expect(outputConsole).toBeVisible();
    await expect(outputConsole).toHaveText(outputTexts.default);
  });

  test('should contain syntax error output when var is entered in editor', async ({
    page,
    isMobile
  }) => {
    await insertTextInCodeEditor({ page, isMobile, text: 'var' });
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(outputTexts.syntaxError);
  });

  test('should contain reference error output when var is entered in editor', async ({
    page,
    isMobile
  }) => {
    const referenceErrorRegex =
      /ReferenceError: (myName is not defined|Can't find variable: myName)/;
    await insertTextInCodeEditor({ page, isMobile, text: 'myName' });
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(referenceErrorRegex);
  });

  test('should contain final output after test fail', async ({
    page,
    isMobile
  }) => {
    await runChallengeTest(page, isMobile);
    await expect(
      page.getByRole('region', {
        name: translations.learn['editor-tabs'].console
      })
    ).toHaveText(outputTexts.empty);
  });

  test('should contain final output after test pass', async ({
    page,
    isMobile
  }) => {
    const closeButton = page.getByRole('button', { name: 'Close' });

    await insertTextInCodeEditor({ page, isMobile, text: 'var myName;' });