From 2c596c96a0f4fc0c68dcc02deb6e4aa950ad02d1 Mon Sep 17 00:00:00 2001 From: Kawa Date: Wed, 1 Apr 2026 16:58:00 +0200 Subject: [PATCH] test(13-04): add tests for new backend form rendering - Test gdrive: GdriveAuthToggle with OAuth Token and Service Account tabs - Test dropbox: OAuthInstructions toggle button visible - Test ftp: host, username, password, port, TLS mode fields - Test webdav: URL, username, password, vendor select fields - Test smb: host and username fields - Test http: only URL field, no username/password --- .../wizard/RemoteConfigStep.test.tsx | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/components/wizard/RemoteConfigStep.test.tsx b/src/components/wizard/RemoteConfigStep.test.tsx index de5d305..5758461 100644 --- a/src/components/wizard/RemoteConfigStep.test.tsx +++ b/src/components/wizard/RemoteConfigStep.test.tsx @@ -448,4 +448,59 @@ describe('RemoteConfigStep', () => { }); }); }); + + describe('New backend form rendering (Plan 13-04)', () => { + it('gdrive renders GdriveAuthToggle with OAuth Token and Service Account tabs', async () => { + renderWithBackend('gdrive'); + await waitFor(() => { + expect(screen.getByText(/oauth token/i, { selector: 'button' })).toBeDefined(); + expect(screen.getByText(/service account/i, { selector: 'button' })).toBeDefined(); + }); + }); + + it('dropbox renders OAuthInstructions toggle button', async () => { + renderWithBackend('dropbox'); + await waitFor(() => { + expect(screen.getByRole('button', { name: /how to get your dropbox oauth token/i })).toBeDefined(); + }); + }); + + it('ftp renders host, username, password, port, TLS mode fields', async () => { + renderWithBackend('ftp'); + await waitFor(() => { + expect(screen.getByLabelText(/host/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/username/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/^password/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/port/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/tls mode/i)).toBeDefined(); + }); + }); + + it('webdav renders URL, username, password, vendor select fields', async () => { + renderWithBackend('webdav'); + await waitFor(() => { + expect(screen.getByLabelText(/webdav url/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/username/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/^password/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/vendor/i)).toBeDefined(); + }); + }); + + it('smb renders host and username fields', async () => { + renderWithBackend('smb'); + await waitFor(() => { + expect(screen.getByLabelText(/host/i, { selector: 'input' })).toBeDefined(); + expect(screen.getByLabelText(/username/i, { selector: 'input' })).toBeDefined(); + }); + }); + + it('http renders only URL field', async () => { + renderWithBackend('http'); + await waitFor(() => { + expect(screen.getByLabelText(/^url/i, { selector: 'input' })).toBeDefined(); + }); + // No username or password fields for http (read-only) + expect(screen.queryByLabelText(/username/i, { selector: 'input' })).toBeNull(); + }); + }); });