mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 10:18:42 +00:00
* Add <GlobalPreviewDrawer> component * Allow plugins to interact * provide either pk or instance data * open preview drawer from calendar views * Launch preview drawer directly from tables * Add preview types * Fix types * CLear data on close * Fix transition * Allow caller to pass preview component * AttributeGrid * Use a table component * Display info items * Navigate to detail page from drawer * Updates * Refactor to use part detail view * Display parameters * Fix image caching * Apply same to StockItem * Remove old component * Refactor details grid component * Preview panel for PurchaseOrder model * Implement for SalesOrder * Support ReturnOrder * SupplierPart and ManufacturerPart * Support preview in parameteric tables * support Company and BuildOrder * Fix numbervalue * BuildOrder and SalesOrderShipment * location and category * add user setting * Fix typing * Handle link clicks within preview drawer * fixes * Implement onClose callback * Handle row click when panel preview is disabled * Support custom detail links * update playwright tests * UI tweaks * Add CHANGELOG entry * docs * define default API params per model type * Split out more docs pages * Simplify state ref * Refactoring * Simplify PreviewDrawer component * observe user setting in calendar view * Enable PreviewDrawer from RowViewAction * Push render functions onto ModelInformation dict * Fix lib compilation * Refactor internal uses of RowViewAction * typescript fixes * Simplify PreviewDrawer component structure * remove TODO placeholders
136 lines
4.6 KiB
TypeScript
136 lines
4.6 KiB
TypeScript
import { test } from './baseFixtures';
|
|
import { stevenuser } from './defaults';
|
|
import { globalSearch, loadTab, navigate } from './helpers';
|
|
import { doCachedLogin } from './login';
|
|
|
|
// Helper function to open the export data dialog
|
|
const openExportDialog = async (page) => {
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await page.getByRole('button', { name: 'table-export-data' }).click();
|
|
await page.getByText('Export Format *', { exact: true }).waitFor();
|
|
await page.getByText('Export Plugin *', { exact: true }).waitFor();
|
|
};
|
|
|
|
// Test data export for various order types
|
|
test('Exporting - Orders', async ({ browser }) => {
|
|
const page = await doCachedLogin(browser, {
|
|
user: stevenuser,
|
|
url: 'purchasing/index/purchase-orders'
|
|
});
|
|
|
|
await openExportDialog(page);
|
|
|
|
// // Select export format
|
|
await page.getByLabel('choice-field-export_format').click();
|
|
await page.getByRole('option', { name: 'Excel' }).click();
|
|
|
|
// // Select export plugin (should only be one option here)
|
|
await page.getByLabel('choice-field-export_plugin').click();
|
|
await page.getByRole('option', { name: 'InvenTree Exporter' }).click();
|
|
|
|
// // Export the data
|
|
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
|
await page.getByText('Process completed successfully').waitFor();
|
|
|
|
// Download list of purchase order items
|
|
await page.getByRole('cell', { name: 'PO0014' }).click();
|
|
|
|
// Click through to the PurchaseOrder from the detail tab
|
|
await page
|
|
.getByLabel('Purchase Order PO0014 (PCBWOY)')
|
|
.getByRole('cell', { name: 'Ordering some PCBs' })
|
|
.waitFor();
|
|
await page
|
|
.getByRole('link', { name: 'details-purchaseorder-14' })
|
|
.first()
|
|
.click();
|
|
|
|
await loadTab(page, 'Line Items');
|
|
await openExportDialog(page);
|
|
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
|
await page.getByText('Process completed successfully').waitFor();
|
|
|
|
// Download a list of build orders
|
|
await navigate(page, 'manufacturing/index/buildorders/');
|
|
await openExportDialog(page);
|
|
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
|
await page.getByText('Process completed successfully').waitFor();
|
|
|
|
// Finally, navigate to the admin center and ensure the export data is available
|
|
await navigate(page, 'settings/admin/export/');
|
|
|
|
// Check for expected outputs
|
|
await page
|
|
.getByRole('link', { name: /InvenTree_Build_.*\.csv/ })
|
|
.first()
|
|
.waitFor();
|
|
await page
|
|
.getByRole('link', { name: /InvenTree_PurchaseOrder_.*\.xlsx/ })
|
|
.first()
|
|
.waitFor();
|
|
await page
|
|
.getByRole('link', { name: /InvenTree_PurchaseOrderLineItem_.*\.csv/ })
|
|
.first()
|
|
.waitFor();
|
|
|
|
// Delete all exported file outputs
|
|
await page.getByRole('checkbox', { name: 'Select all records' }).check();
|
|
await page.getByLabel('action-button-delete-selected').click();
|
|
await page.getByRole('button', { name: 'Delete', exact: true }).click();
|
|
await page.getByText('Items Deleted').waitFor();
|
|
});
|
|
|
|
// Test for custom BOM exporter
|
|
test('Exporting - BOM', async ({ browser }) => {
|
|
const page = await doCachedLogin(browser, {
|
|
user: stevenuser
|
|
});
|
|
|
|
await globalSearch(page, 'MAST');
|
|
await page.getByLabel('search-group-results-part').locator('a').click();
|
|
await page.waitForLoadState('networkidle');
|
|
await loadTab(page, 'Bill of Materials');
|
|
await openExportDialog(page);
|
|
|
|
// Select export format
|
|
await page.getByLabel('choice-field-export_format').click();
|
|
await page.getByRole('option', { name: 'TSV' }).click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Select BOM plugin
|
|
await page.getByLabel('choice-field-export_plugin').click();
|
|
await page.getByRole('option', { name: 'BOM Exporter' }).click();
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Now, adjust the settings specific to the BOM exporter
|
|
await page.getByLabel('number-field-export_levels').fill('3');
|
|
await page
|
|
.locator('label')
|
|
.filter({ hasText: 'Pricing DataInclude part' })
|
|
.locator('span')
|
|
.nth(1)
|
|
.click();
|
|
await page
|
|
.locator('label')
|
|
.filter({ hasText: 'Parameter DataInclude part' })
|
|
.locator('span')
|
|
.nth(1)
|
|
.click();
|
|
|
|
await page.getByRole('button', { name: 'Export', exact: true }).click();
|
|
await page.getByText('Process completed successfully').waitFor();
|
|
|
|
// Finally, navigate to the admin center and ensure the export data is available
|
|
await navigate(page, 'settings/admin/export/');
|
|
|
|
await page.getByRole('cell', { name: 'bom-exporter' }).first().waitFor();
|
|
await page
|
|
.getByRole('link', { name: /InvenTree_BomItem_.*\.tsv/ })
|
|
.first()
|
|
.waitFor();
|
|
|
|
// Required because we downloaded a file
|
|
await page.context().close();
|
|
});
|