fix(uitests): replace illegal key path with a closure in quickDiagnostics
'.map(\.label)' failed to build: XCUIElement.label is @MainActor-isolated,
and a bare key path literal must be formable from any isolation context,
which a main-actor-isolated property can't satisfy. This was a hard
compiler error (not just a concurrency warning), and it cascaded into a
flood of secondary diagnostics across the whole file/batch compile unit,
obscuring the actual cause. Replaced with a closure ('{ $0.label }'),
which isn't subject to that restriction.
This commit is contained in:
@@ -39,9 +39,12 @@ final class CartCheckoutFlowTests: XCTestCase {
|
||||
if errorText.exists {
|
||||
signals.append("error text visible: \(errorText.label)")
|
||||
}
|
||||
// A bare `\.label` key path literal is illegal here - `label` is
|
||||
// @MainActor-isolated, and a key path must be formable from any
|
||||
// isolation context. A closure isn't subject to that restriction.
|
||||
let visibleTexts = app.staticTexts.allElementsBoundByIndex
|
||||
.prefix(15)
|
||||
.map(\.label)
|
||||
.map { $0.label }
|
||||
.joined(separator: " | ")
|
||||
signals.append("visible static texts: [\(visibleTexts)]")
|
||||
return signals.joined(separator: "; ")
|
||||
|
||||
Reference in New Issue
Block a user