2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-14 03:46:44 +00:00

Delete locations fix (#10672)

* Cleaner handling of inputs

* Fix for frontend form:

- Fix typo in field
- Better option defaults

* Tweak part category delete form

* Add frontend tests
This commit is contained in:
Oliver
2025-10-26 11:40:22 +11:00
committed by GitHub
parent b579ccdaa2
commit 23d580c4a9
5 changed files with 81 additions and 14 deletions

View File

@@ -54,6 +54,67 @@ test('Stock - Location Tree', async ({ browser }) => {
await page.getByRole('cell', { name: 'Factory' }).first().waitFor();
});
test('Stock - Location Delete', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'stock/location/38/sublocations'
});
// Create a sub-location
await page
.getByRole('button', { name: 'action-button-add-stock-location' })
.click();
await page
.getByRole('textbox', { name: 'text-field-name' })
.fill('my-location-1');
await page.getByRole('button', { name: 'Submit' }).click();
// Create a secondary sub-location
await loadTab(page, 'Sublocations');
await page
.getByRole('button', { name: 'action-button-add-stock-location' })
.click();
await page
.getByRole('textbox', { name: 'text-field-name' })
.fill('my-location-2');
await page.getByRole('button', { name: 'Submit' }).click();
// Navigate up to parent
await page.getByRole('link', { name: 'breadcrumb-2-my-location-1' }).click();
await loadTab(page, 'Sublocations');
await page
.getByRole('cell', { name: 'my-location-2', exact: true })
.waitFor();
// Delete this location, and all child locations
await page
.locator('div')
.filter({ hasText: /^Stock>PCB Assembler>my-location-1Stock Location$/ })
.getByLabel('action-menu-location-actions')
.click();
await page
.getByRole('menuitem', { name: 'action-menu-location-actions-delete' })
.click();
await page
.getByRole('textbox', { name: 'choice-field-delete_stock_items' })
.click();
await page
.getByRole('option', { name: 'Move items to parent location' })
.click();
await page
.getByRole('textbox', { name: 'choice-field-delete_sub_locations' })
.click();
await page.getByRole('option', { name: 'Delete items' }).click();
await page.getByRole('button', { name: 'Delete' }).click();
// Confirm we are on the right page
await page.getByText('External PCB assembler').waitFor();
await loadTab(page, 'Sublocations');
await page.getByText('No records found').first().waitFor();
});
test('Stock - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'steven',