UITest with XCTest

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard
Not for use with personal data

Below is a full example of getting started with XCUITests:

import axeDevToolsXCUI
import XCTest

class AccessiblityXCUITest: XCTestCase {

    var axe: AxeDevTools?
    let app = XCUIApplication()

    override func setUpWithError() throws {
        continueAfterFailure = false
        axe = try AxeDevTools.login(withUsername: "<DEQUE_USERNAME>", andPassword: "<DEQUE_PASSWORD>")

        app.launch()        
    }

    func testMainScreen() throws {
        let result = try axe?.run(onElement: app)
        
        //Fail the build if accessibility issues are found.
        XCTAssertEqual(result?.failures.count, 0)
    }
}