Closed defagos closed 1 year ago
An example in which the content is played:
@MainActor
func testMethod2() async {
let item = PlayerItem(url: URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8")!)
let player = Player(item: item)
player.play()
try? await Task.sleep(for: .seconds(5))
}
and an example in which content playback never starts:
@MainActor
func testMethod1() async {
let item = PlayerItem(url: URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8")!)
let player = Player(item: item)
player.play()
expect(player.playbackState).toEventually(equal(.paused))
}
Difference is the use of toEventually
which does not behave properly in async test methods apparently.
There is already an issue raised.
Nimble 11.1.0 is available.
On tvOS executing testMoveFromInvalidIndex
leads to the following Nimble warning logged to the console:
[Nimble Warning]: If you're getting stuck on a debugger breakpoint for a fatal error while using throwAssertion(), please disable 'Debug Executable' in your scheme. Go to 'Edit Scheme > Test > Info' and uncheck 'Debug Executable'. If you've already done that, suppress this warning by setting `NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true`. This is required because the standard methods of catching assertions (mach APIs) are unavailable for tvOS. Instead, the same mechanism the debugger uses is the fallback method for tvOS.
Disabling Debug Executable is not so practical for everyday use. But maybe there is a better approach.
Note that running tests with make test-tvos
works fine so this is really a development QoL issue. Maybe using test plans could help but I am not sure they are intended to customize test behavior per platform.
I doubt we can disable Nimble warning since the value we set is saved in thread local storage, but we cannot do it on background threads we don't spawn ourselves and which Nimble will check this setting on.
As a developer I need an easy way to test async / await code as well.
Acceptance criteria
async
.Tasks
testMoveFromInvalidIndex
on tvOS (only an annoyance within Xcode).swiftlint:disable:[previous|next] <rule>
to limit scope of swiftlint exceptions.