mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-13 22:21:37 +00:00
* Add model for recording barcode scan results * Add "admin" interface for new model * Add API endpoints for barcode scan history * Add global setting to control barcode result save * Add frontend API endpoint * Add PUI table in "admin center" * Add API filter class * Enable table filtering * Update model definition * Allow more characters for barcode log * Log results to server * Add setting to control how long results are stored * Table updates * Add background task to delete old barcode scans * Add detail drawer for barcode scan * Log messages for BarcodePOReceive * Add warning message if barcode logging is not enabled * Add "context" data to BarcodeScanResult * Display context data (if available) * Add context data when scanning * Simplify / refactor BarcodeSOAllocate * Refactor BarcodePOAllocate * Limit the number of saved scans * Improve error message display in PUI * Simplify barcode logging * Improve table * Updates * Settings page fix * Fix panel tooltips * Adjust table * Add "result" field * Refactor calls to "log_scan" * Display result in PUI table * Updates * Fix typo * Update unit test * Improve exception handling * Unit test updates * Enhanced unit test * Ensure all database key config values are upper case * Refactor some playwright helpers * Adds playwright test for barcode scan history table * Requires some timeout * Add docs
55 lines
1.0 KiB
TypeScript
55 lines
1.0 KiB
TypeScript
import { expect } from 'playwright/test';
|
|
|
|
import { apiUrl } from './defaults';
|
|
|
|
/*
|
|
* Set the value of a global setting in the database
|
|
*/
|
|
export const setSettingState = async ({
|
|
request,
|
|
setting,
|
|
value
|
|
}: {
|
|
request: any;
|
|
setting: string;
|
|
value: any;
|
|
}) => {
|
|
const url = `${apiUrl}/settings/global/${setting}/`;
|
|
|
|
const response = await request.patch(url, {
|
|
data: {
|
|
value: value
|
|
},
|
|
headers: {
|
|
// Basic username: password authorization
|
|
Authorization: `Basic ${btoa('admin:inventree')}`
|
|
}
|
|
});
|
|
|
|
expect(await response.status()).toBe(200);
|
|
};
|
|
|
|
export const setPluginState = async ({
|
|
request,
|
|
plugin,
|
|
state
|
|
}: {
|
|
request: any;
|
|
plugin: string;
|
|
state: boolean;
|
|
}) => {
|
|
const url = `${apiUrl}/plugins/${plugin}/activate/`;
|
|
|
|
const response = await request.patch(url, {
|
|
data: {
|
|
active: state
|
|
},
|
|
headers: {
|
|
// Basic username: password authorization
|
|
Authorization: `Basic ${btoa('admin:inventree')}`
|
|
}
|
|
});
|
|
|
|
expect(await response.status()).toBe(200);
|
|
};
|