1- import { endent , filter } from '@dword-design/functions'
2- import tester from '@dword-design/tester'
3- import testerPluginComponent from '@dword-design/tester-plugin-component'
4- import { expect } from '@playwright/test'
5- import { createRequire } from 'module'
6- import { chromium } from 'playwright'
1+ import { endent , filter } from '@dword-design/functions' ;
2+ import tester from '@dword-design/tester' ;
3+ import testerPluginComponent from '@dword-design/tester-plugin-component' ;
4+ import { expect } from '@playwright/test' ;
5+ import { createRequire } from 'module' ;
6+ import { chromium } from 'playwright' ;
77
8- const resolver = createRequire ( import . meta. url )
8+ const resolver = createRequire ( import . meta. url ) ;
99
1010export default tester (
1111 {
@@ -41,12 +41,13 @@ export default tester(
4141 </script>
4242 ` ,
4343 async test ( ) {
44- await this . page . goto ( 'http://localhost:3000' )
45- await this . page . waitForSelector ( '.foo svg' )
46- await this . page . click ( 'button' )
44+ await this . page . goto ( 'http://localhost:3000' ) ;
45+ await this . page . waitForSelector ( '.foo svg' ) ;
46+ await this . page . click ( 'button' ) ;
47+
4748 expect ( await this . page . screenshot ( '.foo svg' ) ) . toMatchImageSnapshot (
4849 this ,
49- )
50+ ) ;
5051 } ,
5152 } ,
5253 click : {
@@ -90,28 +91,32 @@ export default tester(
9091 </script>
9192 ` ,
9293 async test ( ) {
93- const callbackPrefix = 'mermaidClick_'
94- await this . page . goto ( 'http://localhost:3000' )
94+ const callbackPrefix = 'mermaidClick_' ;
95+ await this . page . goto ( 'http://localhost:3000' ) ;
96+
9597 await this . page . waitForSelector (
9698 '.diagram a[*|href="https://google.com"] .node[id^=flowchart-A-]' ,
97- )
99+ ) ;
100+
98101 expect (
99102 (
100103 this . page . evaluate ( ( ) => Object . keys ( window ) )
101104 | > await
102105 | > filter ( key => key . startsWith ( callbackPrefix ) )
103106 ) . length ,
104- ) . toEqual ( 1 )
105- await this . page . click ( '.diagram .node[id^=flowchart-B-]' )
106- await this . page . waitForSelector ( '.diagram.clicked' )
107- await this . page . click ( '.hide-button' )
107+ ) . toEqual ( 1 ) ;
108+
109+ await this . page . click ( '.diagram .node[id^=flowchart-B-]' ) ;
110+ await this . page . waitForSelector ( '.diagram.clicked' ) ;
111+ await this . page . click ( '.hide-button' ) ;
112+
108113 expect (
109114 (
110115 this . page . evaluate ( ( ) => Object . keys ( window ) )
111116 | > await
112117 | > filter ( key => key . startsWith ( callbackPrefix ) )
113118 ) . length ,
114- ) . toEqual ( 0 )
119+ ) . toEqual ( 0 ) ;
115120 } ,
116121 } ,
117122 /* 'click: multiple diagrams': {
@@ -206,10 +211,11 @@ export default tester(
206211 </script>
207212 ` ,
208213 async test ( ) {
209- await this . page . goto ( 'http://localhost:3000' )
214+ await this . page . goto ( 'http://localhost:3000' ) ;
215+
210216 await expect ( this . page . locator ( '.foo' ) ) . toHaveText (
211217 'UnknownDiagramError: No diagram type detected matching given configuration for text: foo' ,
212- )
218+ ) ;
213219 } ,
214220 } ,
215221 options : {
@@ -233,10 +239,11 @@ export default tester(
233239 </script>
234240 ` ,
235241 async test ( ) {
236- await this . page . goto ( 'http://localhost:3000' )
242+ await this . page . goto ( 'http://localhost:3000' ) ;
243+
237244 expect (
238245 await this . page . locator ( '.foo svg' ) . screenshot ( ) ,
239- ) . toMatchImageSnapshot ( this )
246+ ) . toMatchImageSnapshot ( this ) ;
240247 } ,
241248 } ,
242249 works : {
@@ -260,23 +267,24 @@ export default tester(
260267 </script>
261268 ` ,
262269 async test ( ) {
263- await this . page . goto ( 'http://localhost:3000' )
270+ await this . page . goto ( 'http://localhost:3000' ) ;
271+
264272 expect (
265273 await this . page . locator ( '.foo svg' ) . screenshot ( ) ,
266- ) . toMatchImageSnapshot ( this )
274+ ) . toMatchImageSnapshot ( this ) ;
267275 } ,
268276 } ,
269277 } ,
270278 [
271279 testerPluginComponent ( { componentPath : resolver . resolve ( './index.vue' ) } ) ,
272280 {
273281 async after ( ) {
274- await this . browser . close ( )
282+ await this . browser . close ( ) ;
275283 } ,
276284 async before ( ) {
277- this . browser = await chromium . launch ( )
278- this . page = await this . browser . newPage ( )
285+ this . browser = await chromium . launch ( ) ;
286+ this . page = await this . browser . newPage ( ) ;
279287 } ,
280288 } ,
281289 ] ,
282- )
290+ ) ;
0 commit comments