xcode - XC UITesting with Dynamic Labels -


i'm trying assert value of label (which populated dynamically) contains substring part of result of uitest.

my issue xctassert doesn't seem allow substrings or approximate matches (from can find anyway). have advice on how might write following find match "hours ago" instead of specific "xx hours ago"?

at present i'm able work exact matches (as below).

    //set expectation     let texttofind = app.statictexts["13 hours ago"]      let exists = nspredicate(format: "exists == true")     expectationforpredicate(exists, evaluatedwithobject: texttofind, handler: nil)      //give app time network data & update ui     waitforexpectationswithtimeout(5, handler: nil)      //assert results     xctassert(texttofind.exists) 

  1. change query finds ui element method other name. ui test recording feature in xcode can work through — see wwdc2015 session introducing ui testing example of doing this.

  2. once you've found ui element without using name, expectation test can use predicate tests name substring.

or:

  1. explicitly use query find app's subelement matching predicate (see elementmatchingpredicate in xcuielementquery) rather subscripting, can use exists test verify it's there. again, see wwdc session examples.

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -