diff --git a/src/components/wizard/RemoteConfigStep.test.tsx b/src/components/wizard/RemoteConfigStep.test.tsx index 2d6cdad..2677158 100644 --- a/src/components/wizard/RemoteConfigStep.test.tsx +++ b/src/components/wizard/RemoteConfigStep.test.tsx @@ -119,4 +119,112 @@ describe('RemoteConfigStep', () => { }); }); }); + + describe('BACK-01 (Phase 6): OneDrive form', () => { + it('renders OAuth Token field', async () => { + renderWithBackend('onedrive' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/oauth token/i)).toBeDefined(); + }); + }); + it('renders Drive ID field', async () => { + renderWithBackend('onedrive' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/drive id/i)).toBeDefined(); + }); + }); + it('renders Drive Type select', async () => { + renderWithBackend('onedrive' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/drive type/i)).toBeDefined(); + }); + }); + }); + + describe('BACK-02 (Phase 6): SFTP form', () => { + it('renders Host field', async () => { + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/host/i)).toBeDefined(); + }); + }); + it('renders Username field', async () => { + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/username/i)).toBeDefined(); + }); + }); + it('shows Password tab button by default', async () => { + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByText(/^password$/i, { selector: 'button' })).toBeDefined(); + }); + }); + it('shows Private Key tab button', async () => { + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByText(/private key/i, { selector: 'button' })).toBeDefined(); + }); + }); + it('switching to Private Key tab CSS-hides password field and shows key_pem field', async () => { + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByText(/private key/i, { selector: 'button' })).toBeDefined(); + }); + fireEvent.click(screen.getByText(/private key/i, { selector: 'button' })); + await waitFor(() => { + const passInput = screen.getByLabelText(/^password$/i); + const passWrapper = passInput.closest('div.hidden'); + expect(passWrapper).toBeDefined(); + const keyInput = screen.getByLabelText(/private key.*pem/i); + const keyWrapper = keyInput.closest('div.block'); + expect(keyWrapper).toBeDefined(); + }); + }); + it('switching SFTP auth tabs preserves hidden field value', async () => { + const user = userEvent.setup(); + renderWithBackend('sftp' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/^password$/i)).toBeDefined(); + }); + await user.type(screen.getByLabelText(/^password$/i), 'mysftppass'); + fireEvent.click(screen.getByText(/private key/i, { selector: 'button' })); + fireEvent.click(screen.getByText(/^password$/i, { selector: 'button' })); + await waitFor(() => { + const input = screen.getByLabelText(/^password$/i) as HTMLInputElement; + expect(input.value).toBe('mysftppass'); + }); + }); + }); + + describe('BACK-03 (Phase 6): Google Cloud Storage form', () => { + it('renders Project Number field', async () => { + renderWithBackend('gcs' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/project number/i)).toBeDefined(); + }); + }); + it('renders Service Account JSON field', async () => { + renderWithBackend('gcs' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/service account json/i)).toBeDefined(); + }); + }); + }); + + describe('BACK-04 (Phase 6): Backblaze B2 form', () => { + it('renders Application Key ID field', async () => { + renderWithBackend('b2' as BackendType); + await waitFor(() => { + expect(screen.getByLabelText(/application key id/i)).toBeDefined(); + }); + }); + it('renders Application Key field', async () => { + renderWithBackend('b2' as BackendType); + await waitFor(() => { + // Matches "Application Key" but not "Application Key ID" + expect(screen.getByLabelText(/application key$/i)).toBeDefined(); + }); + }); + }); });