mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 15:15:42 +00:00 
			
		
		
		
	Url fix 2 (#9548)
* Logic fix
* Playwright test
* Revert "Playwright test"
This reverts commit a63b23961e.
* Simplify test
* Cleanup test
			
			
This commit is contained in:
		@@ -38,7 +38,7 @@ class InvenTreeRestURLField(RestURLField):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if not strict_urls and data is not empty and data is not None:
 | 
					        if not strict_urls and data is not empty and data is not None:
 | 
				
			||||||
            data = str(data).strip()
 | 
					            data = str(data).strip()
 | 
				
			||||||
            if '://' not in data:
 | 
					            if data and '://' not in data:
 | 
				
			||||||
                # Validate as if there were a schema provided
 | 
					                # Validate as if there were a schema provided
 | 
				
			||||||
                data = 'http://' + data
 | 
					                data = 'http://' + data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,6 +113,30 @@ test('Parts - BOM', async ({ browser }) => {
 | 
				
			|||||||
  await page.getByRole('button', { name: 'Close' }).click();
 | 
					  await page.getByRole('button', { name: 'Close' }).click();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test('Part - Editing', async ({ browser }) => {
 | 
				
			||||||
 | 
					  const page = await doCachedLogin(browser, { url: 'part/104/details' });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  await page.getByText('A square table - with blue paint').first().waitFor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Open part edit dialog
 | 
				
			||||||
 | 
					  await page.keyboard.press('Control+E');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const keywords = await page.getByLabel('text-field-keywords').inputValue();
 | 
				
			||||||
 | 
					  await page
 | 
				
			||||||
 | 
					    .getByLabel('text-field-keywords')
 | 
				
			||||||
 | 
					    .fill(keywords ? '' : 'table furniture');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Test URL validation
 | 
				
			||||||
 | 
					  await page.getByLabel('text-field-link').fill('htxp-??QQQ++');
 | 
				
			||||||
 | 
					  await page.getByRole('button', { name: 'Submit' }).click();
 | 
				
			||||||
 | 
					  await page.getByText('Enter a valid URL.').waitFor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Fill with an empty URL
 | 
				
			||||||
 | 
					  await page.getByLabel('text-field-link').fill('');
 | 
				
			||||||
 | 
					  await page.getByRole('button', { name: 'Submit' }).click();
 | 
				
			||||||
 | 
					  await page.getByText('Item Updated').waitFor();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test('Parts - Locking', async ({ browser }) => {
 | 
					test('Parts - Locking', async ({ browser }) => {
 | 
				
			||||||
  const page = await doCachedLogin(browser, { url: 'part/104/bom' });
 | 
					  const page = await doCachedLogin(browser, { url: 'part/104/bom' });
 | 
				
			||||||
  await loadTab(page, 'Bill of Materials');
 | 
					  await loadTab(page, 'Bill of Materials');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user