forked from shadowfacts/Tusker
More UI tests for onboarding/my profile
This commit is contained in:
parent
8ac3deb55a
commit
acd01a81cc
|
@ -2147,7 +2147,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
@ -2203,7 +2203,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
|
|
@ -27,15 +27,6 @@
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "D6D4DDCB212518A000E1C4BB"
|
|
||||||
BuildableName = "Tusker.app"
|
|
||||||
BlueprintName = "Tusker"
|
|
||||||
ReferencedContainer = "container:Tusker.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
|
|
@ -18,6 +18,7 @@ class LocalData: ObservableObject {
|
||||||
private init() {
|
private init() {
|
||||||
if ProcessInfo.processInfo.environment.keys.contains("UI_TESTING") {
|
if ProcessInfo.processInfo.environment.keys.contains("UI_TESTING") {
|
||||||
defaults = UserDefaults(suiteName: "\(Bundle.main.bundleIdentifier!).uitesting")!
|
defaults = UserDefaults(suiteName: "\(Bundle.main.bundleIdentifier!).uitesting")!
|
||||||
|
defaults.removePersistentDomain(forName: "\(Bundle.main.bundleIdentifier!).uitesting")
|
||||||
if ProcessInfo.processInfo.environment.keys.contains("UI_TESTING_LOGIN") {
|
if ProcessInfo.processInfo.environment.keys.contains("UI_TESTING_LOGIN") {
|
||||||
accounts = [
|
accounts = [
|
||||||
UserAccountInfo(
|
UserAccountInfo(
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17147" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17120"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17124"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRJ-Xf-kc9" customClass="VisualEffectImageButton" customModule="Tusker" customModuleProvider="target">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRJ-Xf-kc9" customClass="VisualEffectImageButton" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="374" y="154" width="32" height="32"/>
|
<rect key="frame" x="374" y="154" width="32" height="32"/>
|
||||||
<viewLayoutGuide key="safeArea" id="kQa-ou-pQz"/>
|
<viewLayoutGuide key="safeArea" id="kQa-ou-pQz"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
<accessibility key="accessibilityConfiguration" label="More Actions">
|
||||||
<accessibilityTraits key="traits" button="YES"/>
|
<accessibilityTraits key="traits" button="YES"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -54,9 +54,8 @@ extension Router {
|
||||||
]
|
]
|
||||||
self["/api/v1/accounts/verify_credentials"] = JSONResponse(result: selfAccount)
|
self["/api/v1/accounts/verify_credentials"] = JSONResponse(result: selfAccount)
|
||||||
self["/api/v1/accounts/\\d+/statuses"] = JSONResponse(result: [])
|
self["/api/v1/accounts/\\d+/statuses"] = JSONResponse(result: [])
|
||||||
self["/api/v1/accounts/(\\d+)"] = DelegatingResponse { (env) in
|
self["/api/v1/accounts/(\\d+)"] = DelegatingResponse { (ctx) in
|
||||||
let captures = env["ambassador.router_captures"] as! [String]
|
if ctx.captures[0] == "1" {
|
||||||
if captures[0] == "1" {
|
|
||||||
return JSONResponse(result: selfAccount)
|
return JSONResponse(result: selfAccount)
|
||||||
} else {
|
} else {
|
||||||
return JSONResponse(statusCode: 404, statusMessage: "Not Found", result: notFound)
|
return JSONResponse(statusCode: 404, statusMessage: "Not Found", result: notFound)
|
||||||
|
|
|
@ -10,9 +10,20 @@ import Foundation
|
||||||
import Ambassador
|
import Ambassador
|
||||||
|
|
||||||
struct DelegatingResponse: WebApp {
|
struct DelegatingResponse: WebApp {
|
||||||
let handler: (_ environ: [String: Any]) -> WebApp
|
let handler: (_ ctx: Context) -> WebApp
|
||||||
|
|
||||||
func app(_ environ: [String : Any], startResponse: @escaping ((String, [(String, String)]) -> Void), sendBody: @escaping ((Data) -> Void)) {
|
func app(_ environ: [String : Any], startResponse: @escaping ((String, [(String, String)]) -> Void), sendBody: @escaping ((Data) -> Void)) {
|
||||||
handler(environ).app(environ, startResponse: startResponse, sendBody: sendBody)
|
let ctx = Context(environ: environ)
|
||||||
|
handler(ctx).app(environ, startResponse: startResponse, sendBody: sendBody)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension DelegatingResponse {
|
||||||
|
struct Context {
|
||||||
|
let environ: [String: Any]
|
||||||
|
|
||||||
|
var captures: [String] {
|
||||||
|
environ["ambassador.router_captures"] as? [String] ?? []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,56 @@ class MyProfileTests: TuskerUITests {
|
||||||
app.launchEnvironment["UI_TESTING_LOGIN"] = "true"
|
app.launchEnvironment["UI_TESTING_LOGIN"] = "true"
|
||||||
app.launch()
|
app.launch()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testExample() {
|
func testProfileHeader() {
|
||||||
sleep(10000000)
|
app.tabBars.buttons["My Profile"].tap()
|
||||||
|
|
||||||
|
XCTAssertTrue(app.staticTexts["Admin Account"].exists)
|
||||||
|
XCTAssertTrue(app.staticTexts["@admin"].exists)
|
||||||
|
XCTAssertTrue(app.staticTexts["My profile description."].exists)
|
||||||
|
|
||||||
|
let segmented = app.segmentedControls.firstMatch
|
||||||
|
XCTAssertTrue(segmented.exists)
|
||||||
|
XCTAssertEqual(segmented.buttons.count, 3)
|
||||||
|
XCTAssertTrue(segmented.buttons["Posts"].exists)
|
||||||
|
XCTAssertTrue(segmented.buttons["Posts and Replies"].exists)
|
||||||
|
XCTAssertTrue(segmented.buttons["Media"].exists)
|
||||||
|
|
||||||
|
XCTAssertTrue(app.buttons["More Actions"].exists)
|
||||||
|
|
||||||
|
app.buttons["More Actions"].tap()
|
||||||
|
if #available(iOS 14.0, *) {
|
||||||
|
XCTAssertTrue(app.buttons["Open in Safari"].exists)
|
||||||
|
XCTAssertTrue(app.buttons["Share..."].exists)
|
||||||
|
XCTAssertTrue(app.buttons["Send Message"].exists)
|
||||||
|
|
||||||
|
app.buttons["Open in Safari"].tap()
|
||||||
|
XCTAssertTrue(app.otherElements["TopBrowserBar"].exists)
|
||||||
|
app.buttons["Done"].tap()
|
||||||
|
XCTAssertFalse(app.otherElements["TopBrowserBar"].exists)
|
||||||
|
|
||||||
|
app.buttons["More Actions"].tap()
|
||||||
|
app.buttons["Share..."].tap()
|
||||||
|
let activityListView = app.otherElements["ActivityListView"]
|
||||||
|
XCTAssertTrue(activityListView.waitForExistence(timeout: 0.2))
|
||||||
|
activityListView.buttons["Close"].tap()
|
||||||
|
XCTAssertFalse(activityListView.exists)
|
||||||
|
|
||||||
|
app.buttons["More Actions"].tap()
|
||||||
|
app.buttons["Send Message"].tap()
|
||||||
|
XCTAssertTrue(app.staticTexts["Compose"].exists)
|
||||||
|
XCTAssertTrue(app.buttons["Cancel"].exists)
|
||||||
|
XCTAssertTrue(app.buttons["Post"].exists)
|
||||||
|
app.buttons["Cancel"].tap()
|
||||||
|
} else {
|
||||||
|
// first tap doesn't trigger share sheet for some reason
|
||||||
|
app.buttons["More Actions"].tap()
|
||||||
|
let activityListView = app.otherElements["ActivityListView"]
|
||||||
|
XCTAssertTrue(activityListView.waitForExistence(timeout: 0.2))
|
||||||
|
activityListView.buttons["Close"].tap()
|
||||||
|
XCTAssertFalse(activityListView.exists)
|
||||||
|
// can't test individual actions :/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,22 @@ class OnboardingTests: TuskerUITests {
|
||||||
|
|
||||||
// can't test logging in because there's no way of interacting with the safari VC that's used in the OAuth flow
|
// can't test logging in because there's no way of interacting with the safari VC that's used in the OAuth flow
|
||||||
|
|
||||||
|
func testSearchSuggestedInstances() {
|
||||||
|
XCTAssertTrue(app.cells.firstMatch.waitForExistence(timeout: 2))
|
||||||
|
let firstInstanceLabel = app.cells.staticTexts.firstMatch.label
|
||||||
|
let secondInstanceLabel = app.cells.element(boundBy: 1).staticTexts.firstMatch.label
|
||||||
|
let searchField = app.searchFields.element
|
||||||
|
searchField.tap()
|
||||||
|
searchField.typeText(firstInstanceLabel)
|
||||||
|
XCTAssertTrue(app.staticTexts[firstInstanceLabel].exists)
|
||||||
|
XCTAssertFalse(app.staticTexts[secondInstanceLabel].exists)
|
||||||
|
}
|
||||||
|
|
||||||
func testCustomInstanceAppears() {
|
func testCustomInstanceAppears() {
|
||||||
let searchField = app.searchFields.element
|
let searchField = app.searchFields.element
|
||||||
searchField.tap()
|
searchField.tap()
|
||||||
searchField.typeText("http://localhost:8080")
|
searchField.typeText("http://localhost:8080")
|
||||||
XCTAssertTrue(app.staticTexts["localhost"].exists)
|
XCTAssertTrue(app.staticTexts["localhost"].waitForExistence(timeout: 2))
|
||||||
XCTAssertTrue(app.staticTexts["An instance description"].exists)
|
XCTAssertTrue(app.staticTexts["An instance description"].exists)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue