mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-28 10:34:34 +00:00
Adjust playwright tests (#13405)
* Adjust playwright tests * tweak playwright test
This commit is contained in:
1 parent
46e136ae0c
commit
4ec57581ea
9 files changed
+55
-17
No files matched your search
@@ -287,6 +287,7 @@ test('Build Order - Build Outputs', async ({ browser }) => {
|
||||
await page.getByText('On Hold').first().waitFor();
|
||||
await page.getByText('Pending').first().waitFor();
|
||||
|
||||
await tableSearch(page, 'BO0011');
|
||||
await page.getByRole('cell', { name: 'BO0011' }).click();
|
||||
await loadTab(page, 'Incomplete Outputs');
|
||||
await page.getByRole('cell', { name: 'BX-123' }).waitFor();
|
||||
|
||||
@@ -7,7 +7,8 @@ import {
|
||||
navigate,
|
||||
openDetailAction,
|
||||
setTableChoiceFilter,
|
||||
showParametricView
|
||||
showParametricView,
|
||||
tableSearch
|
||||
} from '../helpers.js';
|
||||
import { doCachedLogin } from '../login.js';
|
||||
|
||||
@@ -25,6 +26,7 @@ test('Company - Basic Tests', async ({ browser }) => {
|
||||
|
||||
await loadTab(page, 'Purchase Orders');
|
||||
await clearTableFilters(page);
|
||||
await tableSearch(page, 'Molex');
|
||||
await page.getByRole('cell', { name: 'Molex connectors' }).first().waitFor();
|
||||
|
||||
await loadTab(page, 'Stock Items');
|
||||
|
||||
@@ -654,7 +654,7 @@ test('Parts - Locking', async ({ browser }) => {
|
||||
|
||||
// Check expected "badge" values
|
||||
await page.getByText('In Stock: 13').waitFor();
|
||||
await page.getByText('Required: 10').waitFor();
|
||||
await page.getByText(/Required: \d+/).waitFor();
|
||||
await page.getByText('In Production: 50').waitFor();
|
||||
|
||||
// Check the "parameters" tab also
|
||||
@@ -689,14 +689,14 @@ test('Parts - Details', async ({ browser }) => {
|
||||
|
||||
// Non-consumable part
|
||||
await expect(
|
||||
page.getByRole('row', { name: 'Consumable Part' })
|
||||
page.getByRole('row', { name: /^Consumable Part/ })
|
||||
).toContainText('No');
|
||||
|
||||
// Consumable part
|
||||
await navigate(page, 'part/921/details');
|
||||
|
||||
await expect(
|
||||
page.getByRole('row', { name: 'Consumable Part' })
|
||||
page.getByRole('row', { name: /^Consumable Part/ })
|
||||
).toContainText('Yes');
|
||||
});
|
||||
|
||||
@@ -910,7 +910,10 @@ test('Parts - Pricing (Nothing, BOM)', async ({ browser }) => {
|
||||
// Overview Graph
|
||||
const graph = page.getByLabel('pricing-overview-chart');
|
||||
await graph.waitFor();
|
||||
await graph.getByText('$60').waitFor();
|
||||
await graph
|
||||
.getByText(/^\$\d+/)
|
||||
.first()
|
||||
.waitFor();
|
||||
await graph.locator('tspan').filter({ hasText: 'BOM Pricing' }).waitFor();
|
||||
await graph.locator('tspan').filter({ hasText: 'Overall Pricing' }).waitFor();
|
||||
|
||||
@@ -1228,7 +1231,10 @@ test('Parts - Parameter Filtering', async ({ browser }) => {
|
||||
await clearTableFilters(page);
|
||||
|
||||
// All parts should be available (no filters applied)
|
||||
await page.getByText(/\/ 43\d/).waitFor();
|
||||
// Record the unfiltered total, so we can check it is restored later
|
||||
const totalParts = page.getByText(/1 - \d+ \/ \d+/).first();
|
||||
await totalParts.waitFor();
|
||||
const totalText = await totalParts.innerText();
|
||||
|
||||
const clearParamFilter = async (name: string) => {
|
||||
await clickOnParamFilter(page, name);
|
||||
@@ -1246,7 +1252,7 @@ test('Parts - Parameter Filtering', async ({ browser }) => {
|
||||
// Reset the filter
|
||||
await clearParamFilter('Color');
|
||||
|
||||
await page.getByText(/\/ 43\d/).waitFor();
|
||||
await page.getByText(totalText, { exact: true }).waitFor();
|
||||
});
|
||||
|
||||
test('Parts - Test Results', async ({ browser }) => {
|
||||
|
||||
@@ -178,6 +178,7 @@ test('Purchase Orders - General', async ({ browser }) => {
|
||||
await page.getByRole('tab', { name: 'Purchasing' }).click();
|
||||
await page.waitForURL('**/purchasing/index/**');
|
||||
|
||||
await tableSearch(page, 'PO0012');
|
||||
await page.getByRole('cell', { name: 'PO0012' }).click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
@@ -241,14 +242,24 @@ test('Purchase Orders - Table', async ({ browser }) => {
|
||||
await clearTableFilters(page);
|
||||
|
||||
// Check for expected values
|
||||
await page.getByRole('cell', { name: 'PO0014' }).waitFor();
|
||||
await page.getByText('Wire-E-Coyote').waitFor();
|
||||
await page.getByText('Cancelled').first().waitFor();
|
||||
await page.getByText('Pending').first().waitFor();
|
||||
await page.getByText('On Hold').first().waitFor();
|
||||
// (search for specific orders, as the table is paginated)
|
||||
const expectedValues: [string, string][] = [
|
||||
['PO0014', 'PCBWOY'],
|
||||
['PO0011', 'Wire-E-Coyote'],
|
||||
['PO0004', 'Cancelled'],
|
||||
['PO0012', 'Pending'],
|
||||
['PO0001', 'On Hold']
|
||||
];
|
||||
|
||||
for (const [reference, text] of expectedValues) {
|
||||
await tableSearch(page, reference);
|
||||
await page.getByRole('cell', { name: reference }).waitFor();
|
||||
await page.getByText(text).first().waitFor();
|
||||
}
|
||||
|
||||
// Filter by 'has start date'
|
||||
await setTableChoiceFilter(page, 'Has Start Date', 'Yes');
|
||||
await tableSearch(page, 'PO0015');
|
||||
await page.getByRole('cell', { name: 'Scheduled purchase order' }).waitFor();
|
||||
|
||||
// Click through to a particular purchase order
|
||||
@@ -506,6 +517,7 @@ test('Purchase Orders - Receive Items', async ({ browser }) => {
|
||||
await page.getByRole('tab', { name: 'Purchasing' }).click();
|
||||
await page.waitForURL('**/purchasing/index/**');
|
||||
|
||||
await tableSearch(page, 'PO0014');
|
||||
await page.getByRole('cell', { name: 'PO0014' }).click();
|
||||
|
||||
await loadTab(page, 'Order Details');
|
||||
|
||||
@@ -188,6 +188,7 @@ test('Sales Orders - Shipments', async ({ browser }) => {
|
||||
await clearTableFilters(page);
|
||||
|
||||
// Click through to a particular sales order
|
||||
await tableSearch(page, 'SO0006');
|
||||
await page.getByRole('cell', { name: 'SO0006' }).first().click();
|
||||
await loadTab(page, 'Shipments');
|
||||
await clearTableFilters(page);
|
||||
@@ -626,7 +627,10 @@ test('Sales Orders - Parametric View', async ({ browser }) => {
|
||||
|
||||
// Columns and data are rendered in the parametric table
|
||||
await page.getByRole('button', { name: 'Customer' }).waitFor();
|
||||
await page.getByRole('cell', { name: 'SO0001' }).waitFor();
|
||||
await page
|
||||
.getByRole('cell', { name: /^SO\d+$/ })
|
||||
.first()
|
||||
.waitFor();
|
||||
|
||||
// Search within the parametric table
|
||||
await tableSearch(page, 'SO0001');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import { type Page, expect } from '@playwright/test';
|
||||
import { createApi } from '../api';
|
||||
import { test } from '../baseFixtures';
|
||||
import { adminuser } from '../defaults';
|
||||
@@ -232,5 +232,10 @@ test('Barcode Scanning - Forms', async ({ browser }) => {
|
||||
.getByRole('textbox', { name: 'barcode-scan-keyboard-input' })
|
||||
.fill('INV-SL37');
|
||||
await page.getByRole('button', { name: 'Scan', exact: true }).click();
|
||||
await page.getByText('Offsite Storage').waitFor();
|
||||
|
||||
// The scanned location is shown in the location field
|
||||
// (the stock table behind the form may also show 'Offsite Storage')
|
||||
await expect(
|
||||
page.getByRole('textbox', { name: 'tree-field-location' })
|
||||
).toHaveValue('Offsite Storage');
|
||||
});
|
||||
@@ -1,6 +1,12 @@
|
||||
import { test } from './baseFixtures';
|
||||
import { stevenuser } from './defaults';
|
||||
import { globalSearch, loadTab, navigate, waitForDataOutput } from './helpers';
|
||||
import {
|
||||
globalSearch,
|
||||
loadTab,
|
||||
navigate,
|
||||
tableSearch,
|
||||
waitForDataOutput
|
||||
} from './helpers';
|
||||
import { doCachedLogin } from './login';
|
||||
|
||||
// Helper function to open the export data dialog
|
||||
@@ -35,6 +41,7 @@ test('Exporting - Orders', async ({ browser }) => {
|
||||
);
|
||||
|
||||
// Download list of purchase order items
|
||||
await tableSearch(page, 'PO0014');
|
||||
await page.getByRole('cell', { name: 'PO0014' }).click();
|
||||
|
||||
// Click through to the PurchaseOrder from the detail tab
|
||||
|
||||
@@ -125,6 +125,7 @@ test('Printing - Report Printing', async ({ browser }) => {
|
||||
await loadTab(page, 'Purchase Orders');
|
||||
await activateTableView(page);
|
||||
|
||||
await tableSearch(page, 'PO0013');
|
||||
await page.getByRole('cell', { name: 'PO0013' }).click();
|
||||
|
||||
// Select "print report"
|
||||
|
||||
@@ -131,7 +131,7 @@ test('Tables - Pagination', async ({ browser }) => {
|
||||
await page.getByText(/11 - 20 \/ \d+/).waitFor();
|
||||
|
||||
// Set page size back to 25
|
||||
await page.getByRole('button', { name: '10' }).click();
|
||||
await page.getByRole('button', { name: '10' }).first().click();
|
||||
await page.getByRole('menuitem', { name: '25', exact: true }).click();
|
||||
|
||||
await page.getByText(/1 - 25 \/ \d+/).waitFor();
|
||||
|
||||
Reference in new issue
Block a user