11const { test, expect } = require ( '@playwright/test' ) ;
22
3+ let errors = [ ] ;
4+
5+ test . beforeEach ( async ( { page } ) => {
6+ errors = [ ] ;
7+ page . on ( 'console' , msg => {
8+ if ( msg . type ( ) === 'error' ) {
9+ console . log ( msg . text ( ) ) ;
10+ errors . push ( msg . text ( ) ) ;
11+ }
12+ } )
13+ } ) ;
14+
15+ test . afterEach ( async ( { page } ) => {
16+ expect ( errors ) . toEqual ( [ ] ) ;
17+ } ) ;
18+
319test ( 'clusterOI editor opens, can add nodes' , async ( { page } ) => {
4- await page . goto ( 'http://localhost:8080/priority-sets-args.html?network=ui-tests/data/network.json' ) ;
5-
6- await expect ( page . locator ( "#priority-set-tab" ) ) . toBeVisible ( ) ;
7- await page . locator ( "#priority-set-tab" ) . click ( ) ;
8-
9- // jspanel should not be visible
10- let jsPanels = await page . locator ( ".jsPanel" ) . all ( ) ;
11- await expect ( jsPanels ) . toHaveLength ( 0 ) ;
12-
13- await expect ( page . locator ( "#trace-priority-sets" ) ) . toBeVisible ( ) ;
14- await expect ( page . getByText ( "Create A Cluster of Interest" , { exact : true } ) ) . toBeVisible ( ) ;
15- await page . getByText ( "Create A Cluster of Interest" , { exact : true } ) . click ( ) ;
16-
17- jsPanels = await page . locator ( ".jsPanel" ) . all ( ) ;
18- await expect ( jsPanels ) . toHaveLength ( 1 ) ;
19-
20- await page . locator ( '[data-hivtrace-ui-role="priority-panel-nodeids"]' ) . fill ( "BMK384750US2015" ) ;
21- await page . locator ( "#priority-panel-add-node" ) . click ( ) ;
22- await page . locator ( '[data-hivtrace-ui-role="priority-panel-nodeids"]' ) . fill ( "BMK385560US2007" ) ;
23- await page . locator ( "#priority-panel-add-node" ) . click ( ) ;
24- await expect ( page . locator ( "#priority-panel-node-table" )
25- . filter ( { has : page . getByText ( "BMK384750US2015" ) } )
26- . filter ( { has : page . getByText ( "BMK385560US2007" ) } ) )
27- . toBeVisible ( ) ;
20+ await page . goto ( 'http://localhost:8080/priority-sets-args.html?network=ui-tests/data/network.json' ) ;
21+
22+ await expect ( page . locator ( "#priority-set-tab" ) ) . toBeVisible ( ) ;
23+ await page . locator ( "#priority-set-tab" ) . click ( ) ;
24+
25+ // jspanel should not be visible
26+ let jsPanels = await page . locator ( ".jsPanel" ) . all ( ) ;
27+ await expect ( jsPanels ) . toHaveLength ( 0 ) ;
28+
29+ await expect ( page . locator ( "#trace-priority-sets" ) ) . toBeVisible ( ) ;
30+ await expect ( page . getByText ( "Create A Cluster of Interest" , { exact : true } ) ) . toBeVisible ( ) ;
31+ await page . getByText ( "Create A Cluster of Interest" , { exact : true } ) . click ( ) ;
32+
33+ jsPanels = await page . locator ( ".jsPanel" ) . all ( ) ;
34+ await expect ( jsPanels ) . toHaveLength ( 1 ) ;
35+
36+ await page . locator ( '[data-hivtrace-ui-role="priority-panel-nodeids"]' ) . fill ( "BMK384750US2015" ) ;
37+ await page . locator ( "#priority-panel-add-node" ) . click ( ) ;
38+ await page . locator ( '[data-hivtrace-ui-role="priority-panel-nodeids"]' ) . fill ( "BMK385560US2007" ) ;
39+ await page . locator ( "#priority-panel-add-node" ) . click ( ) ;
40+ await expect ( page . locator ( "#priority-panel-node-table" )
41+ . filter ( { has : page . getByText ( "BMK384750US2015" ) } )
42+ . filter ( { has : page . getByText ( "BMK385560US2007" ) } ) )
43+ . toBeVisible ( ) ;
2844} ) ;
0 commit comments