changeset 106:599fe95307f6

Fixes minor bugs
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Wed, 04 Aug 2021 21:33:52 +0100
parents 5c7b675ede8f
children 3600d1f4a37d
files Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme Simoleon/Conversion.swift Simoleon/Helpers/ConversionBox.swift Simoleon/Helpers/CurrencySelector.swift Simoleon/Helpers/FavoriteButton.swift Simoleon/Helpers/Sidebar.swift Simoleon/Info.plist Simoleon/Localization/en.xcloc/Source Contents/Simoleon/de.lproj/Localizable.strings Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings Simoleon/Localization/en.xcloc/Source Contents/Simoleon/fr.lproj/Localizable.strings Simoleon/Localization/en.xcloc/Source Contents/Simoleon/it.lproj/Localizable.strings Simoleon/Localization/en.xcloc/Source Contents/Simoleon/nl.lproj/Localizable.strings SimoleonTests/Info.plist SimoleonUITests/Info.plist SimoleonUITests/SimoleonUITests.swift
diffstat 17 files changed, 87 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/Simoleon.xcodeproj/project.pbxproj	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon.xcodeproj/project.pbxproj	Wed Aug 04 21:33:52 2021 +0100
@@ -804,7 +804,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\"";
 				DEVELOPMENT_TEAM = MTX83R5H8X;
 				ENABLE_PREVIEWS = YES;
@@ -829,7 +829,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\"";
 				DEVELOPMENT_TEAM = MTX83R5H8X;
 				ENABLE_PREVIEWS = YES;
Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme	Wed Aug 04 21:33:52 2021 +0100
@@ -40,7 +40,8 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      disableMainThreadChecker = "YES">
       <Testables>
          <TestableReference
             skipped = "NO">
@@ -68,6 +69,7 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      disableMainThreadChecker = "YES"
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"
--- a/Simoleon/Conversion.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Conversion.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -33,7 +33,6 @@
                                     .padding(.horizontal)
                             )
                     }
-                    .accessibilityIdentifier("CurrencySelector")
                     
                     FavoriteButton(currencyPair: currencyPair)
                 }
--- a/Simoleon/Helpers/ConversionBox.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Helpers/ConversionBox.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -41,7 +41,6 @@
                 .font(Font.title.weight(.semibold))
                 .lineLimit(1)
                 .padding(.bottom, 10)
-                .accessibilityIdentifier("ConversionTextfield")
             }
             
             Divider()
--- a/Simoleon/Helpers/CurrencySelector.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Helpers/CurrencySelector.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -40,27 +40,27 @@
             VStack {
                 SearchBar(placeholder: "Search...", text: $searchCurrency)
                     .padding()
-                    .accessibilityIdentifier("SearchBar")
                 
-                if entitlementIsActive {
-                    List(searchResults, id: \.self) { currencyPair in
-                        Button(action: {
-                            self.currencyPair = currencyPair.name
-                            showingCurrencySelector = false
-                        }) {
-                            CurrencyRow(currencyPairName: currencyPair.name)
+                List {
+                    if entitlementIsActive {
+                        ForEach(searchResults, id: \.self) { currencyPair in
+                            Button(action: {
+                                self.currencyPair = currencyPair.name
+                                showingCurrencySelector = false
+                            }) {
+                                CurrencyRow(currencyPairName: currencyPair.name)
+                            }
+                            .accessibility(identifier: "CurrencyRow")
                         }
-                        .accessibilityIdentifier("CurrencyRow")
-                    }
-                    .listStyle()
-                } else {
-                    List(searchResults, id: \.self) { currencyPair in
-                        Button(action: { select(currencyPair) }) {
-                            CurrencyRow(currencyPairName: currencyPair.name, isLocked: currencyPair.isLocked)
+                    } else {
+                        ForEach(searchResults, id: \.self) { currencyPair in
+                            Button(action: { select(currencyPair) }) {
+                                CurrencyRow(currencyPairName: currencyPair.name, isLocked: currencyPair.isLocked)
+                            }
                         }
                     }
-                    .listStyle()
                 }
+                .id(UUID())
             }
             .navigationTitle("Currencies")
             .navigationBarTitleDisplayMode(.inline)
@@ -130,3 +130,24 @@
         )
     }
 }
+
+
+
+//if entitlementIsActive {
+//                    List(searchResults, id: \.self) { currencyPair in
+//                        Button(action: {
+//                            self.currencyPair = currencyPair.name
+//                            showingCurrencySelector = false
+//                        }) {
+//                            CurrencyRow(currencyPairName: currencyPair.name)
+//                        }
+//                    }
+//                    .listStyle()
+//                } else {
+//                    List(searchResults, id: \.self) { currencyPair in
+//                        Button(action: { select(currencyPair) }) {
+//                            CurrencyRow(currencyPairName: currencyPair.name, isLocked: currencyPair.isLocked)
+//                        }
+//                    }
+//                    .listStyle()
+//                }
--- a/Simoleon/Helpers/FavoriteButton.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Helpers/FavoriteButton.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -27,7 +27,6 @@
                         .foregroundColor(Color(.systemYellow))
                 )
         }
