mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-27 01:00:53 +00:00
[UI] Barcode actions (#9538)
* Provide callback function for barcode scan dialog
* Adds hook for barcode scan dialog
* Fix callback processing
* Add function to extract API URL for a model instance
* Tweak page titles
* Extract instance data when scanning a barcode
* Scan item into location
* Scan in stock location
* Remove notYetImplemented func
* Revert "Remove notYetImplemented func"
This reverts commit a35408380e
.
* Add stock item action
* Add playwright tests
This commit is contained in:
@ -236,6 +236,17 @@ test('Stock - Stock Actions', async ({ browser }) => {
|
||||
.waitFor();
|
||||
await page.getByText('123').first().waitFor();
|
||||
|
||||
// Check barcode actions
|
||||
await page.getByLabel('action-menu-barcode-actions').click();
|
||||
await page
|
||||
.getByLabel('action-menu-barcode-actions-scan-into-location')
|
||||
.click();
|
||||
await page
|
||||
.getByPlaceholder('Enter barcode data')
|
||||
.fill('{"stocklocation": 12}');
|
||||
await page.getByRole('button', { name: 'Scan', exact: true }).click();
|
||||
await page.getByText('Scanned stock item into location').waitFor();
|
||||
|
||||
// Add stock, and change status
|
||||
await launchStockAction('add');
|
||||
await page.getByLabel('number-field-quantity').fill('12');
|
||||
@ -284,3 +295,34 @@ test('Stock - Tracking', async ({ browser }) => {
|
||||
await page.getByRole('link', { name: 'Widget Assembly' }).waitFor();
|
||||
await page.getByRole('cell', { name: 'Installed into assembly' }).waitFor();
|
||||
});
|
||||
|
||||
test('Stock - Location', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, { url: 'stock/location/12/' });
|
||||
|
||||
await loadTab(page, 'Default Parts');
|
||||
await loadTab(page, 'Stock Items');
|
||||
await loadTab(page, 'Stock Locations');
|
||||
await loadTab(page, 'Location Details');
|
||||
|
||||
await page.getByLabel('action-menu-barcode-actions').click();
|
||||
await page
|
||||
.getByLabel('action-menu-barcode-actions-scan-in-stock-items')
|
||||
.waitFor();
|
||||
await page
|
||||
.getByLabel('action-menu-barcode-actions-scan-in-container')
|
||||
.click();
|
||||
|
||||
// Attempt to scan in the same location (should fail)
|
||||
await page
|
||||
.getByPlaceholder('Enter barcode data')
|
||||
.fill('{"stocklocation": 12}');
|
||||
await page.getByRole('button', { name: 'Scan', exact: true }).click();
|
||||
await page.getByText('Error scanning stock location').waitFor();
|
||||
|
||||
// Attempt to scan bad data (no match)
|
||||
await page
|
||||
.getByPlaceholder('Enter barcode data')
|
||||
.fill('{"stocklocation": 1234}');
|
||||
await page.getByRole('button', { name: 'Scan', exact: true }).click();
|
||||
await page.getByText('No match found for barcode data').waitFor();
|
||||
});
|
||||
|
Reference in New Issue
Block a user