From 4a29f238950e02528c32b25b671f15eb72a46345 Mon Sep 17 00:00:00 2001 From: Kevin <66554168+kevin-wu01@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:56:03 -0700 Subject: [PATCH] feat(curriculum): add test number enumeration (#55874) --- .../src/templates/Challenges/components/test-suite.tsx | 2 +- .../Challenges/redux/execute-challenge-saga.js | 1 + e2e/output.spec.ts | 2 +- e2e/test-suite.spec.ts | 10 +++++++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/templates/Challenges/components/test-suite.tsx b/client/src/templates/Challenges/components/test-suite.tsx index df1fe3a0eaa..364bcabec28 100644 --- a/client/src/templates/Challenges/components/test-suite.tsx +++ b/client/src/templates/Challenges/components/test-suite.tsx @@ -43,7 +43,7 @@ function TestSuite({ tests }: TestSuiteProps): JSX.Element { pass && !err ? t('icons.passed') : t('icons.failed'); // Remove opening/closing

so screen reader will read both // status message and test text as one block. - text = text.replace(/^

|<\/p>$/g, ''); + text = `${index + 1}. ${text.replace(/^

|<\/p>$/g, '')}`; return (

  • /, `

    ${i + 1}. `); yield put(updateConsole(newTest.message)); } finally { testResults.push(newTest); diff --git a/e2e/output.spec.ts b/e2e/output.spec.ts index 3a80daffb46..0f89c2e245f 100644 --- a/e2e/output.spec.ts +++ b/e2e/output.spec.ts @@ -13,7 +13,7 @@ const outputTexts = { > 1 | var | ^`, empty: `// running tests - You should declare myName with the var keyword, ending with a semicolon + 1. You should declare myName with the var keyword, ending with a semicolon // tests completed`, passed: `// running tests // tests completed` diff --git a/e2e/test-suite.spec.ts b/e2e/test-suite.spec.ts index 498705f7d42..cf762b0ab52 100644 --- a/e2e/test-suite.spec.ts +++ b/e2e/test-suite.spec.ts @@ -25,11 +25,15 @@ test.describe('Challenge Test Suite Component Tests', () => { await expect(page.getByTestId('test-result')).toHaveCount(3); await expect(page.getByText(translations.icons.initial)).toHaveCount(3); await expect( - page.getByText('You should not change code above the specified comment.') + page.getByText( + '1. You should not change code above the specified comment.' + ) ).toBeVisible(); - await expect(page.getByText('b should have a value of 7.')).toBeVisible(); await expect( - page.getByText('a should be assigned to b with =.') + page.getByText('2. b should have a value of 7.') + ).toBeVisible(); + await expect( + page.getByText('3. a should be assigned to b with =.') ).toBeVisible(); });