Skip to content

Commit a0477fa

Browse files
shamit05Calvin-Xu
andauthored
New documentation (#57)
# *Documentation updated to be standard* ## ⚙️ Release Notes **Have the following components:** Title of the Project. Relevant README badges. Short 1-2 sentence description of the project. Screenshots in a table as outlined above. Setup instructions. Any additional project information and relevant links to additional documentation markdown pages. Contributing & License section ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md). --------- Co-authored-by: Pinlin [Calvin] Xu <calvinxu806@gmail.com>
1 parent 2899cd4 commit a0477fa

File tree

3 files changed

+73
-351
lines changed

3 files changed

+73
-351
lines changed

FeedbridgeUITests/AddBabyTests.swift

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ class AddBabyTests: XCTestCase {
4747
app.buttons["Settings"].tap()
4848

4949
// Verify initial state: No baby should be selected
50-
XCTAssertTrue(app.staticTexts["Select Baby"].exists, "Select baby dropdown should be visible")
51-
XCTAssertTrue(app.staticTexts["No baby selected"].exists, "No babies should exist")
50+
XCTAssertTrue(app.staticTexts["Select Baby"].waitForExistence(timeout: 5), "Select baby dropdown should be visible")
51+
XCTAssertTrue(app.staticTexts["No baby selected"].waitForExistence(timeout: 5), "No babies should exist")
5252

5353
// Open the dropdown menu and select "Add New Baby"
5454
let dropdown = app.buttons["Baby icon, Select Baby, Menu dropdown"]
5555
dropdown.tap()
5656
let addNew = app.buttons["Add New Baby"]
57-
XCTAssertTrue(addNew.exists, "Should be an option to add a baby")
57+
XCTAssertTrue(addNew.waitForExistence(timeout: 5), "Should be an option to add a baby")
5858
addNew.tap()
5959

6060
// Ensure that the Save button is initially disabled
@@ -67,7 +67,7 @@ class AddBabyTests: XCTestCase {
6767
nameField.typeText("Benjamin")
6868

6969
// Verify that a duplicate name warning is not displayed
70-
XCTAssertFalse(app.staticTexts["This name is already taken"].exists, "Duplicate name warning should not appear")
70+
XCTAssertFalse(app.staticTexts["This name is already taken"].waitForExistence(timeout: 5), "Duplicate name warning should not appear")
7171

7272
// Date Picker: Select March 2025 (valid past date)
7373
let datePickersQuery = app.datePickers.firstMatch
@@ -82,24 +82,14 @@ class AddBabyTests: XCTestCase {
8282
saveButton.tap()
8383

8484
// Verify that the new baby is correctly added and displayed in the UI
85-
XCTAssertTrue(app.staticTexts["Benjamin"].exists, "Baby's name should be displayed")
86-
XCTAssertTrue(app.buttons["Baby icon, Benjamin, Menu dropdown"].exists, "Baby dropdown should show new baby")
87-
XCTAssertTrue(app.buttons["Delete Baby, Delete Baby"].exists, "Delete button should be displayed for the new baby")
88-
XCTAssertTrue(app.staticTexts["Use Kilograms"].exists, "The 'Use Kilograms' text should be displayed")
89-
}
90-
91-
func testNavigateToHealthDetails() {
92-
let app = XCUIApplication()
93-
// app.buttons["Settings"].tap()
94-
95-
// Ensure at least one baby
96-
if app.staticTexts["No baby selected"].exists {
97-
testAddBaby()
98-
}
99-
85+
XCTAssertTrue(app.staticTexts["Benjamin"].waitForExistence(timeout: 5), "Baby's name should be displayed")
86+
XCTAssertTrue(app.buttons["Baby icon, Benjamin, Menu dropdown"].waitForExistence(timeout: 5), "Baby dropdown should show new baby")
87+
XCTAssertTrue(app.buttons["Delete Baby, Delete Baby"].waitForExistence(timeout: 5), "Delete button should be displayed for the new baby")
88+
XCTAssertTrue(app.staticTexts["Use Kilograms"].waitForExistence(timeout: 5), "The 'Use Kilograms' text should be displayed")
89+
10090
let healthDetailsCell = app.staticTexts["Health Details"]
10191
XCTAssertTrue(
102-
healthDetailsCell.exists,
92+
healthDetailsCell.waitForExistence(timeout: 5),
10393
"Health Details navigation link not found."
10494
)
10595
healthDetailsCell.tap()
@@ -112,10 +102,10 @@ class AddBabyTests: XCTestCase {
112102

113103
print("DEBUG: Current UI for 'AddEntryView':\n\(app.debugDescription)")
114104

115-
XCTAssertTrue(app.staticTexts["FEED ENTRIES"].exists, "Feed Entries exists")
116-
XCTAssertTrue(app.staticTexts["WEIGHT ENTRIES"].exists, "Weight Entries exists")
117-
XCTAssertTrue(app.staticTexts["STOOL ENTRIES"].exists, "Stool Entries exists")
118-
XCTAssertTrue(app.staticTexts["VOID ENTRIES"].exists, "Void Entries exists")
119-
XCTAssertTrue(app.staticTexts["DEHYDRATION CHECKS"].exists, "Dehydration Checks exists")
105+
XCTAssertTrue(app.staticTexts["FEED ENTRIES"].waitForExistence(timeout: 5), "Feed Entries exists")
106+
XCTAssertTrue(app.staticTexts["WEIGHT ENTRIES"].waitForExistence(timeout: 5), "Weight Entries exists")
107+
XCTAssertTrue(app.staticTexts["STOOL ENTRIES"].waitForExistence(timeout: 5), "Stool Entries exists")
108+
XCTAssertTrue(app.staticTexts["VOID ENTRIES"].waitForExistence(timeout: 5), "Void Entries exists")
109+
XCTAssertTrue(app.staticTexts["DEHYDRATION CHECKS"].waitForExistence(timeout: 5), "Dehydration Checks exists")
120110
}
121111
}

FeedbridgeUITests/AddEntryTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ final class AddEntryTests: XCTestCase {
9898

9999
// Check that "No babies found" is displayed
100100
XCTAssertTrue(
101-
app.staticTexts["No babies found"].exists,
101+
app.staticTexts["No babies found"].waitForExistence(timeout: 5),
102102
"Should show 'No babies found' message if there are no babies."
103103
)
104-
XCTAssertTrue(app.staticTexts["Please add a baby in Settings before adding entries."].exists)
104+
XCTAssertTrue(app.staticTexts["Please add a baby in Settings before adding entries."].waitForExistence(timeout: 5))
105105
}
106106

107107
/// Tests adding a weight entry in kilograms.
@@ -219,7 +219,7 @@ final class AddEntryTests: XCTestCase {
219219
// Enter a feed time
220220
let feedTimeField = app.textFields["Feed time (minutes)"]
221221
XCTAssertTrue(
222-
feedTimeField.exists, "Feed time text field should be present for direct breastfeeding."
222+
feedTimeField.waitForExistence(timeout: 5), "Feed time text field should be present for direct breastfeeding."
223223
)
224224
feedTimeField.tap()
225225
feedTimeField.typeText("15")
@@ -362,12 +362,12 @@ final class AddEntryTests: XCTestCase {
362362

363363
// Toggle poor skin elasticity
364364
let poorSkinSwitch = app.switches["Poor Skin Elasticity"]
365-
XCTAssertTrue(poorSkinSwitch.exists, "Poor Skin Elasticity toggle not found.")
365+
XCTAssertTrue(poorSkinSwitch.waitForExistence(timeout: 5), "Poor Skin Elasticity toggle not found.")
366366
poorSkinSwitch.tap()
367367

368368
// Toggle dry mucous membranes
369369
let dryMucousSwitch = app.switches["Dry Mucous Membranes"]
370-
XCTAssertTrue(dryMucousSwitch.exists, "Dry Mucous Membranes toggle not found.")
370+
XCTAssertTrue(dryMucousSwitch.waitForExistence(timeout: 5), "Dry Mucous Membranes toggle not found.")
371371
dryMucousSwitch.tap()
372372

373373
print("DEBUG: Dehydration toggles set on")
@@ -422,7 +422,7 @@ final class AddEntryTests: XCTestCase {
422422

423423
// At this point, the entry won't be saved, so "Entry saved successfully!" should NOT appear
424424
let successBanner = app.staticTexts["Entry saved successfully!"]
425-
XCTAssertFalse(successBanner.exists, "Success banner should not appear with invalid input.")
425+
XCTAssertFalse(successBanner.waitForExistence(timeout: 5), "Success banner should not appear with invalid input.")
426426
}
427427

428428
/// Tests that invalid feeding input (zero or negative time or volume) is handled properly.
@@ -460,7 +460,7 @@ final class AddEntryTests: XCTestCase {
460460

461461
let successBanner = app.staticTexts["Entry saved successfully!"]
462462
XCTAssertFalse(
463-
successBanner.exists, "Success banner should not appear with invalid feeding data."
463+
successBanner.waitForExistence(timeout: 5), "Success banner should not appear with invalid feeding data."
464464
)
465465
}
466466
}

0 commit comments

Comments
 (0)