2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00
InvenTree/src/frontend/tests/pui_general.spec.ts
Oliver 44cca7ddf2
[UI] Search Improvements (#9137)
* Harden playwright tests

* Refactor search drawer

- Allow result groups to collapse

* Add tooltip

* Fix menu position

* Navigate through to complete list of results

* Refactor table headers

* Add index pages for SupplierPart and ManufacturerPart models

* backend: allow split search by company type

* Fix panel naming bug

* Fix model URLs

* Split company results by company type

- Allows better routing to results list

* Remove debug msg

* Fix 'button within button' issue

* Additional playwright tests
2025-02-22 15:00:25 +11:00

55 lines
1.9 KiB
TypeScript

import { test } from './baseFixtures.js';
import { globalSearch, navigate } from './helpers.js';
import { doQuickLogin } from './login.js';
/**
* Test for integration of django admin button
*/
test('Admin Button', async ({ page }) => {
await doQuickLogin(page, 'admin', 'inventree');
await navigate(page, 'company/1/details');
// Click on the admin button
await page.getByLabel(/action-button-open-in-admin/).click();
await page.waitForURL('**/test-admin/company/company/1/change/**');
await page.getByRole('heading', { name: 'Change Company' }).waitFor();
await page.getByRole('link', { name: 'View on site' }).waitFor();
});
// Tests for the global search functionality
test('Search', async ({ page }) => {
await doQuickLogin(page, 'steven', 'wizardstaff');
await globalSearch(page, 'another customer');
// Check for expected results
await page.locator('a').filter({ hasText: 'Customer B' }).first().waitFor();
await page.locator('a').filter({ hasText: 'Customer C' }).first().waitFor();
await page.locator('a').filter({ hasText: 'Customer D' }).first().waitFor();
await page.locator('a').filter({ hasText: 'Customer E' }).first().waitFor();
// Click through to the "Customer" results
await page.getByRole('button', { name: 'view-all-results-customer' }).click();
await page.waitForURL('**/sales/index/customers**');
await page.getByText('Custom table filters are active').waitFor();
await globalSearch(page, '0402 res');
await page
.locator('span')
.filter({ hasText: 'Parts - 16 results' })
.first()
.waitFor();
await page
.locator('span')
.filter({ hasText: 'Supplier Parts - 138 results' })
.first()
.waitFor();
await page.getByLabel('view-all-results-manufacturerpart').click();
await page.waitForURL('**/purchasing/index/manufacturer-parts**');
await page.getByRole('cell', { name: 'RT0402BRD07100KL' }).waitFor();
});