add monkey test

pull/196/head
James Sangalli 7 years ago
parent 30ccacb335
commit c99f54ff0c
  1. 1
      Podfile
  2. 5
      Podfile.lock
  3. 8
      Trust.xcodeproj/project.pbxproj
  4. 46
      TrustTests/Foundation/MonkeyTest.swift

@ -9,6 +9,7 @@ target 'AlphaWallet' do
pod 'R.swift' pod 'R.swift'
pod 'JSONRPCKit', :git=> 'https://github.com/bricklife/JSONRPCKit.git' pod 'JSONRPCKit', :git=> 'https://github.com/bricklife/JSONRPCKit.git'
pod 'APIKit' pod 'APIKit'
pod "SwiftMonkey", "~> 1.0"
pod 'Eureka', '~> 4.0.1' pod 'Eureka', '~> 4.0.1'
pod 'MBProgressHUD' pod 'MBProgressHUD'
pod 'StatefulViewController' pod 'StatefulViewController'

@ -42,6 +42,7 @@ PODS:
- SipHash (1.2.0) - SipHash (1.2.0)
- StatefulViewController (3.0) - StatefulViewController (3.0)
- SwiftLint (0.24.1) - SwiftLint (0.24.1)
- SwiftMonkey (1.1.0)
- SwiftyJSON (4.0.0) - SwiftyJSON (4.0.0)
- SwiftyXMLParser (4.1.0) - SwiftyXMLParser (4.1.0)
- TrezorCrypto (0.0.4) - TrezorCrypto (0.0.4)
@ -74,6 +75,7 @@ DEPENDENCIES:
- SeedStackViewController - SeedStackViewController
- StatefulViewController - StatefulViewController
- SwiftLint - SwiftLint
- SwiftMonkey (~> 1.0)
- SwiftyJSON - SwiftyJSON
- SwiftyXMLParser (from `https://github.com/yahoojapan/SwiftyXMLParser.git`) - SwiftyXMLParser (from `https://github.com/yahoojapan/SwiftyXMLParser.git`)
- TrustKeystore (from `https://github.com/alpha-wallet/trust-keystore-snapshot`, branch `master`) - TrustKeystore (from `https://github.com/alpha-wallet/trust-keystore-snapshot`, branch `master`)
@ -139,11 +141,12 @@ SPEC CHECKSUMS:
SipHash: c6e9e43e9c531b5bc6602545130c26194a6d31ce SipHash: c6e9e43e9c531b5bc6602545130c26194a6d31ce
StatefulViewController: 4803bf900d44de26074344998e10e041113b5931 StatefulViewController: 4803bf900d44de26074344998e10e041113b5931
SwiftLint: 2e4b89feed5909c42c3735bbd6745f4345c4b772 SwiftLint: 2e4b89feed5909c42c3735bbd6745f4345c4b772
SwiftMonkey: 7aafba2de889229abbf7397496aee699a0d97a6b
SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa
SwiftyXMLParser: b5a79fb8a730903703d0a92d30752a0b05158967 SwiftyXMLParser: b5a79fb8a730903703d0a92d30752a0b05158967
TrezorCrypto: 7f87a2296cf13872b21565c29fd9f7882dd00803 TrezorCrypto: 7f87a2296cf13872b21565c29fd9f7882dd00803
TrustKeystore: 381590c561f58fe0948abbd9cb626cbc08d75ff8 TrustKeystore: 381590c561f58fe0948abbd9cb626cbc08d75ff8
PODFILE CHECKSUM: caca540a69e277efe6ea84cc65721152f15ab2cd PODFILE CHECKSUM: 4ab0dc410947e8ecd387b0c90888872001f29c84
COCOAPODS: 1.3.1 COCOAPODS: 1.3.1

