diff --git a/src/frontend/tests/pages/pui_purchase_order.spec.ts b/src/frontend/tests/pages/pui_purchase_order.spec.ts index 59dc21bbc0..1eb5be4001 100644 --- a/src/frontend/tests/pages/pui_purchase_order.spec.ts +++ b/src/frontend/tests/pages/pui_purchase_order.spec.ts @@ -13,6 +13,117 @@ import { } from '../helpers.ts'; import { doCachedLogin } from '../login.ts'; +test('Purchasing - Index', async ({ browser }) => { + const page = await doCachedLogin(browser, { url: 'purchasing/index/' }); + + // Purchase Orders tab + await loadTab(page, 'Purchase Orders'); + await page + .getByRole('button', { name: 'segmented-icon-control-parametric' }) + .click(); + + await page + .getByRole('button', { name: 'segmented-icon-control-calendar' }) + .click(); + await page.getByRole('button', { name: 'calendar-select-month' }).waitFor(); + await page + .getByRole('button', { name: 'segmented-icon-control-table' }) + .click(); + + // Suppliers tab + await loadTab(page, 'Suppliers'); + await page + .getByRole('button', { name: 'segmented-icon-control-parametric' }) + .click(); + await page + .getByRole('button', { name: 'segmented-icon-control-table' }) + .click(); + + // Supplier parts tab + await loadTab(page, 'Supplier Parts'); + await page + .getByRole('button', { name: 'segmented-icon-control-parametric' }) + .click(); + await page + .getByRole('button', { name: 'segmented-icon-control-table' }) + .click(); + + // Manufacturers tab + await loadTab(page, 'Manufacturers'); + await page + .getByRole('button', { name: 'segmented-icon-control-parametric' }) + .click(); + await page + .getByRole('button', { name: 'segmented-icon-control-table' }) + .click(); + + // Manufacturer parts tab + await loadTab(page, 'Manufacturer Parts'); + await page + .getByRole('button', { name: 'segmented-icon-control-parametric' }) + .click(); + await page + .getByRole('button', { name: 'segmented-icon-control-table' }) + .click(); +}); + +test('Purchase Orders - General', async ({ browser }) => { + const page = await doCachedLogin(browser); + + await page.getByRole('tab', { name: 'Purchasing' }).click(); + await page.waitForURL('**/purchasing/index/**'); + + await page.getByRole('cell', { name: 'PO0012' }).click(); + await page.waitForTimeout(200); + + await loadTab(page, 'Line Items'); + await loadTab(page, 'Received Stock'); + await loadTab(page, 'Parameters'); + await loadTab(page, 'Attachments'); + + await page.getByRole('tab', { name: 'Purchasing' }).click(); + await loadTab(page, 'Suppliers'); + await page.getByText('Arrow', { exact: true }).click(); + await page.waitForTimeout(200); + + await loadTab(page, 'Supplied Parts'); + await loadTab(page, 'Purchase Orders'); + await loadTab(page, 'Stock Items'); + await loadTab(page, 'Contacts'); + await loadTab(page, 'Addresses'); + await loadTab(page, 'Attachments'); + + await page.getByRole('tab', { name: 'Purchasing' }).click(); + await loadTab(page, 'Manufacturers'); + await page.getByText('AVX Corporation').click(); + await page.waitForTimeout(200); + + await loadTab(page, 'Addresses'); + await page.getByRole('cell', { name: 'West Branch' }).click(); + await page.locator('.mantine-ScrollArea-root').click(); + await page + .getByRole('row', { name: 'West Branch Yes Surf Avenue 9' }) + .getByRole('button') + .click(); + await page.getByRole('menuitem', { name: 'Edit' }).click(); + + await page.getByLabel('text-field-title', { exact: true }).waitFor(); + await page.getByLabel('text-field-line2', { exact: true }).waitFor(); + + // Read the current value of the cell, to ensure we always *change* it! + const value = await page + .getByLabel('text-field-line2', { exact: true }) + .inputValue(); + await page + .getByLabel('text-field-line2', { exact: true }) + .fill(value == 'old' ? 'new' : 'old'); + + await page.getByRole('button', { name: 'Submit' }).isEnabled(); + + await page.getByRole('button', { name: 'Submit' }).click(); + await page.getByRole('tab', { name: 'Details' }).waitFor(); +}); + test('Purchase Orders - Table', async ({ browser }) => { const page = await doCachedLogin(browser); @@ -130,62 +241,6 @@ test('Purchase Orders - Barcodes', async ({ browser }) => { await page.getByRole('button', { name: 'Issue Order' }).waitFor(); }); -test('Purchase Orders - General', async ({ browser }) => { - const page = await doCachedLogin(browser); - - await page.getByRole('tab', { name: 'Purchasing' }).click(); - await page.waitForURL('**/purchasing/index/**'); - - await page.getByRole('cell', { name: 'PO0012' }).click(); - await page.waitForTimeout(200); - - await loadTab(page, 'Line Items'); - await loadTab(page, 'Received Stock'); - await loadTab(page, 'Attachments'); - - await page.getByRole('tab', { name: 'Purchasing' }).click(); - await loadTab(page, 'Suppliers'); - await page.getByText('Arrow', { exact: true }).click(); - await page.waitForTimeout(200); - - await loadTab(page, 'Supplied Parts'); - await loadTab(page, 'Purchase Orders'); - await loadTab(page, 'Stock Items'); - await loadTab(page, 'Contacts'); - await loadTab(page, 'Addresses'); - await loadTab(page, 'Attachments'); - - await page.getByRole('tab', { name: 'Purchasing' }).click(); - await loadTab(page, 'Manufacturers'); - await page.getByText('AVX Corporation').click(); - await page.waitForTimeout(200); - - await loadTab(page, 'Addresses'); - await page.getByRole('cell', { name: 'West Branch' }).click(); - await page.locator('.mantine-ScrollArea-root').click(); - await page - .getByRole('row', { name: 'West Branch Yes Surf Avenue 9' }) - .getByRole('button') - .click(); - await page.getByRole('menuitem', { name: 'Edit' }).click(); - - await page.getByLabel('text-field-title', { exact: true }).waitFor(); - await page.getByLabel('text-field-line2', { exact: true }).waitFor(); - - // Read the current value of the cell, to ensure we always *change* it! - const value = await page - .getByLabel('text-field-line2', { exact: true }) - .inputValue(); - await page - .getByLabel('text-field-line2', { exact: true }) - .fill(value == 'old' ? 'new' : 'old'); - - await page.getByRole('button', { name: 'Submit' }).isEnabled(); - - await page.getByRole('button', { name: 'Submit' }).click(); - await page.getByRole('tab', { name: 'Details' }).waitFor(); -}); - test('Purchase Orders - Filters', async ({ browser }) => { const page = await doCachedLogin(browser, { username: 'reader',