2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 06:01:35 +00:00

Setting fix (#10148)

* Fix for boolean setting

* Add playwright tests
This commit is contained in:
Oliver
2025-08-08 00:59:43 +10:00
committed by GitHub
parent 681e1cb669
commit 7df8e06f36
2 changed files with 36 additions and 1 deletions

View File

@@ -123,8 +123,11 @@ function SettingValue({
radius='lg'
aria-label={`toggle-setting-${setting.key}`}
disabled={setting.read_only}
checked={setting.value.toLowerCase() == 'true'}
checked={setting.value.toString().toLowerCase() == 'true'}
onChange={toggleSetting}
wrapperProps={{
'aria-label': `setting-${setting.key}-wrapper`
}}
style={{
paddingRight: '20px'
}}

View File

@@ -113,6 +113,13 @@ test('Settings - User', async ({ browser }) => {
await loadTab(page, 'Reporting');
await page.getByText('Inline report display').waitFor();
// Toggle boolean setting
await page
.getByLabel('setting-LABEL_INLINE-wrapper')
.locator('span')
.nth(1)
.click();
await loadTab(page, 'Plugin Settings');
await page
.getByRole('button', { name: 'InvenTree Email Notifications' })
@@ -135,6 +142,31 @@ test('Settings - Global', async ({ browser, request }) => {
});
await loadTab(page, 'Server');
// edit some settings here
await page
.getByRole('button', { name: 'edit-setting-INVENTREE_COMPANY_NAME' })
.click();
await page
.getByRole('textbox', { name: 'text-field-value' })
.fill('some data');
await page.getByRole('button', { name: 'Cancel' }).click();
// Toggle a boolean setting
await page
.getByLabel('setting-INVENTREE_ANNOUNCE_ID-wrapper')
.locator('span')
.nth(1)
.click();
await page
.getByText('Setting INVENTREE_ANNOUNCE_ID updated successfully')
.waitFor();
await page
.getByLabel('setting-INVENTREE_ANNOUNCE_ID-wrapper')
.locator('span')
.nth(1)
.click();
await loadTab(page, 'Authentication');
await loadTab(page, 'Barcodes');
await loadTab(page, 'Pricing');