2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-17 00:38:46 +00:00
Files
InvenTree/src/frontend/tests/settings.ts
Oliver 20c7a5b5b8 Barcode scan tweaks (#10992)
* Remove duplicate tooltip

* Adjust default value

* docs update

* Tweak unit test

* Fix playwright tests
2025-12-11 16:19:47 +11:00

49 lines
906 B
TypeScript

import { expect } from 'playwright/test';
import { createApi } from './api';
/*
* Set the value of a global setting in the database
*/
export const setSettingState = async ({
setting,
value,
type = 'global',
plugin
}: {
setting: string;
value: any;
type?: 'global' | 'plugin';
plugin?: string;
}) => {
const api = await createApi({});
const url =
type === 'global'
? `settings/global/${setting}/`
: `plugins/${plugin}/settings/${setting}/`;
const response = await api.patch(url, {
data: {
value: value
}
});
expect(response.status()).toBe(200);
};
export const setPluginState = async ({
plugin,
state
}: {
plugin: string;
state: boolean;
}) => {
const api = await createApi({});
const response = await api.patch(`plugins/${plugin}/activate/`, {
data: {
active: state
}
});
expect(response.status()).toBe(200);
};