2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Tweak playwright tests (#9027)

This commit is contained in:
Oliver 2025-02-04 22:52:01 +11:00 committed by GitHub
parent 445fa45394
commit e1f25a03d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -81,3 +81,13 @@ export const navigate = async (page, url: string) => {
await page.goto(url, { waitUntil: 'domcontentloaded' });
};
/**
* Perform a 'global search' on the provided page, for the provided query text
*/
export const globalSearch = async (page, query) => {
await page.getByLabel('open-search').click();
await page.getByLabel('global-search-input').clear();
await page.getByPlaceholder('Enter search text').fill(query);
await page.waitForTimeout(300);
};

View File

@ -1,6 +1,7 @@
import { test } from '../baseFixtures.ts';
import {
clearTableFilters,
globalSearch,
navigate,
setTableChoiceFilter
} from '../helpers.ts';
@ -182,13 +183,7 @@ test('Sales Orders - Shipments', async ({ page }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
// Search for shipment by tracking number
await page.getByLabel('open-search').click();
await page.getByLabel('global-search-input').clear();
await page.waitForTimeout(250);
await page.getByLabel('global-search-input').fill('TRK-002');
await page.waitForTimeout(250);
await globalSearch(page, 'TRK-002');
await page
.getByText(/SO0009/)
@ -196,13 +191,7 @@ test('Sales Orders - Shipments', async ({ page }) => {
.click();
// Search for shipment by invoice number
await page.getByLabel('open-search').click();
await page.getByLabel('global-search-input').clear();
await page.waitForTimeout(250);
await page.getByLabel('global-search-input').fill('INV-123');
await page.waitForTimeout(250);
await globalSearch(page, 'INV-123');
await page
.getByText(/SO0025/)