Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Stanford360.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
/* Begin PBXFileSystemSynchronizedRootGroup section */
45E2F0FC2D82132B0097C339 /* HydrationTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = HydrationTests; sourceTree = "<group>"; };
45E2F12D2D8291E30097C339 /* HydrationUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = HydrationUITests; sourceTree = "<group>"; };
4D490EDC2D86A78200C7E06F /* ProteinUITests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = ProteinUITests; sourceTree = "<group>"; };
4DB472D62D80459F005E895E /* ProteinTest */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = ProteinTest; sourceTree = "<group>"; };
4F8EA0B92D680A4400A94137 /* Activity */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Activity; sourceTree = "<group>"; };
4FF18DDD2D5FAB5E00E13832 /* ActivityTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = ActivityTests; sourceTree = "<group>"; };
Expand Down Expand Up @@ -368,6 +369,7 @@
653A256A28338800005D4D48 /* Stanford360UITests */ = {
isa = PBXGroup;
children = (
4D490EDC2D86A78200C7E06F /* ProteinUITests */,
45E2F12D2D8291E30097C339 /* HydrationUITests */,
2F4E237D2989A2FE0013F3D9 /* OnboardingTests.swift */,
653A256B28338800005D4D48 /* SchedulerTests.swift */,
Expand Down Expand Up @@ -519,6 +521,7 @@
);
fileSystemSynchronizedGroups = (
45E2F12D2D8291E30097C339 /* HydrationUITests */,
4D490EDC2D86A78200C7E06F /* ProteinUITests */,
);
name = Stanford360UITests;
packageProductDependencies = (
Expand Down
1 change: 1 addition & 0 deletions Stanford360/Protein/View/AddMealView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
.foregroundColor(.secondary)
TextField("Enter \(title.lowercased())", text: text)
.keyboardType(keyboardType)
.accessibilityIdentifier(title == "Meal Name" ? "mealNameField" : "proteinField")

Check warning on line 334 in Stanford360/Protein/View/AddMealView.swift

View check run for this annotation

Codecov / codecov/patch

Stanford360/Protein/View/AddMealView.swift#L334

Added line #L334 was not covered by tests
.padding()
.background(
RoundedRectangle(cornerRadius: 12)
Expand Down
1 change: 1 addition & 0 deletions Stanford360/Protein/View/ProteinHistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
ForEach(proteinManager.reverseSortMealsByDate(mealsByDate[date] ?? [])) { meal in
NavigationLink(destination: MealDetailView(meal: meal)) {
ProteinCardView(meal: meal)
.accessibilityIdentifier("mealLogEntry")

Check warning on line 36 in Stanford360/Protein/View/ProteinHistoryView.swift

View check run for this annotation

Codecov / codecov/patch

Stanford360/Protein/View/ProteinHistoryView.swift#L36

Added line #L36 was not covered by tests
}
.listRowSeparator(.hidden)
}
Expand Down
46 changes: 46 additions & 0 deletions Stanford360UITests/ProteinUITests/ProteinTabViewTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// This source file is part of the Stanford 360 based on the Stanford Spezi Template Application project
//
// SPDX-FileCopyrightText: 2025 Stanford University
//
// SPDX-License-Identifier: MIT
//

import XCTest

final class ProteinTabViewTests: XCTestCase {
@MainActor
override func setUp() async throws {
continueAfterFailure = false
let app = XCUIApplication()
app.launchArguments = ["--skipOnboarding"]
app.launch()

let dontAllowIdentifier = app.buttons["UIA.Health.AuthSheet.CancelButton"]
if dontAllowIdentifier.waitForExistence(timeout: 5) {
dontAllowIdentifier.tap()
}
}

// Test Protein Tab View Navigation
@MainActor
func testProteinTabViewNavigation() throws {
let app = XCUIApplication()

XCTAssertTrue(app.wait(for: .runningForeground, timeout: 5))

XCTAssertTrue(app.tabBars["Tab Bar"].buttons["Protein"].exists)
app.tabBars["Tab Bar"].buttons["Protein"].tap()

let addTab = app.segmentedControls.buttons["Add"]
XCTAssertTrue(addTab.waitForExistence(timeout: 2), "Add tab should exist")
addTab.tap()

let historyTab = app.segmentedControls.buttons["History"]
XCTAssertTrue(historyTab.waitForExistence(timeout: 2), "History tab should exist")
historyTab.tap()

let discoverTab = app.segmentedControls.buttons["Discover"]
XCTAssertTrue(discoverTab.waitForExistence(timeout: 2), "Discover tab should exist")
discoverTab.tap()
}
}