Skip to content

Commit

Permalink
KATE IS A GOD
Browse files Browse the repository at this point in the history
  • Loading branch information
zoyagarg committed Mar 14, 2024
1 parent 5659109 commit 2df016b
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Intake.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
A9DFE8A92ABE551400428242 /* AccountButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9DFE8A82ABE551400428242 /* AccountButton.swift */; };
A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9FE7ACF2AA39BAB0077B045 /* AccountSheet.swift */; };
ACAA47812B571C800032D21F /* Questionnaire.json in Resources */ = {isa = PBXBuildFile; fileRef = ACAA47802B571C7F0032D21F /* Questionnaire.json */; };
ACBC9D1D2BA2B3F6003E2581 /* AllergyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACBC9D1C2BA2B3F6003E2581 /* AllergyTests.swift */; };
ACDF32ED2B9D0F4300B127E2 /* MenstrualHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACFFA1D02B8FD8BB0006E6D4 /* MenstrualHistory.swift */; };
ACF862BE2B96E29600ACBA1E /* ExportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACF862BD2B96E29600ACBA1E /* ExportView.swift */; };
ACFFA1CE2B8FD7190006E6D4 /* SmokingHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACFFA1CD2B8FD7190006E6D4 /* SmokingHistory.swift */; };
Expand Down Expand Up @@ -235,6 +236,7 @@
A9DFE8A82ABE551400428242 /* AccountButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountButton.swift; sourceTree = "<group>"; };
A9FE7ACF2AA39BAB0077B045 /* AccountSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSheet.swift; sourceTree = "<group>"; };
ACAA47802B571C7F0032D21F /* Questionnaire.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Questionnaire.json; sourceTree = "<group>"; };
ACBC9D1C2BA2B3F6003E2581 /* AllergyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllergyTests.swift; sourceTree = "<group>"; };
ACF862BD2B96E29600ACBA1E /* ExportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportView.swift; sourceTree = "<group>"; };
ACFFA1CD2B8FD7190006E6D4 /* SmokingHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmokingHistory.swift; sourceTree = "<group>"; };
ACFFA1D02B8FD8BB0006E6D4 /* MenstrualHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenstrualHistory.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -563,6 +565,7 @@
children = (
2F4E237D2989A2FE0013F3D9 /* LaunchTests.swift */,
510CAAF02BA0DFFB00872B1A /* MedicationTests.swift */,
ACBC9D1C2BA2B3F6003E2581 /* AllergyTests.swift */,
);
path = IntakeUITests;
sourceTree = "<group>";
Expand Down Expand Up @@ -931,6 +934,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ACBC9D1D2BA2B3F6003E2581 /* AllergyTests.swift in Sources */,
510CAAF12BA0DFFB00872B1A /* MedicationTests.swift in Sources */,
2F4E237E2989A2FE0013F3D9 /* LaunchTests.swift in Sources */,
);
Expand Down
16 changes: 14 additions & 2 deletions Intake.xcodeproj/xcshareddata/xcschemes/Intake.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,25 @@
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipToScrollable"
argument = "--testAllergy"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--testMenstrual"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--testPatient"
argument = "--testSmoking"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--skipToScrollable"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--testPatient"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--showOnboarding"
isEnabled = "NO">
Expand Down
1 change: 1 addition & 0 deletions Intake/Allergy Records/AddAllergy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct EditAllergyView: View {
TextField("Allergy Name", text: $data.allergyData[index].allergy)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding([.horizontal, .top])
.accessibilityLabel("Add Allergy Field")
ReactionSectionView(index: index)
Spacer()
saveButton
Expand Down
6 changes: 5 additions & 1 deletion Intake/Allergy Records/AllergyRecords.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ struct AllergyList: View {
VStack {
allergyForm
/**/
if data.generalData.sex == "Female" {
if FeatureFlags.skipToScrollable {
SubmitButton(nextView: NavigationViews.pdfs)
.padding()
}

Check failure on line 62 in Intake/Allergy Records/AllergyRecords.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Statement Position Violation: Else and catch should be on the same line, one space after the previous declaration (statement_position)
else if data.generalData.sex == "Female" {
SubmitButton(nextView: NavigationViews.menstrual)
.padding()
} else {
Expand Down
11 changes: 9 additions & 2 deletions Intake/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ struct StartButton: View {
var body: some View {
Button(action: {
if FeatureFlags.testMedication {
navigationPath.append(NavigationViews.medication)
} else {
navigationPath.append(NavigationViews.medication)
} else if FeatureFlags.testAllergy {
navigationPath.append(NavigationViews.allergies)
} else if FeatureFlags.testMenstrual {
navigationPath.append(NavigationViews.menstrual)

Check warning on line 40 in Intake/Home.swift

View check run for this annotation

Codecov / codecov/patch

Intake/Home.swift#L40

Added line #L40 was not covered by tests
} else if FeatureFlags.testSmoking {
navigationPath.append(NavigationViews.smoking)

Check warning on line 42 in Intake/Home.swift

View check run for this annotation

Codecov / codecov/patch

Intake/Home.swift#L42

Added line #L42 was not covered by tests
}

Check failure on line 43 in Intake/Home.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Statement Position Violation: Else and catch should be on the same line, one space after the previous declaration (statement_position)
else {
navigationPath.append(NavigationViews.general)
}
}) {
Expand Down
3 changes: 3 additions & 0 deletions Intake/SharedContext/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ enum FeatureFlags {
/// Adds a test task to the schedule at the current time
static let testSchedule = CommandLine.arguments.contains("--testSchedule")
static let testPatient = CommandLine.arguments.contains("--testPatient")
static let testAllergy = CommandLine.arguments.contains("--testAllergy")
static let testMenstrual = CommandLine.arguments.contains("--testMenstrual")
static let testSmoking = CommandLine.arguments.contains("--testSmoking")
static let testMedication = CommandLine.arguments.contains("--testMedication")
static let skipToScrollable = CommandLine.arguments.contains("--skipToScrollable")
}
9 changes: 7 additions & 2 deletions Intake/SocialHistory/MenstrualHistory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ struct SocialHistoryQuestionView: View {
.onDisappear {
data.menstrualHistory = MenstrualHistoryItem(startDate: startDate, endDate: endDate, additionalDetails: additionalDetails)
}
SubmitButton(nextView: NavigationViews.smoking)
.padding()
if FeatureFlags.skipToScrollable {
SubmitButton(nextView: NavigationViews.pdfs)
.padding()
} else {
SubmitButton(nextView: NavigationViews.smoking)
.padding()
}

Check warning on line 64 in Intake/SocialHistory/MenstrualHistory.swift

View check run for this annotation

Codecov / codecov/patch

Intake/SocialHistory/MenstrualHistory.swift#L58-L64

Added lines #L58 - L64 were not covered by tests
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions Intake/SocialHistory/SmokingHistory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ struct SmokingHistoryView: View {
.onDisappear {
storeSmokingHistory()
}
SubmitButton(nextView: NavigationViews.chat)
.padding()
if FeatureFlags.skipToScrollable {
SubmitButton(nextView: NavigationViews.pdfs)
.padding()
} else {
SubmitButton(nextView: NavigationViews.chat)
.padding()
}

Check warning on line 45 in Intake/SocialHistory/SmokingHistory.swift

View check run for this annotation

Codecov / codecov/patch

Intake/SocialHistory/SmokingHistory.swift#L39-L45

Added lines #L39 - L45 were not covered by tests
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions IntakeUITests/AllergyTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AllergyTests.swift
// IntakeUITests
//
// Created by Zoya Garg on 3/13/24.
//

import Foundation
import XCTest

class AllergyTests: XCTestCase {
override func setUpWithError() throws {
try super.setUpWithError()

continueAfterFailure = false

let app = XCUIApplication()
app.launchArguments = ["--skipOnboarding", "--disableFirebase", "--testPatient", "--testAllergy", "--skipToScrollable"]
app.launch()
}

func testAllergy() throws {
let app = XCUIApplication()

sleep(8)

XCTAssertEqual(app.state, .runningForeground)

app.buttons["Create New Form"].tap()
XCUIApplication().navigationBars["Allergies"].tap()
app.buttons["Add_allergy"].tap()
app.textFields["Allergy Name"].tap()
app.textFields["Allergy Name"].typeText("Peanut")
app.buttons["Save"].tap()
}
}

0 comments on commit 2df016b

Please sign in to comment.