From d1b139a9b980db66f9c8e56123961ce628e72e51 Mon Sep 17 00:00:00 2001 From: Nirmal Kumar R Date: Sun, 10 Nov 2024 07:20:20 +0530 Subject: [PATCH] Add e2e test for Markdown image preview --- tests/e2e/actions.test.e2e.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/e2e/actions.test.e2e.ts b/tests/e2e/actions.test.e2e.ts index e9f7db52f2..40cbde6b10 100644 --- a/tests/e2e/actions.test.e2e.ts +++ b/tests/e2e/actions.test.e2e.ts @@ -16,6 +16,28 @@ test.beforeAll(async ({browser}, workerInfo) => { await login_user(browser, workerInfo, 'user2'); }); +test('Markdown image preview behaviour', async ({browser}, workerInfo) => { + const page = await login({browser}, workerInfo); + + const editPath = '/user2/repo1/src/branch/master/README.md' + + const response = await page.goto(editPath); + expect(response?.status()).toBe(200); + + await page.locator('[data-tooltip-content="Edit file"]').click(); + await page.waitForLoadState('networkidle'); + + const editor = await page.locator('[aria-roledescription="editor"]').first(); + await editor.fill(''); + await editor.fill('![Logo of Forgejo](./assets/logo.svg "Logo of Forgejo")'); + + await page.locator('a[data-tab="preview"]').click(); + await page.waitForLoadState('networkidle'); + + const preview = await page.locator('div[data-tab="preview"] p[dir="auto"] a') + await expect(preview).toHaveAttribute('href', 'http://localhost:3003/user2/repo1/media/branch/master/assets/logo.svg'); +}); + const workflow_trigger_notification_text = 'This workflow has a workflow_dispatch event trigger.'; test('workflow dispatch present', async ({browser}, workerInfo) => {