Skip to content

Commit

Permalink
test: increase timeout durations
Browse files Browse the repository at this point in the history
  • Loading branch information
scenee committed Jul 2, 2024
1 parent 3c9f556 commit 3b4c1bd
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Tests/ControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ControllerTests: XCTestCase {
}

func test_moveTo() {
let timeout = 3.0
let delegate = FloatingPanelTestDelegate()
let fpc = FloatingPanelController(delegate: delegate)
XCTAssertEqual(delegate.position, .hidden)
Expand Down Expand Up @@ -102,7 +103,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .full)
XCTAssertEqual(delegate.position, .full)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

XCTContext.runActivity(named: "move to half(animated)") { act in
Expand All @@ -113,7 +114,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .half)
XCTAssertEqual(delegate.position, .half)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

XCTContext.runActivity(named: "move to tip(animated)") { act in
Expand All @@ -124,7 +125,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .tip)
XCTAssertEqual(delegate.position, .tip)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

fpc.move(to: .hidden, animated: true)
Expand All @@ -137,6 +138,7 @@ class ControllerTests: XCTestCase {
class MyFloatingPanelTop2BottomLayout: FloatingPanelTop2BottomTestLayout {
override var initialState: FloatingPanelState { return .half }
}
let timeout = 3.0
let delegate = FloatingPanelTestDelegate()
let fpc = FloatingPanelController(delegate: delegate)
fpc.layout = MyFloatingPanelTop2BottomLayout()
Expand Down Expand Up @@ -175,7 +177,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .full)
XCTAssertEqual(delegate.position, .full)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

XCTContext.runActivity(named: "move to half(animated)") { act in
Expand All @@ -186,7 +188,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .half)
XCTAssertEqual(delegate.position, .half)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

XCTContext.runActivity(named: "move to tip(animated)") { act in
Expand All @@ -197,7 +199,7 @@ class ControllerTests: XCTestCase {
}
XCTAssertEqual(fpc.state, .tip)
XCTAssertEqual(delegate.position, .tip)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)
}

fpc.move(to: .hidden, animated: true)
Expand All @@ -223,6 +225,7 @@ class ControllerTests: XCTestCase {
}

func test_moveTo_didMoveDelegate() {
let timeout = 3.0
let delegate = FloatingPanelTestDelegate()
let fpc = FloatingPanelController(delegate: delegate)
XCTAssertEqual(delegate.position, .hidden)
Expand All @@ -237,7 +240,7 @@ class ControllerTests: XCTestCase {
exp.fulfill()
}
fpc.move(to: .full, animated: false)
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)

XCTAssertEqual(count, 1)
}
Expand All @@ -253,7 +256,7 @@ class ControllerTests: XCTestCase {
fpc.move(to: .half, animated: true) {
exp.fulfill()
}
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)

XCTAssertGreaterThan(count, 1)
}
Expand All @@ -270,7 +273,7 @@ class ControllerTests: XCTestCase {
exp.fulfill()
}
}
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)

XCTAssertEqual(count, 1)
}
Expand All @@ -288,7 +291,7 @@ class ControllerTests: XCTestCase {
exp.fulfill()
}
}
wait(for: [exp], timeout: 1.0)
wait(for: [exp], timeout: timeout)

XCTAssertGreaterThan(count, 1)
}
Expand Down

0 comments on commit 3b4c1bd

Please sign in to comment.