-        .accessibilityIdentifier("FavoriteButton")
     }
     
     /*
--- a/Simoleon/Helpers/Sidebar.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Helpers/Sidebar.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -20,7 +20,6 @@
             NavigationLink(destination: Favorites()) {
                 Label("Favorites", systemImage: "star")
             }
-            .accessibility(identifier: "Favorites")
             
             NavigationLink(destination: Settings()) {
                 Label("Settings", systemImage: "gear")
--- a/Simoleon/Info.plist	Wed Aug 04 21:33:34 2021 +0100
+++ b/Simoleon/Info.plist	Wed Aug 04 21:33:52 2021 +0100
@@ -23,7 +23,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>$(MARKETING_VERSION)</string>
 	<key>CFBundleVersion</key>
-	<string>$(CURRENT_PROJECT_VERSION)</string>
+	<string>6</string>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<key>PURCHASES_KEY</key>
Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/de.lproj/Localizable.strings has changed
Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings has changed
Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/fr.lproj/Localizable.strings has changed
Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/it.lproj/Localizable.strings has changed
Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/nl.lproj/Localizable.strings has changed
--- a/SimoleonTests/Info.plist	Wed Aug 04 21:33:34 2021 +0100
+++ b/SimoleonTests/Info.plist	Wed Aug 04 21:33:52 2021 +0100
@@ -17,6 +17,6 @@
 	<key>CFBundleShortVersionString</key>
 	<string>1.0</string>
 	<key>CFBundleVersion</key>
-	<string>2</string>
+	<string>6</string>
 </dict>
 </plist>
--- a/SimoleonUITests/Info.plist	Wed Aug 04 21:33:34 2021 +0100
+++ b/SimoleonUITests/Info.plist	Wed Aug 04 21:33:52 2021 +0100
@@ -17,6 +17,6 @@
 	<key>CFBundleShortVersionString</key>
 	<string>1.0</string>
 	<key>CFBundleVersion</key>
-	<string>2</string>
+	<string>6</string>
 </dict>
 </plist>
--- a/SimoleonUITests/SimoleonUITests.swift	Wed Aug 04 21:33:34 2021 +0100
+++ b/SimoleonUITests/SimoleonUITests.swift	Wed Aug 04 21:33:52 2021 +0100
@@ -8,9 +8,18 @@
 import XCTest
 
 class SimoleonUITests: XCTestCase {
+    var screnshotEndingName = ""
 
     override func setUpWithError() throws {
         // Put setup code here. This method is called before the invocation of each test method in the class.
+        if UIDevice.current.userInterfaceIdiom == .pad {
+            XCUIDevice.shared.orientation = .landscapeLeft
+            screnshotEndingName = "-force_landscapeleft"
+        }
+        
+        let app = XCUIApplication()
+        setupSnapshot(app)
+        app.launch()
 
         // In UI tests it is usually best to stop immediately when a failure occurs.
         continueAfterFailure = false
@@ -23,66 +32,51 @@
     }
     
     // MARK: - Automate screenshots
-    func testLaunchScreenshots() {
-        let app = XCUIApplication()
-        setupSnapshot(app)
-        app.launch()
-        snapshot("0-Launch")
-
-        // Remove 100 from conversion textfield and type custom amount
-        let conversionTextfield = app.textFields["ConversionTextfield"]
+    func testLaunch() {
+        if UIDevice.current.userInterfaceIdiom == .pad {
+            XCUIApplication().tables.buttons.firstMatch.tap()
+        }
+        
+        snapshot("1Launch\(screnshotEndingName)")
+    }
+    
+    func testCurrencySelector() {
+        if UIDevice.current.userInterfaceIdiom == .pad {
+            XCUIApplication().tables.buttons.firstMatch.tap()
+        }
+        
+        XCUIApplication().scrollViews.buttons.firstMatch.tap()
+        snapshot("2CurrencySelector\(screnshotEndingName)")
+        
+        XCUIApplication().tables.buttons.element(boundBy: 6).tap()
+        let conversionTextfield = XCUIApplication().textFields.firstMatch
         conversionTextfield.tap()
         for _ in (0..<4) {
             conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue)
         }
-        conversionTextfield.typeText("1470.10")
-        snapshot("1-Convert")
-
-        // Remove custom amount and type again 1000
-        for _ in (0..<7) {
-            conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue)
-        }
-        conversionTextfield.typeText("1000\n")
-    }
-    
-    func testCurrencySelectorScreenshots() throws {
-        let app = XCUIApplication()
-        setupSnapshot(app)
-        app.launch()
-
-        // Open currency selector, search BTC, and select first row
-        app.buttons["CurrencySelector"].tap()
-        snapshot("2-CurrencySelector")
-
-        let searchBar = app.textFields["SearchBar"]
-        searchBar.tap()
-        searchBar.typeText("BTC")
-        app.buttons["CurrencyRow"].firstMatch.tap()
-        snapshot("3-Bitcoin")
+        
+        conversionTextfield.typeText("\n")
+        
+        snapshot("3Amount\(screnshotEndingName)")
     }
     
     func testFavorites() throws {
-        let app = XCUIApplication()
-        setupSnapshot(app)
-        app.launch()
-        
         // Go to favorites
         if UIDevice.current.userInterfaceIdiom == .pad {
-            app.navigationBars.buttons.element(boundBy: 0).tap()
-            app.buttons["Favorites"].tap()
+            XCUIApplication().tables.buttons.element(boundBy: 1).tap()
         } else {
-            app.tabBars.buttons.element(boundBy: 1).tap()
+            XCUIApplication().tabBars.buttons.element(boundBy: 1).tap()
         }
 
-        snapshot("4-Favorites")
+        snapshot("4Favorites\(screnshotEndingName)")
     }
 
-    func testLaunchPerformance() throws {
-        if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
-            // This measures how long it takes to launch your application.
-            measure(metrics: [XCTApplicationLaunchMetric()]) {
-                XCUIApplication().launch()
-            }
-        }
-    }
+//    func testLaunchPerformance() throws {
+//        if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
+//            // This measures how long it takes to launch your application.
+//            measure(metrics: [XCTApplicationLaunchMetric()]) {
+//                XCUIApplication().launch()
+//            }
+//        }
+//    }
 }