Fix remaining 17 UI test failures: group defaults, identifiers, hittability, date format
- resetAppState: use correct suite name to clear group defaults (fixes stale subscription state) - Reorder configureIfNeeded: set expireTrial before IAPManager init - Add browse_themes_button identifier to CustomizeView Browse Themes button - Add mood_button_* identifiers to Entry Detail mood grid in NoteEditorView - Use coordinate-based tap throughout all test screens (iOS 26 Liquid Glass hittability) - Fix HeaderMoodLogging date format: M/d/yyyy → yyyy/MM/dd to match entry_row identifiers - AppLaunchTests: wait for isSelected state with NSPredicate instead of immediate check - OnboardingTests: add waits between swipes and retry logic for skip button Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,17 +66,19 @@ enum UITestMode {
|
|||||||
GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
|
GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
IAPManager.shared.bypassSubscription = bypassSubscription
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if expireTrial {
|
if expireTrial {
|
||||||
// Set firstLaunchDate to 31 days ago so the 30-day trial is expired
|
// Set firstLaunchDate to 31 days ago so the 30-day trial is expired.
|
||||||
|
// Must run BEFORE IAPManager.shared is accessed so the async status
|
||||||
|
// check sees the expired date.
|
||||||
let expiredDate = Calendar.current.date(byAdding: .day, value: -31, to: Date())!
|
let expiredDate = Calendar.current.date(byAdding: .day, value: -31, to: Date())!
|
||||||
GroupUserDefaults.groupDefaults.set(expiredDate, forKey: UserDefaultsStore.Keys.firstLaunchDate.rawValue)
|
GroupUserDefaults.groupDefaults.set(expiredDate, forKey: UserDefaultsStore.Keys.firstLaunchDate.rawValue)
|
||||||
GroupUserDefaults.groupDefaults.synchronize()
|
GroupUserDefaults.groupDefaults.synchronize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
IAPManager.shared.bypassSubscription = bypassSubscription
|
||||||
|
#endif
|
||||||
|
|
||||||
// Seed fixture data if requested
|
// Seed fixture data if requested
|
||||||
if let fixture = seedFixture {
|
if let fixture = seedFixture {
|
||||||
seedData(fixture: fixture)
|
seedData(fixture: fixture)
|
||||||
@@ -86,11 +88,10 @@ enum UITestMode {
|
|||||||
/// Reset all user defaults and persisted state for a clean test run
|
/// Reset all user defaults and persisted state for a clean test run
|
||||||
@MainActor
|
@MainActor
|
||||||
private static func resetAppState() {
|
private static func resetAppState() {
|
||||||
// Clear group user defaults
|
// Clear group user defaults using the correct suite name
|
||||||
let defaults = GroupUserDefaults.groupDefaults
|
let defaults = GroupUserDefaults.groupDefaults
|
||||||
if let bundleId = Bundle.main.bundleIdentifier {
|
defaults.removePersistentDomain(forName: Constants.currentGroupShareId)
|
||||||
defaults.removePersistentDomain(forName: bundleId)
|
|
||||||
}
|
|
||||||
// Reset key defaults explicitly (true = fresh install state where onboarding is needed)
|
// Reset key defaults explicitly (true = fresh install state where onboarding is needed)
|
||||||
defaults.set(true, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
|
defaults.set(true, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
|
||||||
defaults.set(0, forKey: UserDefaultsStore.Keys.votingLayoutStyle.rawValue) // horizontal
|
defaults.set(0, forKey: UserDefaultsStore.Keys.votingLayoutStyle.rawValue) // horizontal
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ struct CustomizeContentView: View {
|
|||||||
.padding(12)
|
.padding(12)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
|
.accessibilityIdentifier(AccessibilityID.Settings.browseThemesButton)
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $showThemePicker) {
|
.sheet(isPresented: $showThemePicker) {
|
||||||
AppThemePickerView()
|
AppThemePickerView()
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ struct EntryDetailView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
|
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
|||||||
@@ -31,22 +31,30 @@ final class AppLaunchTests: BaseUITestCase {
|
|||||||
|
|
||||||
// Month tab
|
// Month tab
|
||||||
tabBar.tapMonth()
|
tabBar.tapMonth()
|
||||||
XCTAssertTrue(tabBar.monthTab.isSelected, "Month tab should be selected")
|
assertTabSelected(tabBar.monthTab, name: "Month")
|
||||||
|
|
||||||
// Year tab
|
// Year tab
|
||||||
tabBar.tapYear()
|
tabBar.tapYear()
|
||||||
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
|
assertTabSelected(tabBar.yearTab, name: "Year")
|
||||||
|
|
||||||
// Insights tab
|
// Insights tab
|
||||||
tabBar.tapInsights()
|
tabBar.tapInsights()
|
||||||
XCTAssertTrue(tabBar.insightsTab.isSelected, "Insights tab should be selected")
|
assertTabSelected(tabBar.insightsTab, name: "Insights")
|
||||||
|
|
||||||
// Settings tab
|
// Settings tab
|
||||||
tabBar.tapSettings()
|
tabBar.tapSettings()
|
||||||
XCTAssertTrue(tabBar.settingsTab.isSelected, "Settings tab should be selected")
|
assertTabSelected(tabBar.settingsTab, name: "Settings")
|
||||||
|
|
||||||
// Back to Day
|
// Back to Day
|
||||||
tabBar.tapDay()
|
tabBar.tapDay()
|
||||||
XCTAssertTrue(tabBar.dayTab.isSelected, "Day tab should be selected")
|
assertTabSelected(tabBar.dayTab, name: "Day")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Wait for a tab to become selected (iOS 26 Liquid Glass may delay state updates).
|
||||||
|
private func assertTabSelected(_ tab: XCUIElement, name: String, timeout: TimeInterval = 3) {
|
||||||
|
let predicate = NSPredicate(format: "isSelected == true")
|
||||||
|
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: tab)
|
||||||
|
let result = XCTWaiter.wait(for: [expectation], timeout: timeout)
|
||||||
|
XCTAssertEqual(result, .completed, "\(name) tab should be selected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ final class AppThemeTests: BaseUITestCase {
|
|||||||
browseButton.waitForExistence(timeout: 5),
|
browseButton.waitForExistence(timeout: 5),
|
||||||
"Browse Themes button should exist"
|
"Browse Themes button should exist"
|
||||||
)
|
)
|
||||||
browseButton.tapWhenReady()
|
browseButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// Wait for the themes sheet to appear
|
// Wait for the themes sheet to appear
|
||||||
// Look for any theme card as an indicator that the sheet loaded
|
// Look for any theme card as an indicator that the sheet loaded
|
||||||
@@ -69,7 +69,9 @@ final class AppThemeTests: BaseUITestCase {
|
|||||||
settingsScreen.assertVisible()
|
settingsScreen.assertVisible()
|
||||||
|
|
||||||
// Open Browse Themes sheet
|
// Open Browse Themes sheet
|
||||||
settingsScreen.browseThemesButton.tapWhenReady()
|
let browseBtn = settingsScreen.browseThemesButton
|
||||||
|
_ = browseBtn.waitForExistence(timeout: 5)
|
||||||
|
browseBtn.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// Wait for sheet to load
|
// Wait for sheet to load
|
||||||
let firstCard = app.descendants(matching: .any)
|
let firstCard = app.descendants(matching: .any)
|
||||||
@@ -87,13 +89,13 @@ final class AppThemeTests: BaseUITestCase {
|
|||||||
app.swipeUp()
|
app.swipeUp()
|
||||||
}
|
}
|
||||||
if card.waitForExistence(timeout: 3) {
|
if card.waitForExistence(timeout: 3) {
|
||||||
card.tapWhenReady()
|
card.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// A preview sheet or confirmation may appear — dismiss it
|
// A preview sheet or confirmation may appear — dismiss it
|
||||||
// Look for an "Apply" or close button and tap if present
|
// Look for an "Apply" or close button and tap if present
|
||||||
let applyButton = app.buttons["Apply"]
|
let applyButton = app.buttons["Apply"]
|
||||||
if applyButton.waitForExistence(timeout: 2) {
|
if applyButton.waitForExistence(timeout: 2) {
|
||||||
applyButton.tapWhenReady()
|
applyButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +105,7 @@ final class AppThemeTests: BaseUITestCase {
|
|||||||
// Dismiss the themes sheet by swiping down or tapping Done
|
// Dismiss the themes sheet by swiping down or tapping Done
|
||||||
let doneButton = app.buttons["Done"]
|
let doneButton = app.buttons["Done"]
|
||||||
if doneButton.waitForExistence(timeout: 2) {
|
if doneButton.waitForExistence(timeout: 2) {
|
||||||
doneButton.tapWhenReady()
|
doneButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
} else {
|
} else {
|
||||||
// Swipe down to dismiss the sheet
|
// Swipe down to dismiss the sheet
|
||||||
app.swipeDown()
|
app.swipeDown()
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ final class CustomizationTests: BaseUITestCase {
|
|||||||
for themeName in themeNames {
|
for themeName in themeNames {
|
||||||
let button = app.buttons["customize_theme_\(themeName.lowercased())"]
|
let button = app.buttons["customize_theme_\(themeName.lowercased())"]
|
||||||
if button.waitForExistence(timeout: 3) {
|
if button.waitForExistence(timeout: 3) {
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
// Brief pause for theme to apply
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,12 +43,12 @@ final class CustomizationTests: BaseUITestCase {
|
|||||||
for layout in layouts {
|
for layout in layouts {
|
||||||
let button = app.buttons["customize_voting_\(layout.lowercased())"]
|
let button = app.buttons["customize_voting_\(layout.lowercased())"]
|
||||||
if button.waitForExistence(timeout: 2) {
|
if button.waitForExistence(timeout: 2) {
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
} else {
|
} else {
|
||||||
// Scroll right to find it
|
// Scroll right to find it
|
||||||
app.swipeLeft()
|
app.swipeLeft()
|
||||||
if button.waitForExistence(timeout: 2) {
|
if button.waitForExistence(timeout: 2) {
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,12 +76,12 @@ final class CustomizationTests: BaseUITestCase {
|
|||||||
for style in styles {
|
for style in styles {
|
||||||
let button = app.buttons["customize_daystyle_\(style.lowercased())"]
|
let button = app.buttons["customize_daystyle_\(style.lowercased())"]
|
||||||
if button.waitForExistence(timeout: 2) {
|
if button.waitForExistence(timeout: 2) {
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
} else {
|
} else {
|
||||||
// Scroll to find it
|
// Scroll to find it
|
||||||
app.swipeLeft()
|
app.swipeLeft()
|
||||||
if button.waitForExistence(timeout: 2) {
|
if button.waitForExistence(timeout: 2) {
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ final class HeaderMoodLoggingTests: BaseUITestCase {
|
|||||||
|
|
||||||
// 4. Verify an entry row appeared for today's date
|
// 4. Verify an entry row appeared for today's date
|
||||||
let formatter = DateFormatter()
|
let formatter = DateFormatter()
|
||||||
formatter.dateFormat = "M/d/yyyy"
|
formatter.dateFormat = "yyyy/MM/dd"
|
||||||
let todayString = formatter.string(from: Date())
|
let todayString = formatter.string(from: Date())
|
||||||
|
|
||||||
dayScreen.assertEntryExists(dateString: todayString)
|
dayScreen.assertEntryExists(dateString: todayString)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ final class IconPackTests: BaseUITestCase {
|
|||||||
app.swipeUp()
|
app.swipeUp()
|
||||||
}
|
}
|
||||||
if button.waitForExistence(timeout: 3) {
|
if button.waitForExistence(timeout: 3) {
|
||||||
button.tapWhenReady()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
} else {
|
} else {
|
||||||
XCTFail("Icon pack button '\(pack)' should exist in the customize view")
|
XCTFail("Icon pack button '\(pack)' should exist in the customize view")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,43 +24,43 @@ final class OnboardingTests: BaseUITestCase {
|
|||||||
|
|
||||||
captureScreenshot(name: "onboarding_welcome")
|
captureScreenshot(name: "onboarding_welcome")
|
||||||
|
|
||||||
// Swipe to Time screen
|
// Swipe through screens with waits to ensure page transitions complete
|
||||||
app.swipeLeft()
|
swipeAndWait() // Welcome → Time
|
||||||
|
|
||||||
captureScreenshot(name: "onboarding_time")
|
captureScreenshot(name: "onboarding_time")
|
||||||
|
|
||||||
// Swipe to Day screen
|
swipeAndWait() // Time → Day
|
||||||
app.swipeLeft()
|
|
||||||
|
|
||||||
// Select "Today" if the button exists
|
// Select "Today" if the button exists
|
||||||
let todayButton = app.descendants(matching: .any)
|
let todayButton = app.descendants(matching: .any)
|
||||||
.matching(identifier: "onboarding_day_today")
|
.matching(identifier: "onboarding_day_today")
|
||||||
.firstMatch
|
.firstMatch
|
||||||
if todayButton.waitForExistence(timeout: 3) {
|
if todayButton.waitForExistence(timeout: 3) {
|
||||||
todayButton.tap()
|
todayButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
captureScreenshot(name: "onboarding_day")
|
captureScreenshot(name: "onboarding_day")
|
||||||
|
|
||||||
// Swipe to Style screen
|
swipeAndWait() // Day → Style
|
||||||
app.swipeLeft()
|
|
||||||
|
|
||||||
captureScreenshot(name: "onboarding_style")
|
captureScreenshot(name: "onboarding_style")
|
||||||
|
|
||||||
// Swipe to Subscription screen
|
swipeAndWait() // Style → Subscription
|
||||||
app.swipeLeft()
|
|
||||||
|
|
||||||
captureScreenshot(name: "onboarding_subscription")
|
captureScreenshot(name: "onboarding_subscription")
|
||||||
|
|
||||||
// Tap "Maybe Later" to complete onboarding
|
// Tap "Maybe Later" to complete onboarding
|
||||||
let skipButton = app.descendants(matching: .any)
|
let skipButton = app.descendants(matching: .any)
|
||||||
.matching(identifier: "onboarding_skip_button")
|
.matching(identifier: "onboarding_skip_button")
|
||||||
.firstMatch
|
.firstMatch
|
||||||
|
|
||||||
|
// If skip button isn't visible, try one more swipe (in case a page was added)
|
||||||
|
if !skipButton.waitForExistence(timeout: 5) {
|
||||||
|
swipeAndWait()
|
||||||
|
}
|
||||||
|
|
||||||
XCTAssertTrue(
|
XCTAssertTrue(
|
||||||
skipButton.waitForExistence(timeout: 5),
|
skipButton.waitForExistence(timeout: 5),
|
||||||
"Skip/Maybe Later button should exist on subscription screen"
|
"Skip/Maybe Later button should exist on subscription screen"
|
||||||
)
|
)
|
||||||
skipButton.tap()
|
skipButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// After onboarding, the tab bar should appear
|
// After onboarding, the tab bar should appear
|
||||||
let tabBar = app.tabBars.firstMatch
|
let tabBar = app.tabBars.firstMatch
|
||||||
@@ -81,16 +81,19 @@ final class OnboardingTests: BaseUITestCase {
|
|||||||
|
|
||||||
if welcomeText.waitForExistence(timeout: 5) {
|
if welcomeText.waitForExistence(timeout: 5) {
|
||||||
// Swipe through all screens
|
// Swipe through all screens
|
||||||
app.swipeLeft() // -> Time
|
swipeAndWait() // → Time
|
||||||
app.swipeLeft() // -> Day
|
swipeAndWait() // → Day
|
||||||
app.swipeLeft() // -> Style
|
swipeAndWait() // → Style
|
||||||
app.swipeLeft() // -> Subscription
|
swipeAndWait() // → Subscription
|
||||||
|
|
||||||
let skipButton = app.descendants(matching: .any)
|
let skipButton = app.descendants(matching: .any)
|
||||||
.matching(identifier: "onboarding_skip_button")
|
.matching(identifier: "onboarding_skip_button")
|
||||||
.firstMatch
|
.firstMatch
|
||||||
|
if !skipButton.waitForExistence(timeout: 5) {
|
||||||
|
swipeAndWait()
|
||||||
|
}
|
||||||
if skipButton.waitForExistence(timeout: 5) {
|
if skipButton.waitForExistence(timeout: 5) {
|
||||||
skipButton.tap()
|
skipButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,4 +130,11 @@ final class OnboardingTests: BaseUITestCase {
|
|||||||
|
|
||||||
captureScreenshot(name: "no_onboarding_on_relaunch")
|
captureScreenshot(name: "no_onboarding_on_relaunch")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Swipe left with a brief wait for the page transition to settle.
|
||||||
|
private func swipeAndWait() {
|
||||||
|
app.swipeLeft()
|
||||||
|
// Allow the paged TabView animation to settle
|
||||||
|
_ = app.waitForExistence(timeout: 0.5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ final class PremiumCustomizationTests: BaseUITestCase {
|
|||||||
subscribeButton.waitForExistence(timeout: 5),
|
subscribeButton.waitForExistence(timeout: 5),
|
||||||
"Subscribe button should exist"
|
"Subscribe button should exist"
|
||||||
)
|
)
|
||||||
subscribeButton.tapWhenReady()
|
subscribeButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// Verify the subscription sheet appears — look for common subscription
|
// Verify the subscription sheet appears — look for common subscription
|
||||||
// sheet elements (subscription store view or paywall content).
|
// sheet elements (subscription store view or paywall content).
|
||||||
|
|||||||
@@ -32,25 +32,26 @@ struct CustomizeScreen {
|
|||||||
|
|
||||||
func selectTheme(_ name: String) {
|
func selectTheme(_ name: String) {
|
||||||
let button = themeButton(named: name)
|
let button = themeButton(named: name)
|
||||||
button.tapWhenReady()
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectVotingLayout(_ name: String) {
|
func selectVotingLayout(_ name: String) {
|
||||||
let button = votingLayoutButton(named: name)
|
let button = votingLayoutButton(named: name)
|
||||||
// May need to scroll horizontally to find it
|
if button.exists && !button.isHittable {
|
||||||
if !button.isHittable {
|
|
||||||
app.swipeLeft()
|
app.swipeLeft()
|
||||||
}
|
}
|
||||||
button.tapWhenReady()
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectDayViewStyle(_ name: String) {
|
func selectDayViewStyle(_ name: String) {
|
||||||
let button = dayViewStyleButton(named: name)
|
let button = dayViewStyleButton(named: name)
|
||||||
// May need to scroll horizontally to find it
|
if button.exists && !button.isHittable {
|
||||||
if !button.isHittable {
|
|
||||||
app.swipeLeft()
|
app.swipeLeft()
|
||||||
}
|
}
|
||||||
button.tapWhenReady()
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Assertions
|
// MARK: - Assertions
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ struct DayScreen {
|
|||||||
/// Tap a mood button by mood name. Waits for the celebration animation to complete.
|
/// Tap a mood button by mood name. Waits for the celebration animation to complete.
|
||||||
func logMood(_ mood: MoodChoice, file: StaticString = #file, line: UInt = #line) {
|
func logMood(_ mood: MoodChoice, file: StaticString = #file, line: UInt = #line) {
|
||||||
let button = moodButton(for: mood)
|
let button = moodButton(for: mood)
|
||||||
guard button.waitUntilHittable(timeout: 5) else {
|
guard button.waitForExistence(timeout: 5) else {
|
||||||
XCTFail("Mood button '\(mood.rawValue)' not hittable", file: file, line: line)
|
XCTFail("Mood button '\(mood.rawValue)' not found", file: file, line: line)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
button.tap()
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
|
|
||||||
// Wait for the celebration animation to finish and entry to appear.
|
// Wait for the celebration animation to finish and entry to appear.
|
||||||
// The mood header disappears after logging today's mood.
|
// The mood header disappears after logging today's mood.
|
||||||
|
|||||||
@@ -26,20 +26,26 @@ struct EntryDetailScreen {
|
|||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
|
|
||||||
func dismiss() {
|
func dismiss() {
|
||||||
doneButton.tapWhenReady()
|
let button = doneButton
|
||||||
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectMood(_ mood: MoodChoice) {
|
func selectMood(_ mood: MoodChoice) {
|
||||||
let button = moodButton(for: mood)
|
let button = moodButton(for: mood)
|
||||||
button.tapWhenReady()
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteEntry() {
|
func deleteEntry() {
|
||||||
deleteButton.tapWhenReady()
|
let button = deleteButton
|
||||||
|
_ = button.waitForExistence(timeout: 5)
|
||||||
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
// Confirm the delete alert
|
// Confirm the delete alert
|
||||||
let deleteAlert = app.alerts["Delete Entry"]
|
let deleteAlert = app.alerts["Delete Entry"]
|
||||||
let confirmButton = deleteAlert.buttons["Delete"]
|
let confirmButton = deleteAlert.buttons["Delete"]
|
||||||
confirmButton.tapWhenReady()
|
_ = confirmButton.waitForExistence(timeout: 5)
|
||||||
|
confirmButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Assertions
|
// MARK: - Assertions
|
||||||
|
|||||||
Reference in New Issue
Block a user