2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-27 01:00:53 +00:00

[CI] Playwright improvements (#9395)

* Allow port 4173 (vite preview)

* Change 'base' attr based on vite command

* Allow api_host to be specified separately

* Harden API host functionality

* Adjust server selections

* Cleanup vite.config.ts

* Adjust playwright configuration

- Allow to run in "production" mode
- Builds the code first
- Runs only the backend web server
- Not suitable for coverage

* Tweak github actions

* Tweak QC file

* Reduce number of steps

* Tweak CI file

* Fix typo

* Ensure translation before build

* Fix hard-coded test

* Test tweaks

* uncomment

* Revert some changes

* Run with gunicorn, single worker

* Reduce log output in DEBUG mode

* Update deps

* Add global-setup func

* Fix for .gitignore file

* Cached auth state

* Tweak login func

* Updated tests

* Enable parallel workers again

* Simplify config

* Try with a single worker again

* Single retry mode

* Run auth setup first

- Prevent issues with parallel test doing login

* Improve test setup process

* Tweaks

* Bump to 3 workers

* Tweak playwright settings

* Revert change

* Revert change
This commit is contained in:
Oliver
2025-03-30 14:12:48 +11:00
committed by GitHub
parent 858eb8f807
commit 7f5a447769
40 changed files with 794 additions and 575 deletions

View File

@ -8,13 +8,15 @@ import {
navigate,
setTableChoiceFilter
} from '../helpers.ts';
import { doQuickLogin } from '../login.ts';
import { doCachedLogin } from '../login.ts';
test('Build Order - Basic Tests', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Basic Tests', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Navigate to the correct build order
await page.getByRole('tab', { name: 'Manufacturing', exact: true }).click();
await page.getByRole('tab', { name: 'Manufacturing' }).click();
await page.waitForURL('**/manufacturing/index/**');
await loadTab(page, 'Build Orders');
await clearTableFilters(page);
@ -91,8 +93,8 @@ test('Build Order - Basic Tests', async ({ page }) => {
.waitFor();
});
test('Build Order - Calendar', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Calendar', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/index/buildorders');
await activateCalendarView(page);
@ -114,8 +116,8 @@ test('Build Order - Calendar', async ({ page }) => {
await page.context().close();
});
test('Build Order - Edit', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Edit', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/build-order/22/');
@ -141,8 +143,8 @@ test('Build Order - Edit', async ({ page }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
});
test('Build Order - Build Outputs', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Build Outputs', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/index/');
await loadTab(page, 'Build Orders');
@ -217,8 +219,8 @@ test('Build Order - Build Outputs', async ({ page }) => {
await page.getByText('Build outputs have been completed').waitFor();
});
test('Build Order - Allocation', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Allocation', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/build-order/1/line-items');
@ -317,8 +319,8 @@ test('Build Order - Allocation', async ({ page }) => {
.waitFor();
});
test('Build Order - Filters', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/index/buildorders');
@ -351,8 +353,8 @@ test('Build Order - Filters', async ({ page }) => {
await page.getByText('Pending Approval').first().waitFor();
});
test('Build Order - Duplicate', async ({ page }) => {
await doQuickLogin(page);
test('Build Order - Duplicate', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'manufacturing/build-order/24/details');
await page.getByLabel('action-menu-build-order-').click();

View File

@ -1,9 +1,9 @@
import { test } from '../baseFixtures.js';
import { loadTab, navigate } from '../helpers.js';
import { doQuickLogin } from '../login.js';
import { doCachedLogin } from '../login.js';
test('Company', async ({ page }) => {
await doQuickLogin(page);
test('Company', async ({ browser }) => {
const page = await doCachedLogin(browser);
await navigate(page, 'company/1/details');
await page.getByLabel('Details').getByText('DigiKey Electronics').waitFor();

View File

@ -1,13 +1,13 @@
import { test } from '../baseFixtures.js';
import { loadTab, navigate } from '../helpers.js';
import { doQuickLogin } from '../login.js';
import { doCachedLogin } from '../login.js';
test('Core User/Group/Contact', async ({ page }) => {
await doQuickLogin(page);
test('Core User/Group/Contact', async ({ browser }) => {
const page = await doCachedLogin(browser);
// groups
await navigate(page, '/core');
await page.getByText('System Overview', { exact: true }).click();
await page.getByText('System Overview', { exact: true }).first().click();
await loadTab(page, 'Groups');
await page.getByRole('cell', { name: 'all access' }).click();
await page.getByText('Group: all access', { exact: true }).click();

View File

@ -1,9 +1,9 @@
import { test } from '../baseFixtures.js';
import { doQuickLogin } from '../login.js';
import { doCachedLogin } from '../login.js';
import { setPluginState } from '../settings.js';
test('Dashboard - Basic', async ({ page }) => {
await doQuickLogin(page);
test('Dashboard - Basic', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByText('Use the menu to add widgets').waitFor();
@ -35,7 +35,7 @@ test('Dashboard - Basic', async ({ page }) => {
await page.getByLabel('dashboard-accept-layout').click();
});
test('Dashboard - Plugins', async ({ page, request }) => {
test('Dashboard - Plugins', async ({ browser, request }) => {
// Ensure that the "SampleUI" plugin is enabled
await setPluginState({
request,
@ -43,7 +43,7 @@ test('Dashboard - Plugins', async ({ page, request }) => {
state: true
});
await doQuickLogin(page);
const page = await doCachedLogin(browser);
// Add a dashboard widget from the SampleUI plugin
await page.getByLabel('dashboard-menu').click();

View File

@ -5,15 +5,17 @@ import {
loadTab,
navigate
} from '../helpers';
import { doQuickLogin } from '../login';
import { doCachedLogin } from '../login';
/**
* CHeck each panel tab for the "Parts" page
*/
test('Parts - Tabs', async ({ page }) => {
await doQuickLogin(page);
test('Parts - Tabs', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Parts' }).click();
await page.waitForURL('**/part/category/index/**');
await page
.getByLabel('panel-tabs-partcategory')
.getByRole('tab', { name: 'Parts' })
@ -56,10 +58,8 @@ test('Parts - Tabs', async ({ page }) => {
await loadTab(page, 'Build Orders');
});
test('Parts - Manufacturer Parts', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/84/suppliers');
test('Parts - Manufacturer Parts', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/84/suppliers' });
await loadTab(page, 'Suppliers');
await page.getByText('Hammond Manufacturing').click();
@ -69,10 +69,8 @@ test('Parts - Manufacturer Parts', async ({ page }) => {
await page.getByText('1551ACLR - 1551ACLR').waitFor();
});
test('Parts - Supplier Parts', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/15/suppliers');
test('Parts - Supplier Parts', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/15/suppliers' });
await loadTab(page, 'Suppliers');
await page.getByRole('cell', { name: 'DIG-84670-SJI' }).click();
@ -82,11 +80,8 @@ test('Parts - Supplier Parts', async ({ page }) => {
await page.getByText('DIG-84670-SJI - R_550R_0805_1%').waitFor();
});
test('Parts - Locking', async ({ page }) => {
await doQuickLogin(page);
// Navigate to a known assembly which is *not* locked
await navigate(page, 'part/104/bom');
test('Parts - Locking', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/104/bom' });
await loadTab(page, 'Bill of Materials');
await page.getByLabel('action-button-add-bom-item').waitFor();
await loadTab(page, 'Parameters');
@ -108,11 +103,9 @@ test('Parts - Locking', async ({ page }) => {
await page.getByText('Part parameters cannot be').waitFor();
});
test('Parts - Allocations', async ({ page }) => {
await doQuickLogin(page);
test('Parts - Allocations', async ({ browser }) => {
// Let's look at the allocations for a single stock item
await navigate(page, 'stock/item/324/');
const page = await doCachedLogin(browser, { url: 'stock/item/324/' });
await loadTab(page, 'Allocations');
await page.getByRole('button', { name: 'Build Order Allocations' }).waitFor();
@ -173,11 +166,9 @@ test('Parts - Allocations', async ({ page }) => {
await page.keyboard.press('Escape');
});
test('Parts - Pricing (Nothing, BOM)', async ({ page }) => {
await doQuickLogin(page);
test('Parts - Pricing (Nothing, BOM)', async ({ browser }) => {
// Part with no history
await navigate(page, 'part/82/pricing');
const page = await doCachedLogin(browser, { url: 'part/82/pricing' });
await page.getByText('Small plastic enclosure, black').waitFor();
await loadTab(page, 'Part Pricing');
@ -223,11 +214,9 @@ test('Parts - Pricing (Nothing, BOM)', async ({ page }) => {
await page.waitForURL('**/part/98/**');
});
test('Parts - Pricing (Supplier)', async ({ page }) => {
await doQuickLogin(page);
test('Parts - Pricing (Supplier)', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/55/pricing' });
// Part
await navigate(page, 'part/55/pricing');
await page.getByText('Ceramic capacitor, 100nF in').waitFor();
await loadTab(page, 'Part Pricing');
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
@ -249,11 +238,8 @@ test('Parts - Pricing (Supplier)', async ({ page }) => {
// await page.waitForURL('**/purchasing/supplier-part/697/');
});
test('Parts - Pricing (Variant)', async ({ page }) => {
await doQuickLogin(page);
// Part
await navigate(page, 'part/106/pricing');
test('Parts - Pricing (Variant)', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/106/pricing' });
await page.getByText('A chair - available in multiple colors').waitFor();
await loadTab(page, 'Part Pricing');
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
@ -275,11 +261,8 @@ test('Parts - Pricing (Variant)', async ({ page }) => {
await page.waitForURL('**/part/109/**');
});
test('Parts - Pricing (Internal)', async ({ page }) => {
await doQuickLogin(page);
// Part
await navigate(page, 'part/65/pricing');
test('Parts - Pricing (Internal)', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/65/pricing' });
await page.getByText('Socket head cap screw, M2').waitFor();
await loadTab(page, 'Part Pricing');
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
@ -300,11 +283,9 @@ test('Parts - Pricing (Internal)', async ({ page }) => {
await page.getByText('Part *M2x4 SHCSSocket head').click();
});
test('Parts - Pricing (Purchase)', async ({ page }) => {
await doQuickLogin(page);
test('Parts - Pricing (Purchase)', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/pricing' });
// Part
await navigate(page, 'part/69/pricing');
await page.getByText('1.25mm Pitch, PicoBlade PCB').waitFor();
await loadTab(page, 'Part Pricing');
await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor();
@ -322,10 +303,8 @@ test('Parts - Pricing (Purchase)', async ({ page }) => {
await page.getByText('2022-04-29').waitFor();
});
test('Parts - Attachments', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/69/attachments');
test('Parts - Attachments', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/attachments' });
// Submit a new external link
await page.getByLabel('action-button-add-external-').click();
@ -344,10 +323,8 @@ test('Parts - Attachments', async ({ page }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
});
test('Parts - Parameters', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/69/parameters');
test('Parts - Parameters', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/parameters' });
// Create a new template
await page.getByLabel('action-button-add-parameter').click();
@ -371,10 +348,8 @@ test('Parts - Parameters', async ({ page }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
});
test('Parts - Notes', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/69/notes');
test('Parts - Notes', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/notes' });
// Enable editing
await page.getByLabel('Enable Editing').waitFor();
@ -393,20 +368,16 @@ test('Parts - Notes', async ({ page }) => {
await page.getByLabel('Close Editor').waitFor();
});
test('Parts - 404', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/99999/');
test('Parts - 404', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/99999/' });
await page.getByText('Page Not Found', { exact: true }).waitFor();
// Clear out any console error messages
await page.evaluate(() => console.clear());
});
test('Parts - Revision', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/906/details');
test('Parts - Revision', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/906/details' });
await page.getByText('Revision of').waitFor();
await page.getByText('Select Part Revision').waitFor();
@ -421,10 +392,10 @@ test('Parts - Revision', async ({ page }) => {
await page.getByText('Select Part Revision').waitFor();
});
test('Parts - Bulk Edit', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'part/category/index/parts');
test('Parts - Bulk Edit', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'part/category/index/parts'
});
// Edit the category for multiple parts
await page.getByLabel('Select record 1', { exact: true }).click();

View File

@ -11,12 +11,14 @@ import {
openFilterDrawer,
setTableChoiceFilter
} from '../helpers.ts';
import { doQuickLogin } from '../login.ts';
import { doCachedLogin } from '../login.ts';
test('Purchase Orders - Table', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Table', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
await activateTableView(page);
@ -42,10 +44,11 @@ test('Purchase Orders - Table', async ({ page }) => {
await page.getByText('2025-07-17').waitFor(); // Target Date
});
test('Purchase Orders - Calendar', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Calendar', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
// Ensure view is in "calendar" mode
@ -66,10 +69,11 @@ test('Purchase Orders - Calendar', async ({ page }) => {
await activateTableView(page);
});
test('Purchase Orders - Barcodes', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Barcodes', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/13/detail'
});
await navigate(page, 'purchasing/purchase-order/13/detail');
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
// Display QR code
@ -126,10 +130,11 @@ test('Purchase Orders - Barcodes', async ({ page }) => {
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
});
test('Purchase Orders - General', async ({ page }) => {
await doQuickLogin(page);
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);
@ -179,10 +184,15 @@ test('Purchase Orders - General', async ({ page }) => {
await page.getByRole('tab', { name: 'Details' }).waitFor();
});
test('Purchase Orders - Filters', async ({ page }) => {
await doQuickLogin(page, 'reader', 'readonly');
test('Purchase Orders - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'reader',
password: 'readonly'
});
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await loadTab(page, 'Purchase Orders');
await activateTableView(page);
@ -204,11 +214,13 @@ test('Purchase Orders - Filters', async ({ page }) => {
await page.getByRole('option', { name: 'Target Date After' }).waitFor();
});
test('Purchase Orders - Order Parts', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Order Parts', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Open "Order Parts" wizard from the "parts" table
await page.getByRole('tab', { name: 'Parts' }).click();
await page.waitForURL('**/part/category/index/**');
await page
.getByLabel('panel-tabs-partcategory')
.getByRole('tab', { name: 'Parts' })
@ -284,10 +296,12 @@ test('Purchase Orders - Order Parts', async ({ page }) => {
/**
* Tests for receiving items against a purchase order
*/
test('Purchase Orders - Receive Items', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Receive Items', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Purchasing' }).click();
await page.waitForURL('**/purchasing/index/**');
await page.getByRole('cell', { name: 'PO0014' }).click();
await loadTab(page, 'Order Details');
@ -351,10 +365,11 @@ test('Purchase Orders - Receive Items', async ({ page }) => {
await page.getByRole('cell', { name: 'bucket' }).first().waitFor();
});
test('Purchase Orders - Duplicate', async ({ page }) => {
await doQuickLogin(page);
test('Purchase Orders - Duplicate', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/13/detail'
});
await navigate(page, 'purchasing/purchase-order/13/detail');
await page.getByLabel('action-menu-order-actions').click();
await page.getByLabel('action-menu-order-actions-duplicate').click();

View File

@ -4,15 +4,13 @@ import {
clearTableFilters,
globalSearch,
loadTab,
navigate,
setTableChoiceFilter
} from '../helpers.ts';
import { doQuickLogin } from '../login.ts';
import { doCachedLogin } from '../login.ts';
test('Sales Orders - Tabs', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Tabs', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'sales/index/' });
await navigate(page, 'sales/index/');
await page.waitForURL('**/web/sales/**');
await loadTab(page, 'Sales Orders');
@ -63,10 +61,12 @@ test('Sales Orders - Tabs', async ({ page }) => {
await loadTab(page, 'Notes');
});
test('Sales Orders - Basic Tests', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Basic Tests', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Sales' }).click();
await page.waitForURL('**/sales/index/**');
await loadTab(page, 'Sales Orders');
await clearTableFilters(page);
@ -102,10 +102,12 @@ test('Sales Orders - Basic Tests', async ({ page }) => {
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
});
test('Sales Orders - Shipments', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Shipments', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('tab', { name: 'Sales' }).click();
await page.waitForURL('**/sales/index/**');
await loadTab(page, 'Sales Orders');
await clearTableFilters(page);
@ -131,7 +133,7 @@ test('Sales Orders - Shipments', async ({ page }) => {
await page.getByRole('menuitem', { name: 'Edit' }).click();
// Ensure the form has loaded
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
let tracking_number = await page
.getByLabel('text-field-tracking_number')
@ -201,10 +203,11 @@ test('Sales Orders - Shipments', async ({ page }) => {
.click();
});
test('Sales Orders - Duplicate', async ({ page }) => {
await doQuickLogin(page);
test('Sales Orders - Duplicate', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'sales/sales-order/11/detail'
});
await navigate(page, 'sales/sales-order/11/detail');
await page.getByLabel('action-menu-order-actions').click();
await page.getByLabel('action-menu-order-actions-duplicate').click();

View File

@ -1,6 +1,5 @@
import { test } from '../baseFixtures';
import { navigate } from '../helpers';
import { doQuickLogin } from '../login';
import { doCachedLogin } from '../login';
const scan = async (page, barcode) => {
await page.getByLabel('barcode-input-scanner').click();
@ -8,8 +7,8 @@ const scan = async (page, barcode) => {
await page.getByRole('button', { name: 'Scan', exact: true }).click();
};
test('Scanning - Dialog', async ({ page }) => {
await doQuickLogin(page);
test('Scanning - Dialog', async ({ browser }) => {
const page = await doCachedLogin(browser);
await page.getByRole('button', { name: 'Open Barcode Scanner' }).click();
await scan(page, '{"part": 15}');
@ -19,8 +18,8 @@ test('Scanning - Dialog', async ({ page }) => {
await page.getByText('Required:').waitFor();
});
test('Scanning - Basic', async ({ page }) => {
await doQuickLogin(page);
test('Scanning - Basic', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Navigate to the 'scan' page
await page.getByLabel('navigation-menu').click();
@ -40,9 +39,8 @@ test('Scanning - Basic', async ({ page }) => {
await page.getByText('No match found for barcode').waitFor();
});
test('Scanning - Part', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - Part', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"part": 1}');
@ -51,9 +49,8 @@ test('Scanning - Part', async ({ page }) => {
await page.getByRole('cell', { name: 'part', exact: true }).waitFor();
});
test('Scanning - Stockitem', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - Stockitem', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"stockitem": 408}');
await page.getByText('1551ABK').waitFor();
@ -61,9 +58,9 @@ test('Scanning - Stockitem', async ({ page }) => {
await page.getByRole('cell', { name: 'Quantity: 100' }).waitFor();
});
test('Scanning - StockLocation', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - StockLocation', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"stocklocation": 3}');
// stocklocation: 3
@ -74,20 +71,17 @@ test('Scanning - StockLocation', async ({ page }) => {
.waitFor();
});
test('Scanning - SupplierPart', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - SupplierPart', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"supplierpart": 204}');
// supplierpart: 204
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await page.getByText('1551ABK').first().waitFor();
await page.getByRole('cell', { name: 'supplierpart', exact: true }).waitFor();
});
test('Scanning - PurchaseOrder', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - PurchaseOrder', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"purchaseorder": 12}');
// purchaseorder: 12
@ -98,9 +92,9 @@ test('Scanning - PurchaseOrder', async ({ page }) => {
.waitFor();
});
test('Scanning - SalesOrder', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - SalesOrder', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"salesorder": 6}');
// salesorder: 6
@ -109,9 +103,8 @@ test('Scanning - SalesOrder', async ({ page }) => {
await page.getByRole('cell', { name: 'salesorder', exact: true }).waitFor();
});
test('Scanning - Build', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'scan/');
test('Scanning - Build', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'scan/' });
await scan(page, '{"build": 8}');
// build: 8

View File

@ -7,12 +7,11 @@ import {
openFilterDrawer,
setTableChoiceFilter
} from '../helpers.js';
import { doQuickLogin } from '../login.js';
import { doCachedLogin } from '../login.js';
test('Stock - Basic Tests', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Basic Tests', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
await navigate(page, 'stock/location/index/');
await page.waitForURL('**/web/stock/location/**');
await loadTab(page, 'Location Details');
@ -39,10 +38,9 @@ test('Stock - Basic Tests', async ({ page }) => {
await loadTab(page, 'Installed Items');
});
test('Stock - Location Tree', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Location Tree', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
await navigate(page, 'stock/location/index/');
await page.waitForURL('**/web/stock/location/**');
await loadTab(page, 'Location Details');
@ -56,10 +54,13 @@ test('Stock - Location Tree', async ({ page }) => {
await page.getByRole('cell', { name: 'Factory' }).first().waitFor();
});
test('Stock - Filters', async ({ page }) => {
await doQuickLogin(page, 'steven', 'wizardstaff');
test('Stock - Filters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
username: 'steven',
password: 'wizardstaff',
url: '/stock/location/index/'
});
await navigate(page, 'stock/location/index/');
await loadTab(page, 'Stock Items');
await openFilterDrawer(page);
@ -101,8 +102,8 @@ test('Stock - Filters', async ({ page }) => {
await clearTableFilters(page);
});
test('Stock - Serial Numbers', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Serial Numbers', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Use the "global search" functionality to find a part we are interested in
// This is to exercise the search functionality and ensure it is working as expected
@ -167,10 +168,8 @@ test('Stock - Serial Numbers', async ({ page }) => {
/**
* Test various 'actions' on the stock detail page
*/
test('Stock - Stock Actions', async ({ page }) => {
await doQuickLogin(page);
await navigate(page, 'stock/item/1225/details');
test('Stock - Stock Actions', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/item/1225/details' });
// Helper function to launch a stock action
const launchStockAction = async (action: string) => {
@ -231,11 +230,9 @@ test('Stock - Stock Actions', async ({ page }) => {
await page.getByLabel('action-menu-stock-operations-return').click();
});
test('Stock - Tracking', async ({ page }) => {
await doQuickLogin(page);
test('Stock - Tracking', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'stock/item/176/details' });
// Navigate to the "stock item" page
await navigate(page, 'stock/item/176/details/');
await page.getByRole('link', { name: 'Widget Assembly # 2' }).waitFor();
// Navigate to the "stock tracking" tab