1+ import type { Locator } from '@playwright/test' ;
2+
13import type { WorkspaceCollabContext } from '@open-design/contracts' ;
24import { expect , test } from '@/playwright/suite' ;
35import { T } from '@/timeouts' ;
@@ -16,6 +18,27 @@ import {
1618
1719test . describe . configure ( { timeout : T . xlong } ) ;
1820
21+ /**
22+ * The BYOK half of Settings' Execution-mode switch.
23+ *
24+ * #5971 ("Polish Home and Settings terminology") renamed this tab's title from
25+ * `BYOK` to `API providers` — on `main` `settings.modeApiMeta` is still
26+ * `'BYOK'`, on this branch it is `'API providers'` — so the old
27+ * `getByRole('tab', { name: 'BYOK' })` matched nothing and every BYOK capture
28+ * below hung on an unactionable click until the test timed out. The product
29+ * copy is the acceptance result; the oracle follows it.
30+ *
31+ * Scoped to the Execution-mode tablist rather than matching the label
32+ * repo-wide: the BYOK pane renders its own `API protocol` tablist, and the
33+ * media section renders a tab per provider, so an unscoped name match is one
34+ * renamed provider away from resolving to the wrong tab.
35+ */
36+ function byokModeTab ( dialog : Locator ) : Locator {
37+ return dialog
38+ . getByRole ( 'tablist' , { name : 'Execution mode' } )
39+ . getByRole ( 'tab' , { name : / A P I p r o v i d e r s / i } ) ;
40+ }
41+
1942// The auto-provisioned personal workspace every signed-in identity has. Typed
2043// against the contract so a new required permission bit or context field fails
2144// typecheck here instead of drifting into a fixture that silently misrepresents
@@ -164,7 +187,7 @@ test('[P2] captures the settings BYOK surface', async ({ page }) => {
164187 await gotoVisualWorkspace ( page ) ;
165188
166189 const dialog = await prepareVisualSettingsDialog ( page ) ;
167- await dialog . getByRole ( 'tab' , { name : 'BYOK' } ) . click ( ) ;
190+ await byokModeTab ( dialog ) . click ( ) ;
168191 await expect ( dialog . getByRole ( 'tablist' , { name : 'API protocol' } ) ) . toBeVisible ( ) ;
169192 await expect ( dialog . getByRole ( 'heading' , { name : 'Anthropic API' } ) ) . toBeVisible ( ) ;
170193 await waitForVisualFonts ( page ) ;
@@ -187,7 +210,7 @@ test('[P2] captures the settings BYOK OpenAI surface', async ({ page }) => {
187210 await gotoVisualWorkspace ( page ) ;
188211
189212 const dialog = await prepareVisualSettingsDialog ( page ) ;
190- await dialog . getByRole ( 'tab' , { name : 'BYOK' } ) . click ( ) ;
213+ await byokModeTab ( dialog ) . click ( ) ;
191214 await dialog . getByRole ( 'tab' , { name : 'OpenAI' , exact : true } ) . click ( ) ;
192215 await expect ( dialog . getByRole ( 'heading' , { name : 'OpenAI API' } ) ) . toBeVisible ( ) ;
193216 await waitForVisualFonts ( page ) ;
@@ -210,7 +233,7 @@ test('[P2] captures the settings BYOK model dropdown surface', async ({ page })
210233 await gotoVisualWorkspace ( page ) ;
211234
212235 const dialog = await prepareVisualSettingsDialog ( page ) ;
213- await dialog . getByRole ( 'tab' , { name : 'BYOK' } ) . click ( ) ;
236+ await byokModeTab ( dialog ) . click ( ) ;
214237 await dialog . getByRole ( 'tab' , { name : 'OpenAI' , exact : true } ) . click ( ) ;
215238 const modelSelect = dialog . getByRole ( 'combobox' , { name : 'Model' , exact : true } ) ;
216239 await expect ( modelSelect ) . toBeVisible ( ) ;
0 commit comments