@ -403,6 +403,7 @@
76F1D13FC8A41AD967C59947 /* ClaimOrderCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DACA9404AD6740BEADBB /* ClaimOrderCoordinatorTests.swift */; }; 76F1D13FC8A41AD967C59947 /* ClaimOrderCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DACA9404AD6740BEADBB /* ClaimOrderCoordinatorTests.swift */; };
76F1D5AF727A83205BBCF0EC /* OrderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DADFD07E2941897FD2E1 /* OrderHandler.swift */; }; 76F1D5AF727A83205BBCF0EC /* OrderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DADFD07E2941897FD2E1 /* OrderHandler.swift */; };
76F1D76BF700FCC461B11CC0 /* ClaimStormBirdOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D1417613174D447DEE56 /* ClaimStormBirdOrder.swift */; }; 76F1D76BF700FCC461B11CC0 /* ClaimStormBirdOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D1417613174D447DEE56 /* ClaimStormBirdOrder.swift */; };
76F1D850F4F2E968CF8D9C86 /* MonkeyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B138ABCF208C2C93000FC28A /* MonkeyTest.swift */; };
76F1D91659771C9EEA7B48DC /* CreateRedeem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DF80932454E9F58B7830 /* CreateRedeem.swift */; }; 76F1D91659771C9EEA7B48DC /* CreateRedeem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1DF80932454E9F58B7830 /* CreateRedeem.swift */; };
76F1DB9E1443DCFC36228B08 /* ClaimOrderCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D419EE36261E50ABAFAE /* ClaimOrderCoordinator.swift */; }; 76F1DB9E1443DCFC36228B08 /* ClaimOrderCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D419EE36261E50ABAFAE /* ClaimOrderCoordinator.swift */; };
76F1DC92CDEB695115DBC47C /* UniversalLinkHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D96298E216CBFC3DD78B /* UniversalLinkHandlerTests.swift */; }; 76F1DC92CDEB695115DBC47C /* UniversalLinkHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76F1D96298E216CBFC3DD78B /* UniversalLinkHandlerTests.swift */; };
@ -453,6 +454,7 @@
AA893ED5203C3E5400CDCED1 /* TokenBalance.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA893ED4203C3E5400CDCED1 /* TokenBalance.swift */; }; AA893ED5203C3E5400CDCED1 /* TokenBalance.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA893ED4203C3E5400CDCED1 /* TokenBalance.swift */; };
AAEB8DA2204BC7B700CB0B2C /* RedeemTicketsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAEB8DA1204BC7B700CB0B2C /* RedeemTicketsViewController.swift */; }; AAEB8DA2204BC7B700CB0B2C /* RedeemTicketsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAEB8DA1204BC7B700CB0B2C /* RedeemTicketsViewController.swift */; };
AAEF2CAB2050A68A0038BE0D /* SignatureHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */; }; AAEF2CAB2050A68A0038BE0D /* SignatureHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */; };
B138ABD0208C2C93000FC28A /* MonkeyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B138ABCF208C2C93000FC28A /* MonkeyTest.swift */; };
B1DB1A95207DBF6D00CA2B77 /* XMLHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A94207DBF6D00CA2B77 /* XMLHandler.swift */; }; B1DB1A95207DBF6D00CA2B77 /* XMLHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A94207DBF6D00CA2B77 /* XMLHandler.swift */; };
B1DB1A97207DCECF00CA2B77 /* AssetDefinitionXML.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A96207DCECF00CA2B77 /* AssetDefinitionXML.swift */; }; B1DB1A97207DCECF00CA2B77 /* AssetDefinitionXML.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A96207DCECF00CA2B77 /* AssetDefinitionXML.swift */; };
B1DB1A99207DDF9600CA2B77 /* XMLHandlerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A98207DDF9600CA2B77 /* XMLHandlerTest.swift */; }; B1DB1A99207DDF9600CA2B77 /* XMLHandlerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DB1A98207DDF9600CA2B77 /* XMLHandlerTest.swift */; };
@ -973,6 +975,7 @@
AA893ED4203C3E5400CDCED1 /* TokenBalance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenBalance.swift; sourceTree = "<group>"; }; AA893ED4203C3E5400CDCED1 /* TokenBalance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenBalance.swift; sourceTree = "<group>"; };
AAEB8DA1204BC7B700CB0B2C /* RedeemTicketsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedeemTicketsViewController.swift; sourceTree = "<group>"; }; AAEB8DA1204BC7B700CB0B2C /* RedeemTicketsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedeemTicketsViewController.swift; sourceTree = "<group>"; };
AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignatureHelper.swift; sourceTree = "<group>"; }; AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignatureHelper.swift; sourceTree = "<group>"; };
B138ABCF208C2C93000FC28A /* MonkeyTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonkeyTest.swift; sourceTree = "<group>"; };
B13A87D3BA5167741E5D0801 /* Pods-Trust.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Trust.release.xcconfig"; path = "Pods/Target Support Files/Pods-Trust/Pods-Trust.release.xcconfig"; sourceTree = "<group>"; }; B13A87D3BA5167741E5D0801 /* Pods-Trust.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Trust.release.xcconfig"; path = "Pods/Target Support Files/Pods-Trust/Pods-Trust.release.xcconfig"; sourceTree = "<group>"; };
B1DB1A94207DBF6D00CA2B77 /* XMLHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XMLHandler.swift; sourceTree = "<group>"; }; B1DB1A94207DBF6D00CA2B77 /* XMLHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XMLHandler.swift; sourceTree = "<group>"; };
B1DB1A96207DCECF00CA2B77 /* AssetDefinitionXML.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetDefinitionXML.swift; sourceTree = "<group>"; }; B1DB1A96207DCECF00CA2B77 /* AssetDefinitionXML.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetDefinitionXML.swift; sourceTree = "<group>"; };
@ -1723,6 +1726,7 @@
73D2683A202E8411009777A1 /* DecimalNumberFormatterTest.swift */, 73D2683A202E8411009777A1 /* DecimalNumberFormatterTest.swift */,
73ED85A82034C42D00593BF3 /* StringFormatterTest.swift */, 73ED85A82034C42D00593BF3 /* StringFormatterTest.swift */,
B1DB1A98207DDF9600CA2B77 /* XMLHandlerTest.swift */, B1DB1A98207DDF9600CA2B77 /* XMLHandlerTest.swift */,
B138ABCF208C2C93000FC28A /* MonkeyTest.swift */,
); );
path = Foundation; path = Foundation;
sourceTree = "<group>"; sourceTree = "<group>";
@ -3134,6 +3138,7 @@
"${BUILT_PRODUCTS_DIR}/SeedStackViewController/StackViewController.framework", "${BUILT_PRODUCTS_DIR}/SeedStackViewController/StackViewController.framework",
"${BUILT_PRODUCTS_DIR}/SipHash/SipHash.framework", "${BUILT_PRODUCTS_DIR}/SipHash/SipHash.framework",
"${BUILT_PRODUCTS_DIR}/StatefulViewController/StatefulViewController.framework", "${BUILT_PRODUCTS_DIR}/StatefulViewController/StatefulViewController.framework",
"${BUILT_PRODUCTS_DIR}/SwiftMonkey/SwiftMonkey.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework",
"${BUILT_PRODUCTS_DIR}/SwiftyXMLParser/SwiftyXMLParser.framework", "${BUILT_PRODUCTS_DIR}/SwiftyXMLParser/SwiftyXMLParser.framework",
"${BUILT_PRODUCTS_DIR}/TrezorCrypto/TrezorCrypto.framework", "${BUILT_PRODUCTS_DIR}/TrezorCrypto/TrezorCrypto.framework",
@ -3164,6 +3169,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/StackViewController.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/StackViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SipHash.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SipHash.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/StatefulViewController.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/StatefulViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftMonkey.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyXMLParser.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyXMLParser.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TrezorCrypto.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TrezorCrypto.framework",
@ -3649,6 +3655,7 @@
442FC8E82231273273B95D85 /* FakeClaimOrderCoordinator.swift in Sources */, 442FC8E82231273273B95D85 /* FakeClaimOrderCoordinator.swift in Sources */,
442FCBA4A5E39A4C4B16426A /* EventsRestTest.swift in Sources */, 442FCBA4A5E39A4C4B16426A /* EventsRestTest.swift in Sources */,
76F1DC92CDEB695115DBC47C /* UniversalLinkHandlerTests.swift in Sources */, 76F1DC92CDEB695115DBC47C /* UniversalLinkHandlerTests.swift in Sources */,
76F1D850F4F2E968CF8D9C86 /* MonkeyTest.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -3657,6 +3664,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
2912CD1B1F6A830700C6CBE3 /* TrustUITests.swift in Sources */, 2912CD1B1F6A830700C6CBE3 /* TrustUITests.swift in Sources */,
B138ABD0208C2C93000FC28A /* MonkeyTest.swift in Sources */,
29358D9F1F78D5B700925D61 /* Screenshots.swift in Sources */, 29358D9F1F78D5B700925D61 /* Screenshots.swift in Sources */,
29358D991F78D1E400925D61 /* SnapshotHelper.swift in Sources */, 29358D991F78D1E400925D61 /* SnapshotHelper.swift in Sources */,
); );

