From 3b98667f880a57a417f99708dc12cd46dfe5e2a0 Mon Sep 17 00:00:00 2001 From: Kobe Ruado Date: Thu, 19 Oct 2023 20:22:17 +0800 Subject: [PATCH] test(e2e, playwright): solution-viewer (#52016) Co-authored-by: Naomi Carrigan --- e2e/solution-viewer.spec.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 e2e/solution-viewer.spec.ts diff --git a/e2e/solution-viewer.spec.ts b/e2e/solution-viewer.spec.ts new file mode 100644 index 00000000000..54b68a21341 --- /dev/null +++ b/e2e/solution-viewer.spec.ts @@ -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(); + }); +});