import XCTest /// Comprehensive contractor testing suite covering all scenarios, edge cases, and variations /// This test suite is designed to be bulletproof and catch regressions early final class Suite7_ContractorTests: AuthenticatedTestCase { override var useSeededAccount: Bool { true } // Test data tracking var createdContractorNames: [String] = [] override func setUpWithError() throws { try super.setUpWithError() navigateToContractors() } override func tearDownWithError() throws { createdContractorNames.removeAll() try super.tearDownWithError() } // MARK: - Helper Methods private func openContractorForm() -> Bool { let addButton = findAddContractorButton() guard addButton.exists && addButton.isEnabled else { return false } addButton.tap() sleep(3) // Verify form opened using accessibility identifier let nameField = app.textFields[AccessibilityIdentifiers.Contractor.nameField] return nameField.waitForExistence(timeout: 5) } private func findAddContractorButton() -> XCUIElement { sleep(2) // Try accessibility identifier first let addButtonById = app.buttons[AccessibilityIdentifiers.Contractor.addButton] if addButtonById.waitForExistence(timeout: 5) && addButtonById.isEnabled { return addButtonById } // Fallback: look for add button by label in nav bar let navBarButtons = app.navigationBars.buttons for i in 0..