test(e2e, playwright): solution-viewer (#52016)

Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
This commit is contained in:
Kobe Ruado
2023-10-19 20:22:17 +08:00
committed by GitHub
parent ac63965c62
commit 3b98667f88
+23
View File
@@ -0,0 +1,23 @@
import { test, expect } from '@playwright/test';
test.use({ storageState: 'playwright/.auth/certified-user.json' });
test.beforeEach(async ({ page }) => {
await page.goto(
'/certification/certifieduser/javascript-algorithms-and-data-structures'
);
});
test.describe('Solution Viewer component', () => {
test('renders the modal correctly', async ({ page }) => {
await page.getByRole('button').filter({ hasText: /view/i }).first().click();
// The modal should show the solution title...
await expect(
page.getByRole('heading').and(page.getByText(/solution for/i))
).toBeVisible();
// ...and relevant code file/s
await expect(page.getByText(/js/i)).toBeVisible();
await expect(page.locator('pre').first()).toBeVisible();
});
});