TrioWatchAppUITests.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import XCTest
  2. final class TrioWatchAppUITests: XCTestCase {
  3. var app: XCUIApplication!
  4. override func setUpWithError() throws {
  5. continueAfterFailure = false
  6. app = XCUIApplication()
  7. app.launch()
  8. }
  9. func testMainViewElements() throws {
  10. // Test presence of main UI elements
  11. XCTAssertTrue(app.staticTexts["--"].exists) // Initial glucose value
  12. XCTAssertTrue(app.buttons["plus"].exists) // Treatment button
  13. // Test IOB and COB elements
  14. let iobElement = app.staticTexts.matching(identifier: "iob").firstMatch
  15. let cobElement = app.staticTexts.matching(identifier: "cob").firstMatch
  16. XCTAssertTrue(iobElement.exists)
  17. XCTAssertTrue(cobElement.exists)
  18. }
  19. func testTreatmentMenu() throws {
  20. // Open treatment menu
  21. app.buttons["plus"].tap()
  22. // Verify treatment options
  23. XCTAssertTrue(app.buttons["Carbs"].exists)
  24. XCTAssertTrue(app.buttons["Bolus"].exists)
  25. XCTAssertTrue(app.buttons["Meal Bolus"].exists)
  26. }
  27. func testBolusWorkflow() throws {
  28. // Open treatment menu
  29. app.buttons["plus"].tap()
  30. // Select bolus option
  31. app.buttons["Bolus"].tap()
  32. // Verify bolus input elements
  33. XCTAssertTrue(app.buttons["minus.circle.fill"].exists)
  34. XCTAssertTrue(app.buttons["plus.circle.fill"].exists)
  35. XCTAssertTrue(app.buttons["Log Bolus"].exists)
  36. }
  37. func testCarbsWorkflow() throws {
  38. // Open treatment menu
  39. app.buttons["plus"].tap()
  40. // Select carbs option
  41. app.buttons["Carbs"].tap()
  42. // Verify carbs input elements
  43. XCTAssertTrue(app.buttons["minus.circle.fill"].exists)
  44. XCTAssertTrue(app.buttons["plus.circle.fill"].exists)
  45. XCTAssertTrue(app.buttons["Log Carbs"].exists)
  46. }
  47. }