fix(client): duplicate console output (#66350)

This commit is contained in:
Oliver Eyton-Williams
2026-03-11 21:15:50 +01:00
committed by GitHub
parent b72d31c209
commit 9aa6f05fa1
3 changed files with 58 additions and 58 deletions
+26 -25
View File
@@ -13,8 +13,8 @@ const outputTexts = {
> 1 | var
| ^`,
empty: `// running tests
1. You should declare myName with the var keyword, ending with a semicolon
// tests completed`,
1. You should declare myName with the var keyword, ending with a semicolon
// tests completed`,
passed: `// running tests
// tests completed`
};
@@ -33,20 +33,18 @@ const replaceTextInCodeEditor = async ({
browserName,
isMobile,
text,
containerId = 'editor-container-indexhtml',
updatesConsole = false
containerId = 'editor-container-indexhtml'
}: InsertTextParameters) => {
await expect(async () => {
await clearEditor({ page, browserName, isMobile });
await getEditors(page).fill(text);
await expect(page.getByTestId(containerId)).toContainText(text);
if (updatesConsole) {
await expect(
page.getByRole('region', {
name: translations.learn['editor-tabs'].console
})
).not.toContainText('Your test output will go here');
}
await expect(
page.getByRole('region', {
name: translations.learn['editor-tabs'].console
})
).toContainText('Your test output will go here');
}).toPass();
};
@@ -211,12 +209,13 @@ test.describe('Challenge Output Component Tests', () => {
page,
isMobile
}) => {
await runChallengeTest(page, isMobile);
await expect(async () => {
await runChallengeTest(page, isMobile);
await expect(page.getByTestId('output-text')).toContainText(
outputTexts.empty,
{ timeout: 10000 }
);
expect(await page.getByTestId('output-text').textContent()).toEqual(
expect.stringContaining(outputTexts.empty)
);
}).toPass();
});
test('should contain final output after test pass', async ({
@@ -226,15 +225,17 @@ test.describe('Challenge Output Component Tests', () => {
}) => {
const closeButton = page.getByRole('button', { name: 'Close' });
await focusEditor({ page, isMobile });
await replaceTextInCodeEditor({
browserName,
page,
isMobile,
text: 'var myName;',
containerId: 'editor-container-scriptjs',
updatesConsole: true
});
await runChallengeTest(page, isMobile);
await expect(async () => {
await replaceTextInCodeEditor({
browserName,
page,
isMobile,
text: 'var myName;',
containerId: 'editor-container-scriptjs'
});
await runChallengeTest(page, isMobile);
await expect(closeButton).toBeVisible();
}).toPass();
await closeButton.click();
await expect(