From 84c2e7409a61854d415a1032775e6780bb2cd2fb Mon Sep 17 00:00:00 2001 From: Wen Bo Xie Date: Wed, 5 Aug 2026 13:47:41 +0700 Subject: [PATCH] test(studio): cover the review step's legacy token link The MCP-unsupported notice on the review step links back into legacy mode; it was the only untested mode-switch entry point. --- .../Scoped/NewScopedTokenSheet.test.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx index f6ef73a96e0..6049dae06c7 100644 --- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx +++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/NewScopedTokenSheet.test.tsx @@ -279,6 +279,27 @@ describe('NewScopedTokenSheet', () => { expect(screen.queryByText('Access tokens can be used to control your whole account')).toBeNull() expect(screen.queryByText('Please select an organization to continue.')).toBeNull() }) + test('switches to the classic token form from the review step MCP notice', async () => { + renderSheet() + fireEvent.click(await screen.findByRole('button', { name: 'Generate new token' })) + await screen.findByRole('dialog') + await user.type(await screen.findByLabelText('Name'), 'test') + fireEvent.click(await screen.findByRole('combobox', { name: 'Organization' })) + fireEvent.click(await screen.findByRole('option', { name: 'Acme Production' })) + fireEvent.click(await screen.findByRole('combobox', { name: 'Projects' })) + fireEvent.click(await screen.findByRole('option', { name: 'Project 1' })) + // Permission categories start collapsed; expand "Project" to reach its rows + fireEvent.click(await screen.findByRole('button', { name: /Core project visibility/ })) + fireEvent.click(await screen.findByLabelText('Project Settings', { exact: false })) + fireEvent.click(await screen.findByRole('option', { name: 'Read' })) + fireEvent.click(await screen.findByRole('button', { name: 'Review access' })) + // The MCP-unsupported notice on the review step links back into legacy mode + await user.click(await screen.findByText('create a legacy token')) + await screen.findByText('Access tokens can be used to control your whole account') + await screen.findByRole('button', { name: 'Generate token' }) + expect(screen.queryByRole('button', { name: 'Review access' })).toBeNull() + expect(screen.queryByRole('button', { name: 'Create token' })).toBeNull() + }) test('creates a classic token via the legacy link', async () => { renderSheet() fireEvent.click(await screen.findByRole('button', { name: 'Generate new token' }))