fix: JSON validation for unquoted @placeholders@
This commit is contained in:
@@ -119,6 +119,56 @@ test.describe('Environment Management', () => {
|
||||
expect(hostPlaceholderCount).toBe(2);
|
||||
});
|
||||
|
||||
test('should validate template with unquoted placeholders', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.click('button:has-text("Create new")');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Add a parameter
|
||||
await page.click('button:has-text("✚")');
|
||||
await page.waitForTimeout(300);
|
||||
const nameInput = page.locator('input[placeholder="name"]');
|
||||
const valueInput = page.locator('input[placeholder="value"]');
|
||||
const addButton = page.locator('button:has-text("✓")');
|
||||
await nameInput.fill('port');
|
||||
await valueInput.fill('8080');
|
||||
await addButton.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Go to Content Template and edit with unquoted placeholder
|
||||
await page.click('a:has-text("Content Template")');
|
||||
await page.waitForTimeout(300);
|
||||
await page.click('button:has-text("Edit")');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Fill template with unquoted @port@ placeholder
|
||||
const textarea = page.locator('textarea');
|
||||
await textarea.fill('{\n "Host": "@host@",\n "Port": @port@,\n "Url": "http://@host@:@port@/api"\n}');
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Check that Save button is enabled (validation passed)
|
||||
const saveButton = page.locator('button:has-text("Save")');
|
||||
await expect(saveButton).toBeEnabled();
|
||||
|
||||
// Check that there's no JSON error
|
||||
const errorAlert = page.locator('.alert-danger');
|
||||
await expect(errorAlert).not.toBeVisible();
|
||||
|
||||
// Save the template
|
||||
await saveButton.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Verify it was saved - should be in view mode with Edit button visible
|
||||
const editButton = page.locator('button:has-text("Edit")');
|
||||
await expect(editButton).toBeVisible();
|
||||
|
||||
// Verify the template content is displayed correctly
|
||||
const codeContent = page.locator('code');
|
||||
await expect(codeContent).toBeVisible();
|
||||
const content = await codeContent.textContent();
|
||||
expect(content).toContain('@port@');
|
||||
});
|
||||
|
||||
test('should download config file with correct filename', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.click('button:has-text("Create new")');
|
||||
|
||||
Reference in New Issue
Block a user