ios - Xcode UITesting: label disappears from hierarchy and won't come back -


this using xcode 7.2.1 , swift 2.0.

i have table cell containing uilabel used display error message. @ initial load blanked using code this:

cell.errorlabel.alpha = 0.0 cell.errorlabel.text = nil 

then later on when i've detected error want display this:

cell.label.text = "to" cell.errorlabel.alpha = 1.0 cell.errorlabel.text = "error !!!!" 

this works fine when running app. when running in ui test, try test error being displayed this:

let tocell = xcuiapplication().tables.... // finds cell label 'to' xctasserttrue(tocell.statictexts["error !!!!"].exists) 

and fails. i've verified i'm getting right cell checking other ('to') label present. is. ui testing not see error label. i've tested adding break point , using debugger this:

(lldb) p tocell.statictexts.count     t =   427.03s     number of matches for: descendants matching type statictext     t =   427.29s         snapshot accessibility hierarchy enterprise.com.me     t =   427.31s         find: descendants matching type table (uint) $r2 = 1     t =   427.31s         find: descendants matching type cell     t =   427.32s         find: elements containing elements matching type statictext identifier 'to'     t =   427.32s         find: descendants matching type statictext 

the (uint) $r2 = 1 indicating there 1 static text present. looking @ simulator can see 2 uilabels.

i've tried number of things individually isolate issue - using alpha or setting text nil, or using uiview's hidden property. using of these options hide label renders invisible ui tests when later made visible, no matter try.

i'm quite confused , suspect it's bug. have ideas how ui tests see uilabel once make visible?

p.s. i've tried using wait loop wait label appear (using expectationforpredicate(...), uilabel has not shown up.

problem turned out had not set accessibilityelements property on cells. therefore accessibility having issues trying figure out in each one.

so if building custom cells table view, ensure set accessibilityelements property testing can find contents of cells.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -