@@ -54,19 +54,32 @@ const observePageErrors = (page: Page) => {
5454 return pageErrors ;
5555} ;
5656
57+ const observeOpenCageRequests = ( page : Page ) => {
58+ const openCageRequests : string [ ] = [ ] ;
59+ page . on ( "request" , ( request ) => {
60+ if ( request . url ( ) . includes ( "api.opencagedata.com" ) ) {
61+ openCageRequests . push ( request . url ( ) ) ;
62+ }
63+ } ) ;
64+ return openCageRequests ;
65+ } ;
66+
5767test ( "app loads without triggering error boundary" , async ( { page } ) => {
5868 const pageErrors = observePageErrors ( page ) ;
69+ const openCageRequests = observeOpenCageRequests ( page ) ;
5970
6071 await page . goto ( "/" ) ;
6172
6273 await expect ( page . getByRole ( "heading" , { name : / f o r m a t i o n f l o o r p l a n e d i t o r / i } ) ) . toBeVisible ( ) ;
6374 await expect ( page . getByText ( / s o m e t h i n g w e n t w r o n g \. p l e a s e r e l o a d t h e e d i t o r \. / i) ) . toHaveCount ( 0 ) ;
6475 await expect ( page . getByRole ( "button" , { name : / s e l e c t m o d e / i } ) ) . toBeVisible ( ) ;
76+ expect ( openCageRequests ) . toEqual ( [ ] ) ;
6577 expect ( pageErrors ) . toEqual ( [ ] ) ;
6678} ) ;
6779
6880test ( "app loads with persisted overlay data" , async ( { page } ) => {
6981 const pageErrors = observePageErrors ( page ) ;
82+ const openCageRequests = observeOpenCageRequests ( page ) ;
7083
7184 await page . goto ( "/" ) ;
7285
@@ -100,11 +113,13 @@ test("app loads with persisted overlay data", async ({ page }) => {
100113
101114 await expect ( page . getByRole ( "heading" , { name : / f o r m a t i o n f l o o r p l a n e d i t o r / i } ) ) . toBeVisible ( ) ;
102115 await expect ( page . getByText ( / s o m e t h i n g w e n t w r o n g \. p l e a s e r e l o a d t h e e d i t o r \. / i) ) . toHaveCount ( 0 ) ;
116+ expect ( openCageRequests ) . toEqual ( [ ] ) ;
103117 expect ( pageErrors ) . toEqual ( [ ] ) ;
104118} ) ;
105119
106120test ( "app loads with malformed persisted snapshot" , async ( { page } ) => {
107121 const pageErrors = observePageErrors ( page ) ;
122+ const openCageRequests = observeOpenCageRequests ( page ) ;
108123
109124 await page . goto ( "/" ) ;
110125
@@ -148,11 +163,13 @@ test("app loads with malformed persisted snapshot", async ({ page }) => {
148163
149164 await expect ( page . getByRole ( "heading" , { name : / f o r m a t i o n f l o o r p l a n e d i t o r / i } ) ) . toBeVisible ( ) ;
150165 await expect ( page . getByText ( / s o m e t h i n g w e n t w r o n g \. p l e a s e r e l o a d t h e e d i t o r \. / i) ) . toHaveCount ( 0 ) ;
166+ expect ( openCageRequests ) . toEqual ( [ ] ) ;
151167 expect ( pageErrors ) . toEqual ( [ ] ) ;
152168} ) ;
153169
154170test ( "critical journey: edit building details and survive reload" , async ( { page } ) => {
155171 const pageErrors = observePageErrors ( page ) ;
172+ const openCageRequests = observeOpenCageRequests ( page ) ;
156173
157174 await page . goto ( "/" ) ;
158175 await expect ( page . getByRole ( "heading" , { name : / f o r m a t i o n f l o o r p l a n e d i t o r / i } ) ) . toBeVisible ( ) ;
@@ -181,5 +198,6 @@ test("critical journey: edit building details and survive reload", async ({ page
181198 } ) ;
182199 await expect ( reloadedPanel . getByLabel ( "Name" ) ) . toHaveValue ( "Journey Building" ) ;
183200 await expect ( page . getByText ( / s o m e t h i n g w e n t w r o n g \. p l e a s e r e l o a d t h e e d i t o r \. / i) ) . toHaveCount ( 0 ) ;
201+ expect ( openCageRequests ) . toEqual ( [ ] ) ;
184202 expect ( pageErrors ) . toEqual ( [ ] ) ;
185203} ) ;
0 commit comments