@ -0,0 +1,46 @@
//
// File.swift
// AlphaWalletUITests
//
// Created by James Sangalli on 22/4/18.
//
import Foundation
import SwiftMonkey
class MonkeyTests {
func testMonkey() {
let application = XCUIApplication()
// Workaround for bug in Xcode 7.3. Snapshots are not properly updated
// when you initially call app.frame, resulting in a zero-sized rect.
// Doing a random query seems to update everything properly.
// TODO: Remove this when the Xcode bug is fixed!
_ = application.descendants(matching: .any).element(boundBy: 0).frame
// Initialise the monkey tester with the current device
// frame. Giving an explicit seed will make it generate
// the same sequence of events on each run, and leaving it
// out will generate a new sequence on each run.
let monkey = Monkey(frame: application.frame)
//let monkey = Monkey(seed: 123, frame: application.frame)
// Add actions for the monkey to perform. We just use a
// default set of actions for this, which is usually enough.
// Use either one of these, but maybe not both.
// XCTest private actions seem to work better at the moment.
// UIAutomation actions seem to work only on the simulator.
monkey.addDefaultXCTestPrivateActions()
//monkey.addDefaultUIAutomationActions()
// Occasionally, use the regular XCTest functionality
// to check if an alert is shown, and click a random
// button on it.
monkey.addXCTestTapAlertAction(interval: 100, application: application)
// Run the monkey test indefinitely.
monkey.monkeyAround()
}
}
Loading…
Cancel
Save