2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-22 00:47:38 +00:00

Generator updates (#10605)

* Form Field updates:

- Allow spec of leftSection prop
- Allow spec of rightSection prop

* Add ability to auto-fill text input with placeholder value

* Simplify stock form

* Better serial number placeholders

* Update other generator fields

* Add default placeholder to DateInput

* Enhance TextField

* Remove serial_numbers field for non-creation forms

* Update playwright tests

* Adjust playwright tests

* Further playwright adjustments

* Fix project code field for build serializer
This commit is contained in:
Oliver
2025-10-18 17:18:04 +11:00
committed by GitHub
parent a7c4f2adba
commit 72d127219f
16 changed files with 219 additions and 114 deletions

View File

@@ -142,14 +142,16 @@ test('Part - Editing', async ({ browser }) => {
// Open part edit dialog
await page.keyboard.press('Control+E');
const keywords = await page.getByLabel('text-field-keywords').inputValue();
const keywords = await page
.getByLabel('text-field-keywords', { exact: true })
.inputValue();
await page
.getByLabel('text-field-keywords')
.getByLabel('text-field-keywords', { exact: true })
.fill(keywords ? '' : 'table furniture');
// Test URL validation
await page
.getByRole('textbox', { name: 'text-field-link' })
.getByRole('textbox', { name: 'text-field-link', exact: true })
.fill('htxp-??QQQ++');
await page.waitForTimeout(200);
await page.getByRole('button', { name: 'Submit' }).click();
@@ -157,11 +159,15 @@ test('Part - Editing', async ({ browser }) => {
// Fill with an empty URL
const description = await page
.getByLabel('text-field-description')
.getByLabel('text-field-description', { exact: true })
.inputValue();
await page.getByRole('textbox', { name: 'text-field-link' }).fill('');
await page.getByLabel('text-field-description').fill(`${description}+`);
await page
.getByRole('textbox', { name: 'text-field-link', exact: true })
.fill('');
await page
.getByLabel('text-field-description', { exact: true })
.fill(`${description}+`);
await page.waitForTimeout(200);
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Item Updated').waitFor();
@@ -462,8 +468,12 @@ test('Parts - Attachments', async ({ browser }) => {
// Submit a new external link
await page.getByLabel('action-button-add-external-').click();
await page.getByLabel('text-field-link').fill('https://www.google.com');
await page.getByLabel('text-field-comment').fill('a sample comment');
await page
.getByLabel('text-field-link', { exact: true })
.fill('https://www.google.com');
await page
.getByLabel('text-field-comment', { exact: true })
.fill('a sample comment');
// Note: Text field values are debounced for 250ms
await page.waitForTimeout(300);
@@ -473,7 +483,9 @@ test('Parts - Attachments', async ({ browser }) => {
// Launch dialog to upload a file
await page.getByLabel('action-button-add-attachment').click();
await page.getByLabel('text-field-comment').fill('some comment');
await page
.getByLabel('text-field-comment', { exact: true })
.fill('some comment');
await page.getByRole('button', { name: 'Cancel' }).click();
});
@@ -489,7 +501,9 @@ test('Parts - Parameters', async ({ browser }) => {
await page.getByLabel('choice-field-data').click();
await page.getByRole('option', { name: 'Green' }).click();
await page.getByLabel('text-field-note').fill('A custom note field');
await page
.getByLabel('text-field-note', { exact: true })
.fill('A custom note field');
// Select the "polarized" parameter template (should create a "checkbox" field)
await page.getByLabel('related-field-template').fill('Polarized');
@@ -577,8 +591,8 @@ test('Parts - Notes', async ({ browser }) => {
// Use keyboard shortcut to "edit" the part
await page.keyboard.press('Control+E');
await page.getByLabel('text-field-name').waitFor();
await page.getByLabel('text-field-description').waitFor();
await page.getByLabel('text-field-name', { exact: true }).waitFor();
await page.getByLabel('text-field-description', { exact: true }).waitFor();
await page.getByLabel('related-field-category').waitFor();
await page.getByRole('button', { name: 'Cancel' }).click();