Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the default retry timeout. #102

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions Sources/Element.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public struct Element {
/// Clicks this element.
public func click(retryTimeout: TimeInterval? = nil) throws {
let request = Requests.ElementClick(session: session.id, element: id)
let result = try poll(timeout: retryTimeout ?? session.defaultRetryTimeout) {
let result = try poll(timeout: retryTimeout ?? session.defaultRetryTimeout ?? 0) {
do {
// Immediately bubble most failures, only retry on element not interactable.
try webDriver.send(request)
Expand All @@ -64,7 +64,7 @@ public struct Element {
/// Clicks this element via touch.
public func touchClick(kind: TouchClickKind = .single, retryTimeout: TimeInterval? = nil) throws {
let request = Requests.SessionTouchClick(session: session.id, kind: kind, element: id)
let result = try poll(timeout: retryTimeout ?? session.defaultRetryTimeout) {
let result = try poll(timeout: retryTimeout ?? session.defaultRetryTimeout ?? 0) {
do {
// Immediately bubble most failures, only retry on element not interactable.
try webDriver.send(request)
Expand Down
6 changes: 3 additions & 3 deletions Sources/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class Session {
}

/// A TimeInterval specifying max time to spend retrying operations.
public var defaultRetryTimeout: TimeInterval = 1.0 {
willSet { precondition(newValue >= 0) }
public var defaultRetryTimeout: TimeInterval? = 0 {
willSet { precondition((newValue ?? 0) >= 0) }
}

/// The title of this session such as the tab or window text.
Expand Down Expand Up @@ -143,7 +143,7 @@ public class Session {

let request = Requests.SessionElement(session: id, element: element?.id, using: using, value: value)

let elementId = try poll(timeout: retryTimeout ?? defaultRetryTimeout) {
let elementId = try poll(timeout: retryTimeout ?? defaultRetryTimeout ?? 0) {
let elementId: String?
do {
// Allow errors to bubble up unless they are specifically saying that the element was not found.
Expand Down