Skip to content

Commit

Permalink
Merge branch 'feature/stability_improvements' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Jul 5, 2024
2 parents 275525e + 038ceb8 commit dbb2e44
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ fastlane/test_output
iOSInjectionProject/
uitests.sh
TestResults
Kukai MobileUITests/Configs
4 changes: 4 additions & 0 deletions Kukai Mobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
C09860BB27C3E20400F888AF /* EnterAddressComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09860BA27C3E20400F888AF /* EnterAddressComponent.swift */; };
C09860C127C3F7CB00F888AF /* EnterAddressComponent.xib in Resources */ = {isa = PBXBuildFile; fileRef = C09860C027C3F7CB00F888AF /* EnterAddressComponent.xib */; };
C09B3EDE2A9F8688006ACC6A /* Test_01_Prechecks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09B3EDD2A9F8688006ACC6A /* Test_01_Prechecks.swift */; };
C09C26972C32EB3100B894FE /* Configs in Resources */ = {isa = PBXBuildFile; fileRef = C09C26962C32EB3100B894FE /* Configs */; };
C09CEB4029C2125D00D95D69 /* ActivityToolbarCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C09CEB3F29C2125D00D95D69 /* ActivityToolbarCell.swift */; };
C0A19B4828857301000291A0 /* String+extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0A19B4728857301000291A0 /* String+extensions.swift */; };
C0A1C3B626B05F7100EA03A9 /* PreLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0A1C3B526B05F7100EA03A9 /* PreLoginViewController.swift */; };
Expand Down Expand Up @@ -693,6 +694,7 @@
C09860BA27C3E20400F888AF /* EnterAddressComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterAddressComponent.swift; sourceTree = "<group>"; };
C09860C027C3F7CB00F888AF /* EnterAddressComponent.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EnterAddressComponent.xib; sourceTree = "<group>"; };
C09B3EDD2A9F8688006ACC6A /* Test_01_Prechecks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Test_01_Prechecks.swift; sourceTree = "<group>"; };
C09C26962C32EB3100B894FE /* Configs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Configs; sourceTree = "<group>"; };
C09CEB3F29C2125D00D95D69 /* ActivityToolbarCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityToolbarCell.swift; sourceTree = "<group>"; };
C0A19B4728857301000291A0 /* String+extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+extensions.swift"; sourceTree = "<group>"; };
C0A1C3B526B05F7100EA03A9 /* PreLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreLoginViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1434,6 +1436,7 @@
C0B03663269EE2070071ACD0 /* Kukai MobileUITests */ = {
isa = PBXGroup;
children = (
C09C26962C32EB3100B894FE /* Configs */,
C0B03666269EE2070071ACD0 /* Info.plist */,
C02DF5F32A66E23100A1497D /* SharedHelpers.swift */,
C06C08C82A7D31E400625375 /* EnvironmentVariables.swift */,
Expand Down Expand Up @@ -1860,6 +1863,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C09C26972C32EB3100B894FE /* Configs in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/torusresearch/fetch-node-details-swift",
"state" : {
"revision" : "22bfadf7491d77a0bc1953af002cadbd61383e7d",
"version" : "6.0.2"
"revision" : "4bd96c33ba8d02d9e27190c5c7cedf09cfdfd656",
"version" : "6.0.3"
}
},
{
Expand Down
19 changes: 16 additions & 3 deletions Kukai MobileUITests/EnvironmentVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,22 @@ public struct EnvironmentVariables {
private var extractedConfigs: [Int: TestConfig] = [:]

private init() {
config1 = ProcessInfo.processInfo.environment["CONFIG_1"] ?? ""
config2 = ProcessInfo.processInfo.environment["CONFIG_2"] ?? ""
config3 = ProcessInfo.processInfo.environment["CONFIG_3"] ?? ""
let testBundle = Bundle(for: SharedHelpers.self)
let config1URL = testBundle.url(forResource: "CONFIG_1", withExtension: "txt", subdirectory: "Configs")
let config2URL = testBundle.url(forResource: "CONFIG_2", withExtension: "txt", subdirectory: "Configs")
let config3URL = testBundle.url(forResource: "CONFIG_3", withExtension: "txt", subdirectory: "Configs")

// In order to more easily support running locally, and running remotely, check first if files (that will NOT be committed to git) exist. If not, fall back to env variables
if ProcessInfo.processInfo.environment["CONFIG_1"] == nil, let config1Path = config1URL, let config2Path = config2URL, let config3Path = config3URL {
config1 = (try? String(contentsOf: config1Path)) ?? ""
config2 = (try? String(contentsOf: config2Path)) ?? ""
config3 = (try? String(contentsOf: config3Path)) ?? ""

} else {
config1 = ProcessInfo.processInfo.environment["CONFIG_1"] ?? ""
config2 = ProcessInfo.processInfo.environment["CONFIG_2"] ?? ""
config3 = ProcessInfo.processInfo.environment["CONFIG_3"] ?? ""
}

extractedConfigs = [
1: convertStringToConfig(config1),
Expand Down
10 changes: 9 additions & 1 deletion Kukai MobileUITests/SharedHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,22 @@ class SharedHelpers: XCTestCase {


// When starting a new set of tests, clear all the data on the device so no lingering data from a previous failed test is present
if (resetForEveryInvocation == false && launchCount == 0) || resetForEveryInvocation {
// When launching manually via Xcode UI, we don't want to reset everytime we test a new file. Only run this check when running as part of CI, which uses env varibales
if !areWeRunningManually() && ((resetForEveryInvocation == false && launchCount == 0) || resetForEveryInvocation) {
sharedApplication.launchEnvironment["XCUITEST-RESET"] = "true"
launchCount += 1
}

return sharedApplication
}

func areWeRunningManually() -> Bool {
let testBundle = Bundle(for: SharedHelpers.self)
let config1URL = testBundle.url(forResource: "CONFIG_1", withExtension: "txt", subdirectory: "Configs")

return (ProcessInfo.processInfo.environment["CONFIG_1"] == nil && config1URL != nil)
}



// MARK: - Check exists
Expand Down
57 changes: 57 additions & 0 deletions Kukai MobileUITests/Tests/Test_04_Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class Test_04_Account: XCTestCase {

public func testWatchWalletTokenDetails() {
let app = XCUIApplication()

Test_03_Home.handleLoginIfNeeded(app: app)
Test_05_WalletManagement.handleSwitchingTo(app: app, address: Test_05_WalletManagement.mainnetWatchWalletAddress.truncateTezosAddress())
sleep(2)
Expand Down Expand Up @@ -82,6 +83,62 @@ final class Test_04_Account: XCTestCase {
SharedHelpers.shared.navigationBack(app: app)
}



// Switch to collectibles and check Teia and HEN open the correct collection page
Test_03_Home.handleOpenCollectiblesTab(app: app)
sleep(2)

let henTitle = "Hic et Nunc (HEN)"
let henCell = app.collectionViews.staticTexts["Hic et Nunc (HEN)"]
let teiaTitle = "Teia"
let teiaCell = app.collectionViews.staticTexts["Teia"]
for _ in 0..<10 {
if teiaCell.exists {
break
} else {
app.swipeUp()
}
}

henCell.tap()
sleep(2)

XCTAssert(app.staticTexts[henTitle].exists)
SharedHelpers.shared.navigationBack(app: app)
sleep(2)

teiaCell.tap()
sleep(2)

XCTAssert(app.staticTexts[teiaTitle].exists)
SharedHelpers.shared.navigationBack(app: app)
sleep(2)



// Check block mainnet block explorer link opens public tzkt
Test_03_Home.handleOpenActivityTab(app: app)
sleep(2)

app.buttons["View in Explorer"].tap()
sleep(5)
let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")

XCTAssert(safari.webViews.firstMatch.links["TzKT"].exists)
XCTAssert(safari.webViews.firstMatch.buttons["ACCOUNT"].exists)
XCTAssert(safari.webViews.firstMatch.buttons["OPERATIONS"].exists)
app.activate()

sleep(2)
Test_03_Home.handleLoginIfNeeded(app: app)



// Switch back
Test_03_Home.handleOpenAccountTab(app: app)
sleep(2)

Test_03_Home.handleOpenSideMenu(app: app)
sleep(2)
Test_09_SideMenu.handleSwitchingNetwork(app: app, mainnet: false)
Expand Down

0 comments on commit dbb2e44

Please sign in to comment.