Skip to content

Commit 39e4a71

Browse files
authored
Merge pull request #1600 from Jayantparashar10/migrate-uploaddashboard-tests-playwright
feat: migrate UploadDashboard tests from Cypress to Playwright
2 parents 9db56d4 + bb2932a commit 39e4a71

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2017-present, The Visdom Authors
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*
8+
*/
9+
10+
const { test, expect } = require('@playwright/test');
11+
12+
test.describe('Visdom - Upload Dashboard JSON Feature', () => {
13+
test.beforeEach(async ({ page }) => {
14+
await page.goto('/');
15+
await expect(page.locator('.visdom-title')).toBeVisible({ timeout: 15000 });
16+
});
17+
18+
test('should display Upload JSON button', async ({ page }) => {
19+
await expect(
20+
page.locator('button[aria-label="Upload JSON file"]')
21+
).toBeVisible();
22+
});
23+
24+
test('should reject non-JSON files', async ({ page }) => {
25+
await page.setInputFiles('input[type="file"]', {
26+
name: 'test.txt',
27+
mimeType: 'text/plain',
28+
buffer: Buffer.from('This is not json'),
29+
});
30+
31+
const toast = page.locator('.visdom-toast-message');
32+
await expect(toast).toBeVisible();
33+
await expect(toast).toContainText(/json/i);
34+
});
35+
});

0 commit comments

Comments
 (0)