@@ -7,12 +7,17 @@ declare global {
77}
88
99test . describe ( 'VapiWidget Embed Tests' , ( ) => {
10- test ( 'should load widget from script tag with data attributes' , async ( { page } ) => {
10+ test ( 'should load widget from script tag with data attributes' , async ( {
11+ page,
12+ } ) => {
1113 // Navigate to the test page
1214 await page . goto ( '/test-widget-embed.html' ) ;
1315
1416 // Wait for the widget script to load
15- await page . waitForFunction ( ( ) => ( window as any ) . WidgetLoader !== undefined , { timeout : 5000 } ) ;
17+ await page . waitForFunction (
18+ ( ) => ( window as any ) . WidgetLoader !== undefined ,
19+ { timeout : 5000 }
20+ ) ;
1621
1722 // Check if widget container exists
1823 const widget1 = await page . locator ( '#vapi-widget-1' ) ;
@@ -33,16 +38,25 @@ test.describe('VapiWidget Embed Tests', () => {
3338 const widget = document . querySelector ( '#vapi-widget-1' ) ;
3439 if ( ! widget ) return false ;
3540 // Check for React root or any child elements
36- return widget . children . length > 0 || widget . shadowRoot !== null || widget . innerHTML !== '' ;
41+ return (
42+ widget . children . length > 0 ||
43+ widget . shadowRoot !== null ||
44+ widget . innerHTML !== ''
45+ ) ;
3746 } ) ;
3847 expect ( widgetInitialized ) . toBe ( true ) ;
3948 } ) ;
4049
41- test ( 'should load widget from script tag with data-props JSON' , async ( { page } ) => {
50+ test ( 'should load widget from script tag with data-props JSON' , async ( {
51+ page,
52+ } ) => {
4253 await page . goto ( '/test-widget-embed.html' ) ;
4354
4455 // Wait for the widget script to load
45- await page . waitForFunction ( ( ) => ( window as any ) . WidgetLoader !== undefined , { timeout : 5000 } ) ;
56+ await page . waitForFunction (
57+ ( ) => ( window as any ) . WidgetLoader !== undefined ,
58+ { timeout : 5000 }
59+ ) ;
4660
4761 // Check if widget container exists
4862 const widget2 = await page . locator ( '#vapi-widget-2' ) ;
@@ -62,7 +76,11 @@ test.describe('VapiWidget Embed Tests', () => {
6276 const widgetInitialized = await page . evaluate ( ( ) => {
6377 const widget = document . querySelector ( '#vapi-widget-2' ) ;
6478 if ( ! widget ) return false ;
65- return widget . children . length > 0 || widget . shadowRoot !== null || widget . innerHTML !== '' ;
79+ return (
80+ widget . children . length > 0 ||
81+ widget . shadowRoot !== null ||
82+ widget . innerHTML !== ''
83+ ) ;
6684 } ) ;
6785 expect ( widgetInitialized ) . toBe ( true ) ;
6886 } ) ;
@@ -77,12 +95,14 @@ test.describe('VapiWidget Embed Tests', () => {
7795 expect ( hasWidgetLoader ) . toBe ( true ) ;
7896 } ) ;
7997
80- test ( 'widget builds successfully and creates necessary files' , async ( { page } ) => {
98+ test ( 'widget builds successfully and creates necessary files' , async ( {
99+ page,
100+ } ) => {
81101 // Navigate to check if built files are accessible
82102 const styleResponse = await page . goto ( '/dist/style.css' ) ;
83103 expect ( styleResponse ?. status ( ) ) . toBe ( 200 ) ;
84-
104+
85105 const scriptResponse = await page . goto ( '/dist/widget.umd.js' ) ;
86106 expect ( scriptResponse ?. status ( ) ) . toBe ( 200 ) ;
87107 } ) ;
88- } ) ;
108+ } ) ;
0 commit comments