From aa6b149aa5b95ce64212f76f3a14ca55e36d7470 Mon Sep 17 00:00:00 2001 From: Riya Dhawan Date: Thu, 19 Oct 2023 02:17:20 +0530 Subject: [PATCH] test(e2e,playwright): Map (#51940) --- e2e/map.spec.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 e2e/map.spec.ts diff --git a/e2e/map.spec.ts b/e2e/map.spec.ts new file mode 100644 index 00000000000..f1fde34ffa0 --- /dev/null +++ b/e2e/map.spec.ts @@ -0,0 +1,45 @@ +import { test, expect } from '@playwright/test'; +import translations from '../client/i18n/locales/english/translations.json'; +import intro from '../client/i18n/locales/english/intro.json'; + +import { + SuperBlockStages, + superBlockOrder +} from '../shared/config/superblocks'; + +test.beforeEach(async ({ page }) => { + await page.goto('/learn'); +}); + +const superBlocksWithLinks = [ + ...superBlockOrder[SuperBlockStages.FrontEnd], + ...superBlockOrder[SuperBlockStages.Backend], + ...superBlockOrder[SuperBlockStages.Python], + ...superBlockOrder[SuperBlockStages.Professional], + ...superBlockOrder[SuperBlockStages.Extra] +]; + +test.describe('Map Component', () => { + test('should render correctly', async ({ page }) => { + await expect( + page.getByText(translations.landing['core-certs-heading']) + ).toBeVisible(); + await expect( + page.getByText(translations.landing['professional-certs-heading']) + ).toBeVisible(); + await expect( + page.getByText(translations.landing['interview-prep-heading']) + ).toBeVisible(); + const curriculumBtns = page.getByTestId('curriculum-map-button'); + await expect(curriculumBtns).toHaveCount(15); + for (let i = 0; i < superBlocksWithLinks.length; i++) { + const superblockLink = page.getByRole('link', { + name: intro[superBlocksWithLinks[i]].title + }); + expect(await superblockLink.getAttribute('href')).toBe( + `/learn/${superBlocksWithLinks[i]}/` + ); + await superblockLink.click(); + } + }); +});