From: Lukasz Rajewski Date: Thu, 5 Mar 2026 15:41:29 +0000 (+0000) Subject: Merge "Designer mode improvements" X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=7dd30e6661f0ddef4ae2e13d3769321902222fcb;p=ccsdk%2Fcds.git Merge "Designer mode improvements" --- 7dd30e6661f0ddef4ae2e13d3769321902222fcb diff --cc cds-ui/e2e-playwright/tests/resource-dictionary.spec.ts index 2bf91aac2,f4bfa82db..4998d4982 --- a/cds-ui/e2e-playwright/tests/resource-dictionary.spec.ts +++ b/cds-ui/e2e-playwright/tests/resource-dictionary.spec.ts @@@ -211,44 -212,9 +212,44 @@@ test.describe('Resource Dictionary – page.goto('/#/resource-dictionary'), ]); - // Dictionary list should still render cards (3 dictionaries + 1 create card) + // Dictionary list should still render cards (pageSize=5 dictionaries + 1 create card) const cards = page.locator('app-dictionary-list .card'); await expect(cards.first()).toBeVisible({ timeout: 10_000 }); - await expect(cards).toHaveCount(4); + await expect(cards).toHaveCount(6); }); }); + +test.describe('Resource Dictionary – download dictionary', () => { + test('Download button triggers a JSON file download with timestamp in filename', async ({ page }) => { + // Navigate to the create dictionary page + await page.goto('/#/resource-dictionary/createDictionary'); + await page.waitForLoadState('networkidle'); + + // Verify we are on the create dictionary page + await expect(page).toHaveURL(/createDictionary/); + + // Locate the Download button + const downloadBtn = page.locator('a.action-button', { hasText: 'Download' }); + await expect(downloadBtn).toBeVisible({ timeout: 10_000 }); + + // Listen for download event before clicking + const [download] = await Promise.all([ + page.waitForEvent('download', { timeout: 15_000 }), + downloadBtn.click(), + ]); + + // Verify the downloaded file has a .json extension and contains a timestamp pattern + const fileName = download.suggestedFilename(); + expect(fileName).toMatch(/\.json$/); + // Timestamp pattern: YYYY-MM-DDTHH-MM-SS-mmmZ + expect(fileName).toMatch(/\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}/); + + // Verify the file content is valid JSON + const filePath = await download.path(); + if (filePath) { + const fs = require('fs'); + const content = fs.readFileSync(filePath, 'utf-8'); + expect(() => JSON.parse(content)).not.toThrow(); + } + }); +});