File tree Expand file tree Collapse file tree
src/plugins/auth-providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,27 +95,10 @@ export class AuthProviders extends BrowserforcePlugin {
9595 // Save the changes
9696 const saveButtonLocator = page . locator ( SAVE_BUTTON_SELECTOR ) ;
9797 await saveButtonLocator . first ( ) . click ( ) ;
98-
99- // Wait for save to complete - give it time to process
100- // The page might reload or show a success/error message
101- await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
102-
103- // Check for errors on the page/frame
104- // If the frame still exists, check it; otherwise check the main page
105- try {
106- // Try to check for errors in the frame first
107- const errorLocator = frameOrPage . locator ( 'div.errorMsg, div.error, .errorMessage, #errorTitle' ) ;
108- const errorCount = await errorLocator . count ( ) ;
109- if ( errorCount > 0 ) {
110- const errorText = await errorLocator . first ( ) . textContent ( ) ;
111- if ( errorText && ! errorText . includes ( 'page no longer exists' ) ) {
112- throw new Error ( `Save failed: ${ errorText . trim ( ) } ` ) ;
113- }
114- }
115- } catch ( e ) {
116- // If checking frame fails, check the main page
117- await waitForPageErrors ( page ) ;
118- }
98+ await Promise . race ( [
99+ page . waitForURL ( ( url ) => url . pathname === `/${ authProviderId } ` ) ,
100+ waitForPageErrors ( page ) ,
101+ ] ) ;
119102 }
120103 } catch ( error ) {
121104 throw new Error ( `Failed to update AuthProvider '${ developerName } ': ${ error . message } ` ) ;
You can’t perform that action at this time.
0 commit comments