Mercurial > public > simoleon
changeset 144:4271fb5f69e2
Add Scheme for automating App Preview
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Tue, 17 Aug 2021 22:15:48 +0100 |
parents | 407611b9df91 |
children | 738fbd3ca671 |
files | Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/xcshareddata/xcschemes/AppPreview.xcscheme Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme Simoleon.xcodeproj/xcshareddata/xcschemes/Simoleon.xcscheme SimoleonAppPreview/Info.plist SimoleonAppPreview/SimoleonAppPreview.swift SimoleonScreenshots/SimoleonScreenshots.swift SimoleonUITests/SimoleonUITests.swift |
diffstat | 8 files changed, 454 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/Simoleon.xcodeproj/project.pbxproj Tue Aug 17 08:42:00 2021 +0100 +++ b/Simoleon.xcodeproj/project.pbxproj Tue Aug 17 22:15:48 2021 +0100 @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 950093CA26CBC7A200FEBF67 /* SimoleonAppPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950093C926CBC7A200FEBF67 /* SimoleonAppPreview.swift */; }; 950A377726A820F800CAB175 /* DefaultCurrency+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950A377626A820F400CAB175 /* DefaultCurrency+CoreDataProperties.swift */; }; 950A377826A820F800CAB175 /* DefaultCurrency+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950A377526A820F400CAB175 /* DefaultCurrency+CoreDataClass.swift */; }; 9522BEA926B5A4D20076B098 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9522BEA826B5A4D20076B098 /* AppDelegate.swift */; }; @@ -59,6 +60,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 950093CC26CBC7A200FEBF67 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 95C5B21C2697752600941585 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 95C5B2232697752600941585; + remoteInfo = Simoleon; + }; 959F6DED26BBD53500101E53 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 95C5B21C2697752600941585 /* Project object */; @@ -96,6 +104,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 950093C726CBC7A200FEBF67 /* SimoleonAppPreview.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimoleonAppPreview.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 950093C926CBC7A200FEBF67 /* SimoleonAppPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimoleonAppPreview.swift; sourceTree = "<group>"; }; + 950093CB26CBC7A200FEBF67 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 950A377526A820F400CAB175 /* DefaultCurrency+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DefaultCurrency+CoreDataClass.swift"; sourceTree = "<group>"; }; 950A377626A820F400CAB175 /* DefaultCurrency+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DefaultCurrency+CoreDataProperties.swift"; sourceTree = "<group>"; }; 9522BEA826B5A4D20076B098 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; @@ -183,6 +194,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 950093C426CBC7A200FEBF67 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 959F6DE526BBD53500101E53 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -217,6 +235,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 950093C826CBC7A200FEBF67 /* SimoleonAppPreview */ = { + isa = PBXGroup; + children = ( + 950093C926CBC7A200FEBF67 /* SimoleonAppPreview.swift */, + 950093CB26CBC7A200FEBF67 /* Info.plist */, + ); + path = SimoleonAppPreview; + sourceTree = "<group>"; + }; 95559331269B094A000FD726 /* Models */ = { isa = PBXGroup; children = ( @@ -311,6 +338,7 @@ 95C5B23D2697752700941585 /* SimoleonTests */, 95C5B2482697752700941585 /* SimoleonUITests */, 959F6DE926BBD53500101E53 /* SimoleonScreenshots */, + 950093C826CBC7A200FEBF67 /* SimoleonAppPreview */, 95C5B2252697752600941585 /* Products */, 95E76438269E0037008E9F31 /* Frameworks */, ); @@ -323,6 +351,7 @@ 95C5B23A2697752700941585 /* SimoleonTests.xctest */, 95C5B2452697752700941585 /* SimoleonUITests.xctest */, 959F6DE826BBD53500101E53 /* SimoleonScreenshots.xctest */, + 950093C726CBC7A200FEBF67 /* SimoleonAppPreview.xctest */, ); name = Products; sourceTree = "<group>"; @@ -413,6 +442,24 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 950093C626CBC7A200FEBF67 /* SimoleonAppPreview */ = { + isa = PBXNativeTarget; + buildConfigurationList = 950093D126CBC7A200FEBF67 /* Build configuration list for PBXNativeTarget "SimoleonAppPreview" */; + buildPhases = ( + 950093C326CBC7A200FEBF67 /* Sources */, + 950093C426CBC7A200FEBF67 /* Frameworks */, + 950093C526CBC7A200FEBF67 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 950093CD26CBC7A200FEBF67 /* PBXTargetDependency */, + ); + name = SimoleonAppPreview; + productName = SimoleonAppPreview; + productReference = 950093C726CBC7A200FEBF67 /* SimoleonAppPreview.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 959F6DE726BBD53500101E53 /* SimoleonScreenshots */ = { isa = PBXNativeTarget; buildConfigurationList = 959F6DF126BBD53500101E53 /* Build configuration list for PBXNativeTarget "SimoleonScreenshots" */; @@ -499,6 +546,10 @@ LastSwiftUpdateCheck = 1250; LastUpgradeCheck = 1250; TargetAttributes = { + 950093C626CBC7A200FEBF67 = { + CreatedOnToolsVersion = 12.5.1; + TestTargetID = 95C5B2232697752600941585; + }; 959F6DE726BBD53500101E53 = { CreatedOnToolsVersion = 12.5.1; TestTargetID = 95C5B2232697752600941585; @@ -544,11 +595,19 @@ 95C5B2392697752700941585 /* SimoleonTests */, 95C5B2442697752700941585 /* SimoleonUITests */, 959F6DE726BBD53500101E53 /* SimoleonScreenshots */, + 950093C626CBC7A200FEBF67 /* SimoleonAppPreview */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 950093C526CBC7A200FEBF67 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 959F6DE626BBD53500101E53 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -589,6 +648,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 950093C326CBC7A200FEBF67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 950093CA26CBC7A200FEBF67 /* SimoleonAppPreview.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 959F6DE426BBD53500101E53 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -657,6 +724,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 950093CD26CBC7A200FEBF67 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 95C5B2232697752600941585 /* Simoleon */; + targetProxy = 950093CC26CBC7A200FEBF67 /* PBXContainerItemProxy */; + }; 959F6DEE26BBD53500101E53 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 95C5B2232697752600941585 /* Simoleon */; @@ -727,6 +799,66 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 950093CE26CBC7A200FEBF67 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = MTX83R5H8X; + INFOPLIST_FILE = SimoleonAppPreview/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.SimoleonAppPreview; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Simoleon; + }; + name = Debug; + }; + 950093CF26CBC7A200FEBF67 /* Screenshots */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = MTX83R5H8X; + INFOPLIST_FILE = SimoleonAppPreview/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.SimoleonAppPreview; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Simoleon; + }; + name = Screenshots; + }; + 950093D026CBC7A200FEBF67 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = MTX83R5H8X; + INFOPLIST_FILE = SimoleonAppPreview/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.SimoleonAppPreview; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Simoleon; + }; + name = Release; + }; 959F6DEF26BBD53500101E53 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1181,6 +1313,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 950093D126CBC7A200FEBF67 /* Build configuration list for PBXNativeTarget "SimoleonAppPreview" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 950093CE26CBC7A200FEBF67 /* Debug */, + 950093CF26CBC7A200FEBF67 /* Screenshots */, + 950093D026CBC7A200FEBF67 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 959F6DF126BBD53500101E53 /* Build configuration list for PBXNativeTarget "SimoleonScreenshots" */ = { isa = XCConfigurationList; buildConfigurations = (
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon.xcodeproj/xcshareddata/xcschemes/AppPreview.xcscheme Tue Aug 17 22:15:48 2021 +0100 @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1250" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2232697752600941585" + BuildableName = "Simoleon.app" + BlueprintName = "Simoleon" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "NO" + buildForRunning = "NO" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2442697752700941585" + BuildableName = "SimoleonUITests.xctest" + BlueprintName = "SimoleonUITests" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "NO" + buildForRunning = "NO" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2392697752700941585" + BuildableName = "SimoleonTests.xctest" + BlueprintName = "SimoleonTests" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "NO" + buildForRunning = "NO" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "959F6DE726BBD53500101E53" + BuildableName = "SimoleonScreenshots.xctest" + BlueprintName = "SimoleonScreenshots" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Screenshots" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "NO"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2232697752600941585" + BuildableName = "Simoleon.app" + BlueprintName = "Simoleon" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "950093C626CBC7A200FEBF67" + BuildableName = "SimoleonAppPreview.xctest" + BlueprintName = "SimoleonAppPreview" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + </TestAction> + <LaunchAction + buildConfiguration = "Screenshots" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + disableMainThreadChecker = "YES" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2232697752600941585" + BuildableName = "Simoleon.app" + BlueprintName = "Simoleon" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "95C5B2232697752600941585" + BuildableName = "Simoleon.app" + BlueprintName = "Simoleon" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme>
--- a/Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme Tue Aug 17 08:42:00 2021 +0100 +++ b/Simoleon.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme Tue Aug 17 22:15:48 2021 +0100 @@ -81,6 +81,16 @@ ReferencedContainer = "container:Simoleon.xcodeproj"> </BuildableReference> </TestableReference> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "950093C626CBC7A200FEBF67" + BuildableName = "SimoleonAppPreview.xctest" + BlueprintName = "SimoleonAppPreview" + ReferencedContainer = "container:Simoleon.xcodeproj"> + </BuildableReference> + </TestableReference> </Testables> </TestAction> <LaunchAction
--- a/Simoleon.xcodeproj/xcshareddata/xcschemes/Simoleon.xcscheme Tue Aug 17 08:42:00 2021 +0100 +++ b/Simoleon.xcodeproj/xcshareddata/xcschemes/Simoleon.xcscheme Tue Aug 17 22:15:48 2021 +0100 @@ -103,7 +103,8 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES"> + allowLocationSimulation = "YES" + showNonLocalizedStrings = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> <BuildableReference
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SimoleonAppPreview/Info.plist Tue Aug 17 22:15:48 2021 +0100 @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SimoleonAppPreview/SimoleonAppPreview.swift Tue Aug 17 22:15:48 2021 +0100 @@ -0,0 +1,112 @@ +// +// SimoleonAppPreview.swift +// SimoleonAppPreview +// +// Created by Dennis Concepción Martín on 17/8/21. +// + +import XCTest + +class SimoleonAppPreview: XCTestCase { + + override func setUpWithError() throws { + // This method is called before the invocation of each test method in the class. + if UIDevice.current.userInterfaceIdiom == .pad { + XCUIDevice.shared.orientation = .landscapeLeft + } + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + } + + override func tearDownWithError() throws { + // This method is called after the invocation of each test method in the class. + } + + func recordInteraction(of app: XCUIApplication) { + app.launch() + + // Write amount in textfield + app.textFields["ConversionTextField"].tap() + app.keys["4"].tap() + app.keys["5"].tap() + app.keys["0"].tap() + app.keys["0"].tap() + app.keys["0"].tap() + + // Tap done to dismiss keyboard + app.navigationBars.buttons.element(boundBy: 0).tap() + + // Open currency selector and select USD/BTC + app.scrollViews.buttons["OpenCurrencySelector"].tap() + let currencySearchBar = app.textFields["CurrencySearchBar"] + currencySearchBar.tap() + currencySearchBar.typeText("Usd/btc\n") + sleep(1) + app.tables.buttons.firstMatch.tap() + sleep(2) + } + + func testUSEnglish() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(en-US)"] + app.launchArguments += ["-AppleLocale", "\"en-US\""] + recordInteraction(of: app) + } + + func testSpanish() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(es-ES)"] + app.launchArguments += ["-AppleLocale", "\"es-ES\""] + recordInteraction(of: app) + } + + func testGBEnglish() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(en-GB)"] + app.launchArguments += ["-AppleLocale", "\"en-GB\""] + recordInteraction(of: app) + } + + func testGerman() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(de-DE)"] + app.launchArguments += ["-AppleLocale", "\"de-DE\""] + recordInteraction(of: app) + } + + func testFrench() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(fr-FR)"] + app.launchArguments += ["-AppleLocale", "\"fr-FR\""] + recordInteraction(of: app) + } + + func testPortuguese() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(pt-PT)"] + app.launchArguments += ["-AppleLocale", "\"pt-PT\""] + recordInteraction(of: app) + } + + func testDutch() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(nl-NL)"] + app.launchArguments += ["-AppleLocale", "\"nl-NL\""] + recordInteraction(of: app) + } + + func testItalian() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(it-IT)"] + app.launchArguments += ["-AppleLocale", "\"it-IT\""] + recordInteraction(of: app) + } + + func testRussian() throws { + let app = XCUIApplication() + app.launchArguments += ["-AppleLanguages", "(ru-RU)"] + app.launchArguments += ["-AppleLocale", "\"ru-RU\""] + recordInteraction(of: app) + } +}
--- a/SimoleonScreenshots/SimoleonScreenshots.swift Tue Aug 17 08:42:00 2021 +0100 +++ b/SimoleonScreenshots/SimoleonScreenshots.swift Tue Aug 17 22:15:48 2021 +0100 @@ -18,10 +18,6 @@ XCUIDevice.shared.orientation = .landscapeLeft screenshotEndingName = "-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 @@ -32,8 +28,12 @@ } func testLaunchScreenshot() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() + app.tables["Sidebar"].buttons["NavigateToConversion"].tap() } sleep(2) @@ -41,30 +41,42 @@ } func testConvertAmountScreenshot() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() + app.tables["Sidebar"].buttons["NavigateToConversion"].tap() } - let conversionTextField = XCUIApplication().textFields["ConversionTextField"] + let conversionTextField = app.textFields["ConversionTextField"] conversionTextField.tap() conversionTextField.typeText("1030.15\n") snapshot("2Conversion\(screenshotEndingName)") } func testCurrencySelectorScreenshot() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() + app.tables["Sidebar"].buttons["NavigateToConversion"].tap() } - XCUIApplication().scrollViews.buttons["OpenCurrencySelector"].tap() + app.scrollViews.buttons["OpenCurrencySelector"].tap() snapshot("3CurrencySelector\(screenshotEndingName)") } func testFavoriteScreenshot() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables["Sidebar"].buttons["NavigateToFavorites"].tap() + app.tables["Sidebar"].buttons["NavigateToFavorites"].tap() } else { - XCUIApplication().tabBars.buttons.element(boundBy: 1).tap() + app.tabBars.buttons.element(boundBy: 1).tap() } sleep(1)
--- a/SimoleonUITests/SimoleonUITests.swift Tue Aug 17 08:42:00 2021 +0100 +++ b/SimoleonUITests/SimoleonUITests.swift Tue Aug 17 22:15:48 2021 +0100 @@ -14,9 +14,6 @@ if UIDevice.current.userInterfaceIdiom == .pad { XCUIDevice.shared.orientation = .landscapeLeft } - - let app = XCUIApplication() - app.launch() // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false @@ -30,6 +27,8 @@ func testTabBar() throws { let app = XCUIApplication() + app.launch() + if UIDevice.current.userInterfaceIdiom == .pad { app.tables["Sidebar"].buttons["NavigateToConversion"].tap() XCTAssertTrue(app.staticTexts["Convert"].exists) @@ -54,6 +53,7 @@ func testCurrencySelector() throws { let app = XCUIApplication() + app.launch() app.scrollViews.buttons["OpenCurrencySelector"].tap() let currencySearchBar = app.textFields["CurrencySearchBar"] @@ -64,7 +64,7 @@ func testCoreData() throws { let app = XCUIApplication() - app.scrollViews.buttons["AddToFavorites"].tap() + app.launch() if UIDevice.current.userInterfaceIdiom == .pad { app.tables["Sidebar"].buttons["NavigateToFavorites"].tap()