feat: convert progressbar test to Playwright (#54636)

Co-authored-by: Naomi <nhcarrigan@gmail.com>
This commit is contained in:
Sem Bauke
2024-05-07 17:59:02 +02:00
committed by GitHub
parent 17f2e184bd
commit c3b5c11afc
2 changed files with 31 additions and 85 deletions
+31
View File
@@ -1,4 +1,5 @@
import { expect, test } from '@playwright/test';
test.use({ storageState: 'playwright/.auth/certified-user.json' });
test.describe('Progress bar component', () => {
test('Should appear with the correct content after the user has submitted their code', async ({
@@ -33,4 +34,34 @@ test.describe('Progress bar component', () => {
.getByRole('button', { name: 'Submit and go to next challenge' })
.click();
});
test('should appear in the completion modal after user has submitted their code', async ({
page
}) => {
await page.goto(
'/learn/javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables'
);
const monacoEditor = page.getByLabel('Editor content');
await monacoEditor.focus();
await page.keyboard.press('Control+A');
await page.keyboard.press('Meta+A');
await page.keyboard.press('Backspace');
await page.keyboard.insertText('var myName;');
await page
.getByRole('button', { name: 'Run the Tests (Ctrl + Enter)' })
.click();
await expect(page.locator('.completion-block-meta')).toContainText(
'99% complete'
);
await page
.getByRole('button', { name: 'Submit and go to next challenge' })
.click();
});
});