Created
June 7, 2017 08:52
-
-
Save fuxx/d6344911075f8dd3f2be97988b06526a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SafariAppLinkTests.swift | |
// C24Core | |
// | |
// Created by Stefan Mayer-Popp on 23.05.16. | |
// Copyright © 2016 CocoaPods. All rights reserved. | |
// | |
import XCTest | |
class SafariAppLinkTests: SafariTestsBaseClass { | |
let testUsername = "xxx@test.de" | |
let testPassword = "xxx" | |
/// The CHECK24 AppLink test URL | |
var appTestURLString: String { | |
return "http://xxx.check24.de/xxx.html" | |
} | |
var safariAppLinkTestPageLink: XCUIElement { | |
return safariApp.staticTexts["AppLink Test Page"] | |
} | |
/** | |
Login user with test user data in default core login form | |
*/ | |
func loginUser() { | |
sleep(1) | |
// Use email to login | |
app.buttons["loginEmailButton"].tap() | |
//Get login scroll view | |
let loginScrollView = app.scrollViews.containingType(.TextField, identifier: "loginUserName") | |
//Get user name text field | |
let userTextField = loginScrollView.textFields["loginUserName"] | |
//Get user name text field delete button | |
let userDeleteButton = userTextField.childrenMatchingType(.Button).element | |
//Select user name text field delete current user name and insert test user name | |
userTextField.tap() | |
if userDeleteButton.exists && userDeleteButton.hittable { | |
userDeleteButton.tap() | |
} | |
userTextField.typeText(testUsername) | |
//Select password text field and insert test user password | |
let passwordTextField = loginScrollView.otherElements.secureTextFields["loginPassword"] | |
passwordTextField.tap() | |
passwordTextField.typeText(testPassword) | |
//Login user | |
app.buttons["loginButton"].tap() | |
sleep(2) | |
} | |
// MARK: - Tests | |
func testSafariCanOpenCustomAppLink() { | |
/* | |
* MARK: Test case - Open CHECK24 app and an instance of Safari. | |
* It opens an custom AppLink from the app AppLink page and should jump back | |
* into the CHECK24 app. Their we open the debug menu to ensure | |
* that we have control about the app context too. | |
* | |
*/ | |
// Launch CHECK24 app | |
launchApp() | |
// Safari.open | |
openCustomAppLink(forURLString: appLinkTestURLString) | |
// Check that the app has be opened by openening the debug menu | |
openDebugMenu() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment