2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

[PUI] Plugin settings UI (#8228)

* Visual tweaks for admin pages

* Provide admin js file via API

* Backend fixes

* Tweak error detail drawer

* Refactor plugin detail panel

- Split out into separate files
- Use <Accordion />
- Display custom configuration (if available)

* Refactoring

* Add custom configuration to sample UI plugin

* Bump API version

* Add separate API endpoint for admin integration details

* Refactor plugin drawer

* Null check

* Add playwright tests for custom admin integration

* Enable plugin panels in "settings" pages

* Fix for unit test

* Hide "Plugin Settings" for plugin without "settings" mixin

* Fixes for playwright tests

* Update playwright tests

* Improved error message
This commit is contained in:
Oliver
2024-10-07 22:25:56 +11:00
committed by GitHub
parent 36e3159c1a
commit 798e25a9dc
26 changed files with 540 additions and 242 deletions

View File

@ -52,3 +52,37 @@ test('Plugins - Panels', async ({ page, request }) => {
state: false
});
});
/**
* Unit test for custom admin integration for plugins
*/
test('Plugins - Custom Admin', async ({ page, request }) => {
await doQuickLogin(page, 'admin', 'inventree');
// Ensure that the SampleUI plugin is enabled
await setPluginState({
request,
plugin: 'sampleui',
state: true
});
// Navigate to the "admin" page
await page.goto(`${baseUrl}/settings/admin/plugin/`);
// Open the plugin drawer, and ensure that the custom admin elements are visible
await page.getByText('SampleUI').click();
await page.getByRole('button', { name: 'Plugin Information' }).click();
await page
.getByLabel('Plugin Detail')
.getByRole('button', { name: 'Plugin Settings' })
.click();
await page.getByRole('button', { name: 'Plugin Configuration' }).click();
// Check for expected custom elements
await page
.getByRole('heading', { name: 'Custom Plugin Configuration Content' })
.waitFor();
await page.getByText('apple: banana').waitFor();
await page.getByText('foo: bar').waitFor();
await page.getByText('hello: world').waitFor();
});