Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OktaAuthFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OktaAuthFoundation"
s.module_name = "AuthFoundation"
s.version = "2.1.2"
s.version = "2.1.4"
s.summary = "Okta Authentication Foundation"
s.description = <<-DESC
Provides the foundation and common features used to authenticate users, managing the lifecycle and storage of tokens and credentials, and provide a base for other Okta SDKs to build upon.
Expand Down
2 changes: 1 addition & 1 deletion OktaBrowserSignin.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OktaBrowserSignin"
s.module_name = "BrowserSignin"
s.version = "2.1.2"
s.version = "2.1.4"
s.summary = "Okta Browser Sign In UI"
s.description = <<-DESC
Authenticate users using web-based OIDC.
Expand Down
2 changes: 1 addition & 1 deletion OktaClient.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OktaClient"
s.version = "2.1.2"
s.version = "2.1.4"
s.summary = "Secure client authentication, request authorization, and user management capabilities for Swift."
s.description = <<-DESC
Provides a modularized set of libraries that provide the building blocks and convenience features used to authenticate users, manage the lifecycle and storage of tokens and user credentials, and provide a base for other libraries and applications to build upon.
Expand Down
2 changes: 1 addition & 1 deletion OktaDirectAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OktaDirectAuth"
s.version = "2.1.2"
s.version = "2.1.4"
s.summary = "Okta Direct Authentication"
s.description = <<-DESC
Enables application developers to build native sign in experiences using the Okta Direct Authentication API.
Expand Down
2 changes: 1 addition & 1 deletion OktaIdxAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'OktaIdxAuth'
s.version = '2.1.2'
s.version = '2.1.4'
s.summary = 'SDK to easily integrate the Okta Identity Engine'
s.description = <<-DESC
Integrate your native app with Okta using the Okta Identity Engine library.
Expand Down
2 changes: 1 addition & 1 deletion OktaOAuth2.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "OktaOAuth2"
s.module_name = "OAuth2Auth"
s.version = "2.1.2"
s.version = "2.1.4"
s.summary = "Okta OAuth2 Authentication"
s.description = <<-DESC
Enables application developers to authenticate users utilizing a variety of OAuth2 authentication flows.
Expand Down
2 changes: 2 additions & 0 deletions Samples/Shared/Common/Testing/Screen+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extension WebLogin where Self: Screen {
}

field.typeText(username)
dismissKeyboard()
}

tapKeyboardNextOrGo()
Expand Down Expand Up @@ -149,6 +150,7 @@ extension WebLogin where Self: Screen {
}

field.typeText(password)
dismissKeyboard()

tapKeyboardNextOrGo()

Expand Down
58 changes: 44 additions & 14 deletions Samples/Shared/Common/Testing/Screen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,56 @@ extension Screen {
return false
}

#if !os(tvOS)
private func _dismissSafariKeyboardIfPresent() -> Bool {
let safariViewServiceApp = XCUIApplication(bundleIdentifier: "com.apple.SafariViewService")
guard safariViewServiceApp.state == .runningForeground else {
return false
}

for name in ["selected", "Done"] {
let button = safariViewServiceApp.buttons[name].firstMatch
if button.isHittable {
button.tap()
return true
}
}

return false
}

private func _dismissAppKeyboardIfPresent() -> Bool {
guard app.keyboards.element(boundBy: 0).exists else {
return false
}

if UIDevice.current.userInterfaceIdiom == .pad {
app.keyboards.buttons["Hide keyboard"].tap()
return true
} else {
app.toolbars.buttons["Done"].tap()
return true
}
}

private func _dismissKeyboardUsingToolbarButton() -> Bool {
let doneButton = app.toolbars.matching(identifier: "Toolbar").buttons["Done"]
if doneButton.exists {
doneButton.tap()
return true
}
return false
}
#endif

@discardableResult
func dismissKeyboard() -> Bool {
#if os(tvOS)
// TODO: Update this in the future to select the appropriately named button.
XCUIRemote.shared.press(.select)
return false
#else
let doneButton = app.toolbars.matching(identifier: "Toolbar").buttons["Done"]
if app.keyboards.element(boundBy: 0).exists {
if UIDevice.current.userInterfaceIdiom == .pad {
app.keyboards.buttons["Hide keyboard"].tap()
return true
} else {
app.toolbars.buttons["Done"].tap()
return true
}
} else if doneButton.exists {
doneButton.tap()
return true
}
return _dismissSafariKeyboardIfPresent() || _dismissKeyboardUsingToolbarButton() || _dismissAppKeyboardIfPresent()
#endif
return false
}
}
17 changes: 17 additions & 0 deletions Samples/WebSignIn/WebSignIn (iOS)/UITests/BrowserSignInTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ class BrowserSignInUITests: XCTestCase {
}

func testEphemeralSignInAndSignOut() throws {
signInScreen.isVisible()
signInScreen.setEphemeral(true)
signInScreen.setUsesAsyncAwait(true)
signInScreen.login(username: username, password: password)

profileScreen.wait()
save(screenshot: "Profile Screen")

XCTAssertEqual(profileScreen.valueLabel(for: .username).label, username)
XCTAssertEqual(profileScreen.valueLabel(for: .defaultCredential).label, "Yes")

profileScreen.signOut(.endSession)

signInScreen.isVisible()
}

func testEphemeralSignInAndSignOutWithAsyncAwait() throws {
signInScreen.isVisible()
signInScreen.setEphemeral(true)
signInScreen.login(username: username, password: password)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ class SignInScreen: Screen, WebLogin {
let testCase: XCTestCase

lazy var ephemeralSwitch = app.switches["ephemeral_switch"]
lazy var asyncAwaitSwitch = app.switches["async_switch"]
lazy var signInButton = app.buttons["sign_in_button"]
lazy var clientIdLabel = app.buttons["client_id_label"]

init(_ testCase: XCTestCase) {
self.testCase = testCase
}


var usesAsyncAwait: Bool {
asyncAwaitSwitch.isOn ?? false
}

func setUsesAsyncAwait(_ enabled: Bool) {
if asyncAwaitSwitch.isOn != enabled {
asyncAwaitSwitch.tap()
}
}

func isVisible(timeout: TimeInterval = 3) {
XCTAssertTrue(app.staticTexts["Okta Web Sign In"].waitForExistence(timeout: timeout))
XCTAssertFalse(app.staticTexts["Not configured"].exists)
Expand Down
Loading
Loading