GTXiLib: GTXiLib does not catch errors on XCUITests

Hey all, I want to make accessibility testing on UI tests by using GTXiLib. I download with this framework via cocoapods with the code block below: target 'AccesibilityTests' do use_frameworks! pod 'GTXiLib', :git => 'https://github.com/google/GTXiLib.git', :tag => "2.1.0" end

And I successfully install GTXiLib.

I create a UI test swift file like provided below: (By the way all the elements are defined and declared in the tester classes, does this matter? Should we define all the elements in the test suite class to GTXiLib work?)

import GTXiLib import XCTest

class AccessibilityTestSuite: UITestSuite { private var tester1: Tester1! private var tester2: Tester2!

override func setUp() {
    super.setUp()
    
   //launch app
   //make set up 
    
    let checksToBeInstalled: [GTXChecking] = GTXChecksCollection.allGTXChecks()
    let tmp = GTXTestSuite.init(allTestsIn: AccessibilityTestSuite.self)
    GTXiLib.install(on: tmp ?? GTXTestSuite(), checks: checksToBeInstalled, elementBlacklists: [])
}

override func tearDown() {
    tester1 = nil
    super.tearDown()
}

func testCase() {
   //testing process
}

}

However this test is always passing. I know that there are elements on my suite that should not pass accessibility testing. What could be wrong with this issue? Thank you in advance!

@niksawtschuk , thank you!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Hey @niksawtschuk !

When I changed override func setUp() to override class func setUp() test start to fail and give me

One or more elements FAILED the accessibility checks: <UIButton: 0x7fde7d11eb00; frame = (16 519.667; 382 31); opaque = NO; layer = <CALayer: 0x600003899020>> + Check "Element has Minimum Tappable Area" failed, Suggest increasing element's frame height to at least 44 for a suggested tappable area of at least 44X44 <UIButton: 0x7fde7d121740; frame = (161.667 620.667; 91 28.6667); opaque = NO; layer = <CALayer: 0x600003899420>> + Check "Element has Minimum Tappable Area" failed, Suggest increasing element's frame height to at least 44 for a suggested tappable area of at least 44X44

Thank you for your help! By the way is this error log is expected? I mean should not we see UIButton name? How can we know which UIButton is failing?