@@ -30,7 +30,6 @@ export class CreateWorkspace {
3030
3131 private static readonly AI_PROVIDER_SELECTOR_HEADING : By = By . xpath ( '//h3[text()="AI Provider Selector"]' ) ;
3232 private static readonly AI_PROVIDER_CHOOSE_TOGGLE : By = By . id ( 'accordion-item-ai-selector' ) ;
33- private static readonly AI_PROVIDER_KEY_CONFIGURED_BADGE : By = By . xpath ( '//span[text()=" Key configured"]' ) ;
3433
3534 constructor (
3635 @inject ( CLASSES . DriverHelper )
@@ -225,10 +224,18 @@ export class CreateWorkspace {
225224 await this . driverHelper . waitVisibility ( this . getAiProviderCardLocator ( providerId ) , timeout ) ;
226225 }
227226
228- async isAiProviderKeyConfiguredBadgeVisible ( ) : Promise < boolean > {
229- Logger . debug ( ) ;
227+ /**
228+ * waits for the configured-key badge within the selected provider card.
229+ * @param providerId registry provider identifier
230+ * @param timeout maximum wait time in milliseconds
231+ */
232+ async waitAiProviderKeyConfiguredBadgeVisible (
233+ providerId : string ,
234+ timeout : number = TIMEOUT_CONSTANTS . TS_COMMON_DASHBOARD_WAIT_TIMEOUT
235+ ) : Promise < void > {
236+ Logger . debug ( `providerId: "${ providerId } "` ) ;
230237
231- return await this . driverHelper . isVisible ( CreateWorkspace . AI_PROVIDER_KEY_CONFIGURED_BADGE ) ;
238+ await this . driverHelper . waitVisibility ( this . getAiProviderKeyConfiguredBadgeLocator ( providerId ) , timeout ) ;
232239 }
233240
234241 private getEditorsDropdownListLocator ( sampleName : string ) : By {
@@ -265,6 +272,16 @@ export class CreateWorkspace {
265272 return By . id ( `ai-provider-card-${ cardId } ` ) ;
266273 }
267274
275+ /**
276+ * locates the selected provider's configured-key badge independently of surrounding whitespace.
277+ * @param providerId registry provider identifier
278+ * @returns provider-scoped badge locator
279+ */
280+ private getAiProviderKeyConfiguredBadgeLocator ( providerId : string ) : By {
281+ const cardId : string = providerId . replace ( / \/ / g, '-' ) ;
282+ return By . xpath ( `//*[@id="ai-provider-card-${ cardId } "]//span[normalize-space(.)="Key configured"]` ) ;
283+ }
284+
268285 private getGitBranchListItemLocator ( branchName : string ) : By {
269286 return By . xpath ( `//ul[@role="listbox"]//span[text()="${ branchName } "]` ) ;
270287 }
0 commit comments