mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 18:34:09 +00:00
test(components): cover map, collections, settings, journey and admin
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { http, HttpResponse } from 'msw'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { server } from '../../../tests/helpers/msw/server'
|
||||
import { fireEvent, render, screen, waitFor } from '../../../tests/helpers/render'
|
||||
import { fireEvent, render, screen, waitFor, within } from '../../../tests/helpers/render'
|
||||
import { resetAllStores } from '../../../tests/helpers/store'
|
||||
import { ToastContainer } from '../shared/Toast'
|
||||
import AdminPluginsPanel from './AdminPluginsPanel'
|
||||
|
||||
/**
|
||||
@@ -482,3 +484,825 @@ describe('AdminPluginsPanel — TREK-version compatibility', () => {
|
||||
expect(await screen.findByText(/needs trek >=3\.2\.0 <4\.0\.0/i)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* The rest of the panel: load states, the toolbar, sideloading, the row actions behind the
|
||||
* ⋯ menu, and the dialog each 409 routes to.
|
||||
*/
|
||||
function panelWith(
|
||||
plugins: Record<string, unknown>[],
|
||||
opts: { enabled?: boolean; devLink?: boolean; registry?: Record<string, unknown>[] } = {},
|
||||
) {
|
||||
server.use(
|
||||
http.get('*/api/admin/plugins', () => HttpResponse.json({
|
||||
enabled: opts.enabled ?? true, devLink: opts.devLink ?? false, plugins,
|
||||
})),
|
||||
http.get('*/api/admin/plugins/registry', () => HttpResponse.json(opts.registry ?? [])),
|
||||
)
|
||||
}
|
||||
|
||||
function withToast() {
|
||||
return render(<><ToastContainer /><AdminPluginsPanel /></>)
|
||||
}
|
||||
|
||||
/** The Discover tab is a role="tab"; the empty state offers a plain button with the same label. */
|
||||
async function clickDiscover() {
|
||||
const tabs = await screen.findAllByRole('tab', { name: /^discover/i })
|
||||
fireEvent.click(tabs[0])
|
||||
}
|
||||
|
||||
/** The panel root, which owns the drag-and-drop handlers. */
|
||||
function panelRoot(container: HTMLElement): HTMLElement {
|
||||
return (container.querySelector('input[type="file"]') as HTMLElement).parentElement as HTMLElement
|
||||
}
|
||||
|
||||
/** Opens one of the toolbar dropdowns (identified by its current title) and picks an option. */
|
||||
async function pickFilter(trigger: RegExp, option: RegExp) {
|
||||
fireEvent.click(await screen.findByTitle(trigger))
|
||||
fireEvent.click(await screen.findByRole('button', { name: option }))
|
||||
}
|
||||
|
||||
/** The enable toggle of a named installed row. */
|
||||
function rowToggle(name: string): HTMLElement {
|
||||
const row = screen.getByText(name).closest('.group') as HTMLElement
|
||||
return within(row).getByRole('button', { name: 'Enable plugin' })
|
||||
}
|
||||
|
||||
describe('AdminPluginsPanel — load states and toolbar', () => {
|
||||
it('FE-COMP-PLUGINS-PANEL-001: a failing plugin list shows the load error instead of an empty list', async () => {
|
||||
server.use(http.get('*/api/admin/plugins', () => HttpResponse.error()))
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByText('Could not load plugins.')).toBeInTheDocument()
|
||||
expect(screen.queryByPlaceholderText('Search plugins…')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-002: a disabled runtime replaces the whole body with the notice', async () => {
|
||||
panelWith([plugin()], { enabled: false })
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByText('Plugins are disabled')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Gotify')).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('Runtime on')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-003: with nothing installed the empty state jumps to Discover', async () => {
|
||||
panelWith([])
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
await screen.findByText('No plugins installed yet.')
|
||||
expect(screen.getByText('Runtime on')).toBeInTheDocument()
|
||||
fireEvent.click(screen.getAllByRole('button', { name: /^discover/i }).pop()!)
|
||||
|
||||
expect(await screen.findByText('No plugins available in the registry yet.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-004: the search box filters the installed list and says when nothing matches', async () => {
|
||||
panelWith([plugin({ id: 'a', name: 'Gotify' }), plugin({ id: 'b', name: 'Ntfy', description: 'Push too' })])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('Search plugins…'), { target: { value: 'ntfy' } })
|
||||
expect(screen.queryByText('Gotify')).not.toBeInTheDocument()
|
||||
expect(screen.getByText('Ntfy')).toBeInTheDocument()
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('Search plugins…'), { target: { value: 'zzz' } })
|
||||
expect(screen.getByText('No installed plugins match your search.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-005: the type filter narrows the list and marks itself active', async () => {
|
||||
panelWith([
|
||||
plugin({ id: 'a', name: 'Gotify', type: 'integration' }),
|
||||
plugin({ id: 'b', name: 'Countdown', type: 'widget' }),
|
||||
])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
await pickFilter(/^Type: All types$/, /^Widget$/)
|
||||
|
||||
expect(await screen.findByTitle('Type: Widget')).toBeInTheDocument()
|
||||
expect(screen.getByText('Countdown')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Gotify')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-006: the status filter separates off, error and update-available rows', async () => {
|
||||
panelWith([
|
||||
plugin({ id: 'trek-gotify', name: 'OnOne', enabled: 1, status: 'active', version: '1.0.0', source_repo: 'acme/gotify' }),
|
||||
plugin({ id: 'off-one', name: 'OffOne', enabled: 0, status: 'inactive' }),
|
||||
plugin({ id: 'bad-one', name: 'BadOne', enabled: 1, status: 'error', last_error: 'boom' }),
|
||||
], { registry: [registryEntry({ latest: '2.0.0' })] })
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('OnOne')
|
||||
|
||||
await pickFilter(/^Status: All$/, /^Off$/)
|
||||
expect(await screen.findByText('OffOne')).toBeInTheDocument()
|
||||
expect(screen.queryByText('OnOne')).not.toBeInTheDocument()
|
||||
|
||||
await pickFilter(/^Status: Off$/, /^Error$/)
|
||||
expect(await screen.findByText('BadOne')).toBeInTheDocument()
|
||||
expect(screen.getByText('boom')).toBeInTheDocument()
|
||||
|
||||
await pickFilter(/^Status: Error$/, /^Update available$/)
|
||||
expect(await screen.findByText('OnOne')).toBeInTheDocument()
|
||||
expect(screen.queryByText('BadOne')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-007: an installed-only sort key snaps back to Name on the Discover tab', async () => {
|
||||
panelWith([plugin()], { registry: [registryEntry()] })
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
await pickFilter(/^Sort: Name$/, /^Updates first$/)
|
||||
expect(await screen.findByTitle('Sort: Updates first')).toBeInTheDocument()
|
||||
|
||||
await clickDiscover()
|
||||
await waitFor(() => expect(screen.getByTitle('Sort: Name')).toBeInTheDocument())
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-008: rescan re-pulls the registry past its cache and confirms with a toast', async () => {
|
||||
const refreshFlags: (string | null)[] = []
|
||||
panelWith([plugin()])
|
||||
server.use(
|
||||
http.post('*/api/admin/plugins/rescan', () => HttpResponse.json({ ok: true })),
|
||||
http.get('*/api/admin/plugins/registry', ({ request }) => {
|
||||
refreshFlags.push(new URL(request.url).searchParams.get('refresh'))
|
||||
return HttpResponse.json([registryEntry({ latest: '2.0.0' })])
|
||||
}),
|
||||
)
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(screen.getAllByTitle('Rescan')[0])
|
||||
|
||||
expect(await screen.findByText('Rescanned the plugins folder')).toBeInTheDocument()
|
||||
expect(refreshFlags).toContain('1')
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — sideloading', () => {
|
||||
const zip = () => new File(['zip'], 'plugin.zip', { type: 'application/zip' })
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-009: the toolbar button opens the hidden picker and uploads the pick', async () => {
|
||||
panelWith([plugin()])
|
||||
server.use(http.post('*/api/admin/plugins/upload', () => HttpResponse.json({ id: 'trek-new' })))
|
||||
const { container } = withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
const input = container.querySelector('input[type="file"]') as HTMLInputElement
|
||||
const clickSpy = vi.spyOn(input, 'click').mockImplementation(() => {})
|
||||
fireEvent.click(screen.getAllByTitle('Upload plugin')[0])
|
||||
expect(clickSpy).toHaveBeenCalled()
|
||||
clickSpy.mockRestore()
|
||||
|
||||
await userEvent.upload(input, zip())
|
||||
expect(await screen.findByText(/trek-new.*uploaded/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-010: a rejected upload surfaces the server message', async () => {
|
||||
panelWith([plugin()])
|
||||
server.use(http.post('*/api/admin/plugins/upload', () => HttpResponse.json({ error: 'not a plugin archive' }, { status: 400 })))
|
||||
const { container } = withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
await userEvent.upload(container.querySelector('input[type="file"]') as HTMLInputElement, zip())
|
||||
|
||||
expect(await screen.findByText('not a plugin archive')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-011: dragging a file over the panel offers a drop target and installs it', async () => {
|
||||
let uploaded = false
|
||||
panelWith([plugin()])
|
||||
server.use(http.post('*/api/admin/plugins/upload', () => { uploaded = true; return HttpResponse.json({ id: 'trek-dropped' }) }))
|
||||
const { container } = withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
const panel = panelRoot(container)
|
||||
const dataTransfer = { types: ['Files'], files: [zip()] }
|
||||
fireEvent.dragEnter(panel, { dataTransfer })
|
||||
expect(await screen.findByText('Drop a plugin .zip to install')).toBeInTheDocument()
|
||||
|
||||
fireEvent.dragLeave(panel, { dataTransfer })
|
||||
await waitFor(() => expect(screen.queryByText('Drop a plugin .zip to install')).not.toBeInTheDocument())
|
||||
|
||||
fireEvent.dragEnter(panel, { dataTransfer })
|
||||
fireEvent.dragOver(panel, { dataTransfer })
|
||||
fireEvent.drop(panel, { dataTransfer })
|
||||
|
||||
await waitFor(() => expect(uploaded).toBe(true))
|
||||
expect(await screen.findByText(/trek-dropped.*uploaded/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-012: a drag that carries no files is ignored', async () => {
|
||||
panelWith([plugin()])
|
||||
const { container } = render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.dragEnter(panelRoot(container), { dataTransfer: { types: ['text/plain'], files: [] } })
|
||||
|
||||
expect(screen.queryByText('Drop a plugin .zip to install')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-013: the dev-link form registers a local path and reports failures', async () => {
|
||||
const paths: string[] = []
|
||||
panelWith([plugin()], { devLink: true })
|
||||
server.use(http.post('*/api/admin/plugins/link', async ({ request }) => {
|
||||
const body = await request.json() as { path: string }
|
||||
paths.push(body.path)
|
||||
return paths.length === 1
|
||||
? HttpResponse.json({ id: 'trek-local' })
|
||||
: HttpResponse.json({ error: 'no manifest there' }, { status: 400 })
|
||||
}))
|
||||
withToast()
|
||||
const input = await screen.findByPlaceholderText('/absolute/path/to/your/plugin')
|
||||
|
||||
expect(screen.getByRole('button', { name: /^link$/i })).toBeDisabled()
|
||||
|
||||
fireEvent.change(input, { target: { value: '/srv/plugins/mine' } })
|
||||
fireEvent.click(screen.getByRole('button', { name: /^link$/i }))
|
||||
expect(await screen.findByText(/linked trek-local/i)).toBeInTheDocument()
|
||||
expect(paths).toEqual(['/srv/plugins/mine'])
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('/absolute/path/to/your/plugin'), { target: { value: '/nope' } })
|
||||
fireEvent.click(screen.getByRole('button', { name: /^link$/i }))
|
||||
expect(await screen.findByText('no manifest there')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — row actions', () => {
|
||||
async function openRowMenu(p: Record<string, unknown> = plugin()) {
|
||||
panelWith([p])
|
||||
withToast()
|
||||
fireEvent.click(await screen.findByTestId(`plugin-row-menu-btn-${p.id}`))
|
||||
}
|
||||
|
||||
/** Every modal in the panel closes by clicking its backdrop. */
|
||||
function closeModal() {
|
||||
fireEvent.click(document.querySelector('.fixed.inset-0.z-50') as HTMLElement)
|
||||
}
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-014: the error log lists what the runtime recorded', async () => {
|
||||
server.use(http.get('*/api/admin/plugins/trek-gotify/errors', () =>
|
||||
HttpResponse.json({ errors: [{ ts: '2026-01-01T00:00:00Z', level: 'error', message: 'connect ECONNREFUSED' }] })))
|
||||
await openRowMenu()
|
||||
|
||||
fireEvent.click(screen.getByText('View error log'))
|
||||
expect(await screen.findByText('connect ECONNREFUSED')).toBeInTheDocument()
|
||||
expect(screen.getByText('error')).toBeInTheDocument()
|
||||
|
||||
closeModal()
|
||||
await waitFor(() => expect(screen.queryByText('connect ECONNREFUSED')).not.toBeInTheDocument())
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-015: an unreachable error log still opens, empty', async () => {
|
||||
server.use(http.get('*/api/admin/plugins/trek-gotify/errors', () => HttpResponse.error()))
|
||||
await openRowMenu()
|
||||
|
||||
fireEvent.click(screen.getByText('View error log'))
|
||||
|
||||
expect(await screen.findByText('No errors logged.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-016: allowed hosts can be added and removed, and a rejected save says why', async () => {
|
||||
let hosts: string[] = []
|
||||
let puts = 0
|
||||
server.use(
|
||||
http.get('*/api/admin/plugins/trek-gotify/egress-hosts', () => HttpResponse.json({ supported: true, hosts })),
|
||||
http.put('*/api/admin/plugins/trek-gotify/egress-hosts', async ({ request }) => {
|
||||
puts += 1
|
||||
const body = await request.json() as { hosts: string[] }
|
||||
if (puts === 3) return HttpResponse.json({ error: 'not a valid host' }, { status: 400 })
|
||||
hosts = body.hosts
|
||||
return HttpResponse.json({ hosts })
|
||||
}),
|
||||
)
|
||||
await openRowMenu()
|
||||
|
||||
fireEvent.click(screen.getByText('Allowed hosts'))
|
||||
expect(await screen.findByText('No hosts added yet.')).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: /^add$/i })).toBeDisabled()
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('gotify.example.com'), { target: { value: 'gotify.lan' } })
|
||||
fireEvent.click(screen.getByRole('button', { name: /^add$/i }))
|
||||
expect(await screen.findByText('gotify.lan')).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getAllByLabelText('Delete')[0])
|
||||
await waitFor(() => expect(screen.getByText('No hosts added yet.')).toBeInTheDocument())
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('gotify.example.com'), { target: { value: 'bad host' } })
|
||||
fireEvent.click(screen.getByRole('button', { name: /^add$/i }))
|
||||
expect(await screen.findByText('not a valid host')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-017: a plugin whose hosts are fixed in its manifest says the list is unsupported', async () => {
|
||||
server.use(http.get('*/api/admin/plugins/trek-gotify/egress-hosts', () => HttpResponse.error()))
|
||||
await openRowMenu()
|
||||
|
||||
fireEvent.click(screen.getByText('Allowed hosts'))
|
||||
|
||||
expect(await screen.findByText(/does not use operator-supplied hosts/i)).toBeInTheDocument()
|
||||
expect(screen.queryByPlaceholderText('gotify.example.com')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-018: Delete asks first, then uninstalls with its data', async () => {
|
||||
let body: unknown = null
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/uninstall', async ({ request }) => {
|
||||
body = await request.json()
|
||||
return HttpResponse.json({ ok: true })
|
||||
}))
|
||||
await openRowMenu()
|
||||
|
||||
fireEvent.click(screen.getByText('Delete'))
|
||||
expect(await screen.findByText('Uninstall plugin?')).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getAllByRole('button', { name: /^delete$/i }).pop()!)
|
||||
|
||||
expect(await screen.findByText('Plugin uninstalled')).toBeInTheDocument()
|
||||
expect(body).toEqual({ deleteData: true })
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-019: Restart cycles the plugin off and on again', async () => {
|
||||
const seen: string[] = []
|
||||
server.use(
|
||||
http.post('*/api/admin/plugins/trek-gotify/deactivate', () => { seen.push('deactivate'); return HttpResponse.json({ ok: true }) }),
|
||||
http.post('*/api/admin/plugins/trek-gotify/activate', () => { seen.push('activate'); return HttpResponse.json({ ok: true }) }),
|
||||
)
|
||||
await openRowMenu(plugin({ enabled: 1, status: 'active' }))
|
||||
|
||||
fireEvent.click(screen.getByText('Restart'))
|
||||
|
||||
expect(await screen.findByText('Plugin restarted')).toBeInTheDocument()
|
||||
expect(seen).toEqual(['deactivate', 'activate'])
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-020: a disabled plugin offers no Restart', async () => {
|
||||
await openRowMenu(plugin({ enabled: 0, status: 'inactive' }))
|
||||
|
||||
expect(screen.getByText('View error log')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Restart')).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — enabling a plugin', () => {
|
||||
it('FE-COMP-PLUGINS-PANEL-021: turning a plugin off deactivates it', async () => {
|
||||
let called = false
|
||||
panelWith([plugin({ enabled: 1, status: 'active' })])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/deactivate', () => { called = true; return HttpResponse.json({ ok: true }) }))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText('Plugin deactivated')).toBeInTheDocument()
|
||||
expect(called).toBe(true)
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-022: turning one on also reports the dependencies it enabled first', async () => {
|
||||
panelWith([
|
||||
plugin({ enabled: 0, status: 'inactive', dependencies: { pluginDependencies: [{ id: 'trek-core', version: '^1.0.0' }] } }),
|
||||
plugin({ id: 'trek-core', name: 'Core', enabled: 0, status: 'inactive' }),
|
||||
])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/activate', () => HttpResponse.json({ ok: true })))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText('Plugin activated')).toBeInTheDocument()
|
||||
expect(await screen.findByText(/enabled required plugin\(s\) first: core/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-023: a disabled required addon is reported as a toast, not a dialog', async () => {
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive' })])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/activate', () =>
|
||||
HttpResponse.json({ code: 'ADDON_DISABLED', addons: ['journey'] }, { status: 409 })))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText(/enable the required addon\(s\) first: journey/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-024: any other activation failure surfaces the server message', async () => {
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive' })])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/activate', () =>
|
||||
HttpResponse.json({ code: 'DEPENDENCY_CYCLE', error: 'circular dependency' }, { status: 409 })))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText('circular dependency')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-025: a missing dependency opens the resolve dialog and one click fixes it', async () => {
|
||||
let activates = 0
|
||||
let installed: unknown = null
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive' })])
|
||||
server.use(
|
||||
http.post('*/api/admin/plugins/trek-gotify/activate', () => {
|
||||
activates += 1
|
||||
return activates === 1
|
||||
? HttpResponse.json({
|
||||
code: 'DEPENDENCY_MISSING',
|
||||
missing: [{ id: 'trek-core', version: '^1.0.0' }],
|
||||
versionMismatch: [{ id: 'trek-old', wanted: '^2.0.0', installed: '1.0.0' }],
|
||||
}, { status: 409 })
|
||||
: HttpResponse.json({ ok: true })
|
||||
}),
|
||||
http.post('*/api/admin/plugins/install', async ({ request }) => {
|
||||
installed = await request.json()
|
||||
return HttpResponse.json({ installed: ['trek-core'], requiredAddons: ['journey'] })
|
||||
}),
|
||||
)
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
expect(await screen.findByText('Missing dependencies')).toBeInTheDocument()
|
||||
expect(screen.getByText('Requires ^1.0.0')).toBeInTheDocument()
|
||||
expect(screen.getByText('Needs ^2.0.0 — 1.0.0 is installed')).toBeInTheDocument()
|
||||
expect(screen.getByText(/downloads the latest compatible version/i)).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /^download$/i }))
|
||||
|
||||
expect(await screen.findByText('Downloaded trek-core')).toBeInTheDocument()
|
||||
expect(installed).toEqual({ id: 'trek-core', constraint: '^1.0.0', withDependencies: true })
|
||||
expect(await screen.findByText(/enable the required addon\(s\) first: journey/i)).toBeInTheDocument()
|
||||
await waitFor(() => expect(screen.queryByText('Missing dependencies')).not.toBeInTheDocument())
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-026: the resolve dialog can be dismissed without downloading anything', async () => {
|
||||
let installs = 0
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive' })])
|
||||
server.use(
|
||||
http.post('*/api/admin/plugins/trek-gotify/activate', () =>
|
||||
HttpResponse.json({ code: 'DEPENDENCY_MISSING', missing: [{ id: 'trek-core', version: '^1.0.0' }], versionMismatch: [] }, { status: 409 })),
|
||||
http.post('*/api/admin/plugins/install', () => { installs += 1; return HttpResponse.json({}) }),
|
||||
)
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
fireEvent.click(await screen.findByRole('button', { name: /^cancel$/i }))
|
||||
|
||||
await waitFor(() => expect(screen.queryByText('Missing dependencies')).not.toBeInTheDocument())
|
||||
expect(installs).toBe(0)
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-027: widened permissions route to the consent dialog, which can be deferred', async () => {
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive', source_repo: 'acme/gotify', signed: false })])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/activate', () =>
|
||||
HttpResponse.json({ code: 'CONSENT_REQUIRED', newPermissions: ['db:read:trips', 'weird:perm'], newEgress: ['api.acme.io'] }, { status: 409 })))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
|
||||
expect(await screen.findByText('This update needs new permissions')).toBeInTheDocument()
|
||||
expect(screen.getByText('Read trips the acting user can access')).toBeInTheDocument()
|
||||
// An unknown permission is still shown — as its raw code
|
||||
expect(screen.getByText('weird:perm')).toBeInTheDocument()
|
||||
expect(screen.getByText('api.acme.io')).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /keep off for now/i }))
|
||||
expect(await screen.findByText(/left off until you approve/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-028: approving consent re-activates with the consent flag', async () => {
|
||||
const bodies: unknown[] = []
|
||||
panelWith([plugin({ enabled: 0, status: 'inactive' })])
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/activate', async ({ request }) => {
|
||||
bodies.push(await request.json())
|
||||
return bodies.length === 1
|
||||
? HttpResponse.json({ code: 'CONSENT_REQUIRED', newPermissions: ['db:read:trips'], newEgress: [] }, { status: 409 })
|
||||
: HttpResponse.json({ ok: true })
|
||||
}))
|
||||
withToast()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.click(rowToggle('Gotify'))
|
||||
fireEvent.click(await screen.findByRole('button', { name: /approve & turn on/i }))
|
||||
|
||||
expect(await screen.findByText('Plugin updated')).toBeInTheDocument()
|
||||
expect(bodies[1]).toEqual({ consent: true })
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — updates', () => {
|
||||
const outdated = plugin({ source_repo: 'acme/gotify', version: '1.0.0', operatorEgress: false })
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-029: the update banner updates every outdated plugin at once', async () => {
|
||||
const updated: string[] = []
|
||||
panelWith(
|
||||
[outdated, plugin({ id: 'trek-ntfy', name: 'Ntfy', source_repo: 'acme/ntfy', version: '1.0.0', operatorEgress: false })],
|
||||
{ registry: [registryEntry({ latest: '2.0.0' }), registryEntry({ id: 'trek-ntfy', latest: '3.0.0' })] },
|
||||
)
|
||||
server.use(http.post('*/api/admin/plugins/:id/update', ({ params }) => {
|
||||
updated.push(String(params.id))
|
||||
return HttpResponse.json({ version: '2.0.0', activated: true, newPermissions: [], newEgress: [] })
|
||||
}))
|
||||
withToast()
|
||||
|
||||
expect(await screen.findByText('2 updates available for your plugins.')).toBeInTheDocument()
|
||||
fireEvent.click(screen.getByRole('button', { name: /update all/i }))
|
||||
|
||||
await waitFor(() => expect([...updated].sort()).toEqual(['trek-gotify', 'trek-ntfy']))
|
||||
expect((await screen.findAllByText('Plugin updated')).length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-030: an update that widens permissions queues the consent dialog', async () => {
|
||||
panelWith([outdated], { registry: [registryEntry({ latest: '2.0.0', signed: false })] })
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/update', () =>
|
||||
HttpResponse.json({ version: '2.0.0', activated: false, newPermissions: ['db:read:users'], newEgress: [] })))
|
||||
withToast()
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /update → v2\.0\.0/i }))
|
||||
|
||||
expect(await screen.findByText('This update needs new permissions')).toBeInTheDocument()
|
||||
expect(screen.getByText(/read basic profile info/i)).toBeInTheDocument()
|
||||
// The registry says the new code is unsigned — say so where the rights get widened
|
||||
expect(screen.getByText(/nothing ties this version to its author/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-031: a failed update that is not a signature refusal is a plain toast', async () => {
|
||||
panelWith([outdated], { registry: [registryEntry({ latest: '2.0.0' })] })
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/update', () =>
|
||||
HttpResponse.json({ error: 'registry unreachable' }, { status: 502 })))
|
||||
withToast()
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /update → v2\.0\.0/i }))
|
||||
|
||||
expect(await screen.findByText('registry unreachable')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-032: a re-trusted update that widens rights still asks for consent', async () => {
|
||||
panelWith([plugin({
|
||||
source_repo: 'acme/gotify', version: '1.0.0', keyFingerprint: 'OLDAAAAA…BBBBBBBB', operatorEgress: false,
|
||||
updateBlock: { code: 'SIGNATURE_KEY_CHANGED', version: '2.0.0', detail: 'key rotated' },
|
||||
})], { registry: [registryEntry({ latest: '2.0.0' })] })
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/retrust', () =>
|
||||
HttpResponse.json({ version: '2.0.0', activated: false, newPermissions: ['db:read:trips'], newEgress: ['api.acme.io'] })))
|
||||
withToast()
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /^review$/i }))
|
||||
fireEvent.click(await screen.findByRole('button', { name: /trust the new key/i }))
|
||||
|
||||
expect(await screen.findByText('This update needs new permissions')).toBeInTheDocument()
|
||||
expect(screen.getByText('api.acme.io')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-033: a failed re-trust surfaces the server message', async () => {
|
||||
panelWith([plugin({
|
||||
source_repo: 'acme/gotify', version: '1.0.0', keyFingerprint: 'OLDAAAAA…BBBBBBBB', operatorEgress: false,
|
||||
updateBlock: { code: 'SIGNATURE_KEY_CHANGED', version: '2.0.0', detail: 'key rotated' },
|
||||
})], { registry: [registryEntry({ latest: '2.0.0' })] })
|
||||
server.use(http.post('*/api/admin/plugins/trek-gotify/retrust', () =>
|
||||
HttpResponse.json({ error: 'key does not match' }, { status: 400 })))
|
||||
withToast()
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /^review$/i }))
|
||||
fireEvent.click(await screen.findByRole('button', { name: /trust the new key/i }))
|
||||
|
||||
expect(await screen.findByText('key does not match')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-034a: a stable release counts as newer than the prerelease of the same version', async () => {
|
||||
panelWith([plugin({ source_repo: 'acme/gotify', version: '2.0.0-beta.1', operatorEgress: false })], {
|
||||
registry: [registryEntry({ latest: '2.0.0' })],
|
||||
})
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByRole('button', { name: /update → v2\.0\.0/i })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-034: a block with no recorded version stands while the registry is silent', async () => {
|
||||
panelWith([plugin({
|
||||
source_repo: 'acme/gotify', operatorEgress: false,
|
||||
updateBlock: { code: 'SIGNATURE_INVALID', version: null, detail: 'digest mismatch' },
|
||||
})], { registry: [] })
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByText(/update blocked — digest mismatch/i)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — capability and dependency chips', () => {
|
||||
it('FE-COMP-PLUGINS-PANEL-035: a permission-rich plugin renders one chip per capability', async () => {
|
||||
panelWith([plugin({
|
||||
operatorEgress: false,
|
||||
permissions: JSON.stringify([
|
||||
'db:read:trips', 'db:read:users', 'db:write:costs', 'db:read:packing', 'db:read:files',
|
||||
'db:write:places', 'db:write:days', 'db:write:itinerary', 'db:write:trips', 'db:meta',
|
||||
'ws:broadcast:trip', 'hook:photo-provider', 'hook:calendar-source', 'hook:place-detail-provider',
|
||||
'hook:trip-warning-provider', 'hook:map-layer-provider', 'hook:route-provider',
|
||||
'hook:day-schedule-provider', 'geolocation:read', 'events:subscribe', 'http:outbound:api.acme.io',
|
||||
]),
|
||||
capabilities: JSON.stringify({ widget: { slot: 'hero' }, tripPage: { replaces: ['places'] } }),
|
||||
})])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
for (const label of [
|
||||
'Reads your trips', 'Reads basic profiles', 'Adds costs', 'Reads packing lists', 'Reads trip files',
|
||||
'Edits places', 'Edits days', 'Edits itinerary', 'Edits trips', 'Adds metadata',
|
||||
'Boarding-pass widget', 'Replaces planner tabs', 'Real-time updates', 'Provides photos',
|
||||
'Provides calendar events', 'Enriches places', 'Flags issues', 'Draws on the map', 'Offers routing',
|
||||
'Adds plan times', 'Reads your position', 'Reacts to activity', 'api.acme.io',
|
||||
]) {
|
||||
expect(screen.getByText(label)).toBeInTheDocument()
|
||||
}
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-036: read-only costs and a slotted widget each get their own wording', async () => {
|
||||
panelWith([plugin({
|
||||
operatorEgress: false,
|
||||
permissions: JSON.stringify(['db:read:costs']),
|
||||
capabilities: JSON.stringify({ widget: { slot: 'place-detail' } }),
|
||||
})])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
expect(screen.getByText('Reads your costs')).toBeInTheDocument()
|
||||
expect(screen.getByText('Place detail')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Adds costs')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-037: an unparseable capabilities blob degrades to the plain widget chip', async () => {
|
||||
panelWith([plugin({ operatorEgress: false, permissions: 'not json', capabilities: JSON.stringify({ widget: {} }) })])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
expect(screen.getByText('Dashboard widget')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-038: dependency chips flag the addon and plugin the row is waiting on', async () => {
|
||||
panelWith([plugin({
|
||||
operatorEgress: false,
|
||||
dependencies: { requiredAddons: ['journey'], pluginDependencies: [{ id: 'trek-core', version: '^1.0.0' }] },
|
||||
dependencyIssues: { disabledAddons: ['journey'], missing: [{ id: 'trek-core', version: '^1.0.0' }], versionMismatch: [] },
|
||||
})])
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByText('Requires journey')).toBeInTheDocument()
|
||||
expect(screen.getByText('Needs trek-core ^1.0.0')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-039: a plugin that names no TREK range says so', async () => {
|
||||
panelWith([plugin({ operatorEgress: false, dependencyStatus: 'hostIncompatible' })])
|
||||
render(<AdminPluginsPanel />)
|
||||
|
||||
expect(await screen.findByText('Does not say which TREK versions it supports')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — Discover cards and the detail modal', () => {
|
||||
function discoverWith(entry: Record<string, unknown>, detail?: Record<string, unknown>) {
|
||||
server.use(
|
||||
http.get('*/api/admin/plugins', () => HttpResponse.json({ enabled: true, devLink: false, plugins: [] })),
|
||||
http.get('*/api/admin/plugins/registry', () => HttpResponse.json([registryEntry(entry)])),
|
||||
http.get('*/api/admin/plugins/registry/trek-gotify', () =>
|
||||
detail ? HttpResponse.json(detail) : HttpResponse.json({ error: 'gone' }, { status: 404 })),
|
||||
)
|
||||
}
|
||||
|
||||
function manifestDetail(over: Record<string, unknown> = {}, manifest: Record<string, unknown> = {}) {
|
||||
return {
|
||||
id: 'trek-gotify', name: 'Gotify', author: 'Acme', description: 'Push', repo: 'acme/gotify',
|
||||
type: 'integration', tags: [], size: 4096, publishedAt: null, latest: '2.0.0',
|
||||
manifest: { permissions: [], egress: [], settings: [], license: 'MIT', icon: null, operatorEgress: false, ...manifest },
|
||||
...over,
|
||||
}
|
||||
}
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-040: a card shows its compact download count and falls back on a broken shot', async () => {
|
||||
discoverWith({ downloadCount: 1234, screenshotUrl: 'https://example.com/shot.png', reviewedAt: '2026-01-05T00:00:00Z' })
|
||||
const { container } = render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
|
||||
expect(await screen.findByText('1.2k')).toBeInTheDocument()
|
||||
const img = container.querySelector('img') as HTMLImageElement
|
||||
expect(screen.getByText('Reviewed')).toBeInTheDocument()
|
||||
expect(img).toBeInTheDocument()
|
||||
fireEvent.error(img)
|
||||
await waitFor(() => expect(container.querySelector('img')).not.toBeInTheDocument())
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-040a: a two-digit download count is printed verbatim', async () => {
|
||||
discoverWith({ downloadCount: 42 })
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
|
||||
expect(await screen.findByText('42')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-041: opening a card by keyboard shows the modal, and a failed lookup says so', async () => {
|
||||
discoverWith({})
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
|
||||
const card = (await screen.findByText('Gotify')).closest('[role="button"]') as HTMLElement
|
||||
fireEvent.keyDown(card, { key: 'Enter' })
|
||||
|
||||
expect(await screen.findByText('Could not load plugin details.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-042: the detail modal lists setup fields, metadata and a separate homepage', async () => {
|
||||
discoverWith(
|
||||
{ downloadCount: 999_500, reviewedAt: '2026-01-05T00:00:00Z', homepage: 'https://gotify.example', trek: '>=3.2.0' },
|
||||
manifestDetail({}, {
|
||||
permissions: ['db:own'],
|
||||
settings: [{ key: 'url', label: 'Server URL', scope: 'instance', required: true }],
|
||||
}),
|
||||
)
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
fireEvent.click(await screen.findByText('Gotify'))
|
||||
|
||||
expect(await screen.findByText('Server URL')).toBeInTheDocument()
|
||||
expect(screen.getByText('Instance-wide')).toBeInTheDocument()
|
||||
expect(screen.getByText('Required')).toBeInTheDocument()
|
||||
expect(screen.getByText('4 KB')).toBeInTheDocument()
|
||||
expect(screen.getByText('TREK >=3.2.0')).toBeInTheDocument()
|
||||
expect(screen.getByText('Store its own data in an isolated database')).toBeInTheDocument()
|
||||
expect(screen.getByRole('link', { name: /homepage/i })).toHaveAttribute('href', 'https://gotify.example')
|
||||
// 999 500 rounds to a whole megabyte on the card, never "1000k"
|
||||
expect(screen.getByText('1M')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-043: a manifest with no readable access says exactly that', async () => {
|
||||
discoverWith({ minTrekVersion: '3.2.0' }, manifestDetail({ size: 0 }))
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
fireEvent.click(await screen.findByText('Gotify'))
|
||||
|
||||
expect(await screen.findByText('Needs no special access.')).toBeInTheDocument()
|
||||
expect(screen.getByText('TREK 3.2.0+')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Connects to')).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('Setup')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-044: an incompatible entry explains the blocked button in the modal body', async () => {
|
||||
discoverWith({ compatible: false, latestCompatible: null, trek: '>=4.0.0', hostVersion: '3.3.0' })
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
fireEvent.click(await screen.findByText('Gotify'))
|
||||
|
||||
const explanations = await screen.findAllByText(/needs trek >=4\.0\.0 — this server runs 3\.3\.0/i)
|
||||
expect(explanations.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-045: searching Discover with no hit says the registry has no match', async () => {
|
||||
discoverWith({})
|
||||
render(<AdminPluginsPanel />)
|
||||
await clickDiscover()
|
||||
await screen.findByText('Gotify')
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('Search plugins…'), { target: { value: 'nothing' } })
|
||||
|
||||
expect(screen.getByText('No plugins in the registry match your search.')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-046: installing from a card posts the offered version', async () => {
|
||||
let body: unknown = null
|
||||
discoverWith({ compatible: false, latestCompatible: '1.5.0', trek: '>=4.0.0', hostVersion: '3.3.0' })
|
||||
server.use(http.post('*/api/admin/plugins/install', async ({ request }) => {
|
||||
body = await request.json()
|
||||
return HttpResponse.json({ ok: true })
|
||||
}))
|
||||
withToast()
|
||||
await clickDiscover()
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: /^install 1\.5\.0$/i }))
|
||||
|
||||
await waitFor(() => expect(body).toEqual({ id: 'trek-gotify', version: '1.5.0' }))
|
||||
})
|
||||
|
||||
it('FE-COMP-PLUGINS-PANEL-047: an unreachable registry leaves Discover empty rather than spinning', async () => {
|
||||
server.use(
|
||||
http.get('*/api/admin/plugins', () => HttpResponse.json({ enabled: true, devLink: false, plugins: [] })),
|
||||
http.get('*/api/admin/plugins/registry', () => HttpResponse.error()),
|
||||
)
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('No plugins installed yet.')
|
||||
|
||||
await clickDiscover()
|
||||
|
||||
expect(await screen.findByText('No plugins available in the registry yet.')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('AdminPluginsPanel — security footer', () => {
|
||||
it('FE-COMP-PLUGINS-PANEL-048: the containment note expands into its sections', async () => {
|
||||
panelWith([])
|
||||
render(<AdminPluginsPanel />)
|
||||
await screen.findByText('No plugins installed yet.')
|
||||
|
||||
expect(screen.queryByText('Every plugin runs boxed in')).not.toBeInTheDocument()
|
||||
fireEvent.click(screen.getByText('How plugins are contained — and the limits'))
|
||||
|
||||
expect(screen.getByText('Every plugin runs boxed in')).toBeInTheDocument()
|
||||
expect(screen.getByText('What "Reviewed" means')).toBeInTheDocument()
|
||||
expect(screen.getByText('What "Signed" means')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user