Comprehensive test script for all ShopDB forms
- Rewrote test_forms.ps1 with complete form coverage - Tests: notifications, equipment, printers, subnets, applications, KB articles, vendors, models, and all network device types - Added edit form page load tests - Added API endpoint tests - Added validation tests for required fields - Uses AUTOTEST_ prefix for easy cleanup identification - Added cleanup_test_data.sql for database cleanup - Removed outdated test_forms.sh and test_savemachine.html 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
37
tests/cleanup_test_data.sql
Normal file
37
tests/cleanup_test_data.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- ============================================================================
|
||||
-- ShopDB Test Data Cleanup Script
|
||||
-- ============================================================================
|
||||
-- Run this after test_forms.ps1 to remove test data
|
||||
-- Replace AUTOTEST_YYYYMMDD_HHMMSS with actual test prefix from test run
|
||||
-- ============================================================================
|
||||
|
||||
-- Set the test prefix (update this with the actual prefix from test output)
|
||||
SET @test_prefix = 'AUTOTEST_%';
|
||||
|
||||
-- Show what will be deleted (preview)
|
||||
SELECT 'Notifications to delete:' AS info, COUNT(*) AS count FROM notifications WHERE notification LIKE @test_prefix;
|
||||
SELECT 'Machines to delete:' AS info, COUNT(*) AS count FROM machines WHERE machinenumber LIKE @test_prefix OR alias LIKE @test_prefix;
|
||||
SELECT 'Printers to delete:' AS info, COUNT(*) AS count FROM printers WHERE printercsfname LIKE @test_prefix;
|
||||
SELECT 'Subnets to delete:' AS info, COUNT(*) AS count FROM subnets WHERE description LIKE @test_prefix;
|
||||
SELECT 'Applications to delete:' AS info, COUNT(*) AS count FROM applications WHERE applicationname LIKE @test_prefix;
|
||||
SELECT 'KB Articles to delete:' AS info, COUNT(*) AS count FROM knowledgebase WHERE shortdescription LIKE @test_prefix;
|
||||
SELECT 'Vendors to delete:' AS info, COUNT(*) AS count FROM vendors WHERE vendor LIKE @test_prefix;
|
||||
SELECT 'Models to delete:' AS info, COUNT(*) AS count FROM models WHERE modelnumber LIKE @test_prefix;
|
||||
|
||||
-- Uncomment lines below to actually delete (run preview first!)
|
||||
|
||||
-- DELETE FROM communications WHERE machineid IN (SELECT machineid FROM machines WHERE machinenumber LIKE @test_prefix OR alias LIKE @test_prefix);
|
||||
-- DELETE FROM machinerelationships WHERE machineid IN (SELECT machineid FROM machines WHERE machinenumber LIKE @test_prefix OR alias LIKE @test_prefix);
|
||||
-- DELETE FROM notifications WHERE notification LIKE @test_prefix;
|
||||
-- DELETE FROM machines WHERE machinenumber LIKE @test_prefix OR alias LIKE @test_prefix;
|
||||
-- DELETE FROM printers WHERE printercsfname LIKE @test_prefix;
|
||||
-- DELETE FROM subnets WHERE description LIKE @test_prefix;
|
||||
-- DELETE FROM applications WHERE applicationname LIKE @test_prefix;
|
||||
-- DELETE FROM knowledgebase WHERE shortdescription LIKE @test_prefix;
|
||||
-- DELETE FROM vendors WHERE vendor LIKE @test_prefix;
|
||||
-- DELETE FROM models WHERE modelnumber LIKE @test_prefix;
|
||||
|
||||
-- Verify cleanup
|
||||
-- SELECT 'Remaining test data:' AS info;
|
||||
-- SELECT 'Notifications:' AS type, COUNT(*) AS count FROM notifications WHERE notification LIKE 'AUTOTEST%';
|
||||
-- SELECT 'Machines:' AS type, COUNT(*) AS count FROM machines WHERE machinenumber LIKE 'AUTOTEST%' OR alias LIKE 'AUTOTEST%';
|
||||
Reference in New Issue
Block a user