mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-18 10:18:18 +00:00
[UI] Suggested pricing (#10867)
* Refactor NumberField into separate component * Add helper func to ensure a number is a number * Use placeholder value for suggested sale price * Fix for auto-fill * Tweak price calculation * Add UI testing for sales order price breaks * Fix aria label name * Annotate price breaks to supplier part * Fetch price break data * Support price breaks for purchase order pricing * Fix required to prevent circular imports * Add playwright tests for purchase order price breaks * Bump API version * Re-add output options for SupplierPriceBreakList * Revert change * Simplify unit test
This commit is contained in:
@@ -279,3 +279,45 @@ test('Sales Orders - Duplicate', async ({ browser }) => {
|
||||
await page.getByText('Complete').first().waitFor();
|
||||
await page.getByText('2 / 2').waitFor();
|
||||
});
|
||||
|
||||
/**
|
||||
* Test auto-calculation of price breaks on sales order line items
|
||||
*/
|
||||
test('Sales Orders - Price Breaks', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, {
|
||||
url: 'sales/sales-order/14/line-items'
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('button', { name: 'action-button-add-line-item' })
|
||||
.click();
|
||||
await page.getByLabel('related-field-part').fill('software');
|
||||
await page.getByRole('option', { name: 'Software License' }).click();
|
||||
|
||||
const priceBreaks = {
|
||||
1: 123,
|
||||
2: 123,
|
||||
10: 104,
|
||||
49: 104,
|
||||
56: 96,
|
||||
104: 78
|
||||
};
|
||||
|
||||
for (const [qty, expectedPrice] of Object.entries(priceBreaks)) {
|
||||
await page.getByLabel('number-field-quantity').fill(qty);
|
||||
|
||||
await expect(
|
||||
page.getByRole('textbox', { name: 'number-field-sale_price' })
|
||||
).toHaveAttribute('placeholder', expectedPrice.toString(), {
|
||||
timeout: 500
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-fill the suggested sale price
|
||||
await page.getByLabel('field-sale_price-accept-placeholder').click();
|
||||
|
||||
// The sale price field should now contain the suggested value
|
||||
await expect(
|
||||
page.getByRole('textbox', { name: 'number-field-sale_price' })
|
||||
).toHaveValue('78', { timeout: 500 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user