File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ( / j s o n / i) ;
34+ } ) ;
35+ } ) ;
You can’t perform that action at this time.
0 commit comments