Skip to content

Commit 3c866aa

Browse files
jrupeshamtrack
andauthored
Update src/plugins/auth-providers/index.ts
Co-authored-by: Matthias Rolke <mr.amtrack@gmail.com>
1 parent f4af1ca commit 3c866aa

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

src/plugins/auth-providers/index.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff 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}`);

0 commit comments

Comments
 (0)