Rafaela Lourenço
Rafaela Lourenço

Reputation: 1166

Swift UITest - One of the two will be used. Which one is undefined

I'm trying to make some UITests, and I'm having annoying problem.

When I try to get a tableView/tableCell, I recieve this text in log and my test fail.

objc[18223]: Class VCWeakObjectHolder is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/Frameworks/ViceroyTrace.framework/ViceroyTrace (0x131ad04d0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/AVConference (0x131797e38). One of the two will be used. Which one is undefined.

That's the code that I'm using to make test:

let app = XCUIApplication()
let table = app.tables

let cell = table.cells.element(matching: .cell, identifier: "cell_settings_1")
_ = cell.waitForExistence(timeout: 10.0)
cell.tap()

XCTAssert(app.otherElements["view_about"].exists)

My tableViewCell has this string as identifier, that's not the problem.

When I try to record test, I receive this error:

Error

Someone could help me?

Upvotes: 1

Views: 2571

Answers (2)

Rafaela Lourenço
Rafaela Lourenço

Reputation: 1166

After so many time I discovered my error.

The problem was that I put an accessibility Identifier in parent of a view.. and then, the itens inside then will never work properly.

That's an image:

enter image description here

So, in image case, nothing inside "view_about" will be detected by tests (even recorder).

Upvotes: 2

alannichols
alannichols

Reputation: 1506

You usually get this error when the element can't be found in the accessibility layer. Importantly, this has nothing to do with the UI tests.

Ignore the tests for the moment, and open the Accessibility Inspector from developer tools in XCode. If you use the small target icon, and hover over the thing you want to interact with, there is a good chance that it isn't findable as an accessibility element. If that is the case, you will need to fix the accessibility of the element in the app. Sometimes this is easy and sometimes it isn't. It will depend on the specific situation.

There may be other reasons that you would see this error but all of the times I have encountered it it has been caused by the issue described above.

Upvotes: 0

Related Questions