Skip to content

Commit

Permalink
Add UI automation property identifier constants (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle authored Sep 13, 2023
1 parent 3b470a8 commit 67ae66c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 2 deletions.
85 changes: 85 additions & 0 deletions Sources/WinAppDriver/WinAppDriver+Attributes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
extension WinAppDriver {
public enum Attributes {
// Automation Identifiers from UIAutomationCoreApi.h
public static let boundingRectangle = "BoundingRectangle"
public static let processId = "ProcessId"
public static let controlType = "ControlType"
public static let localizedControlType = "LocalizedControlType"
public static let name = "Name"
public static let acceleratorKey = "AcceleratorKey"
public static let accessKey = "AccessKey"
public static let hasKeyboardFocus = "HasKeyboardFocus"
public static let isKeyboardFocusable = "IsKeyboardFocusable"
public static let isEnabled = "IsEnabled"
public static let automationId = "AutomationId"
public static let className = "ClassName"
public static let helpText = "HelpText"
public static let clickablePoint = "ClickablePoint"
public static let culture = "Culture"
public static let isControlElement = "IsControlElement"
public static let isContentElement = "IsContentElement"
public static let labeledBy = "LabeledBy"
public static let isPassword = "IsPassword"
public static let newNativeWindowHandle = "NewNativeWindowHandle"
public static let itemType = "ItemType"
public static let isOffscreen = "IsOffscreen"
public static let orientation = "Orientation"
public static let frameworkId = "FrameworkId"
public static let isRequiredForForm = "IsRequiredForForm"
public static let itemStatus = "ItemStatus"
public static let ariaRole = "AriaRole"
public static let ariaProperties = "AriaProperties"
public static let isDataValidForForm = "IsDataValidForForm"
public static let controllerFor = "ControllerFor"
public static let describedBy = "DescribedBy"
public static let flowsTo = "FlowsTo"
public static let providerDescription = "ProviderDescription"
public static let optimizeForVisualContent = "OptimizeForVisualContent"
public static let isDockPatternAvailable = "IsDockPatternAvailable"
public static let isExpandCollapsePatternAvailable = "IsExpandCollapsePatternAvailable"
public static let isGridItemPatternAvailable = "IsGridItemPatternAvailable"
public static let isGridPatternAvailable = "IsGridPatternAvailable"
public static let isInvokePatternAvailable = "IsInvokePatternAvailable"
public static let isMultipleViewPatternAvailable = "IsMultipleViewPatternAvailable"
public static let isRangeValuePatternAvailable = "IsRangeValuePatternAvailable"
public static let isScrollPatternAvailable = "IsScrollPatternAvailable"
public static let isScrollItemPatternAvailable = "IsScrollItemPatternAvailable"
public static let isSelectionItemPatternAvailable = "IsSelectionItemPatternAvailable"
public static let isSelectionPatternAvailable = "IsSelectionPatternAvailable"
public static let isTablePatternAvailable = "IsTablePatternAvailable"
public static let isTableItemPatternAvailable = "IsTableItemPatternAvailable"
public static let isTextPatternAvailable = "IsTextPatternAvailable"
public static let isTogglePatternAvailable = "IsTogglePatternAvailable"
public static let isTransformPatternAvailable = "IsTransformPatternAvailable"
public static let isValuePatternAvailable = "IsValuePatternAvailable"
public static let isWindowPatternAvailable = "IsWindowPatternAvailable"
public static let isLegacyIAccessiblePatternAvailable = "IsLegacyIAccessiblePatternAvailable"
public static let isItemContainerPatternAvailable = "IsItemContainerPatternAvailable"
public static let isVirtualizedItemPatternAvailable = "IsVirtualizedItemPatternAvailable"
public static let isSynchronizedInputPatternAvailable = "IsSynchronizedInputPatternAvailable"
public static let isObjectModelPatternAvailable = "IsObjectModelPatternAvailable"
public static let isAnnotationPatternAvailable = "IsAnnotationPatternAvailable"
public static let isTextPattern2Available = "IsTextPattern2Available"
public static let isTextEditPatternAvailable = "IsTextEditPatternAvailable"
public static let isCustomNavigationPatternAvailable = "IsCustomNavigationPatternAvailable"
public static let isStylesPatternAvailable = "IsStylesPatternAvailable"
public static let isSpreadsheetPatternAvailable = "IsSpreadsheetPatternAvailable"
public static let isSpreadsheetItemPatternAvailable = "IsSpreadsheetItemPatternAvailable"
public static let isTransformPattern2Available = "IsTransformPattern2Available"
public static let isTextChildPatternAvailable = "IsTextChildPatternAvailable"
public static let isDragPatternAvailable = "IsDragPatternAvailable"
public static let isDropTargetPatternAvailable = "IsDropTargetPatternAvailable"
public static let isStructuredMarkupPatternAvailable = "IsStructuredMarkupPatternAvailable"
public static let isPeripheral = "IsPeripheral"
public static let positionInSet = "PositionInSet"
public static let sizeOfSet = "SizeOfSet"
public static let level = "Level"
public static let annotationTypes = "AnnotationTypes"
public static let annotationObjects = "AnnotationObjects"
public static let landmarkType = "LandmarkType"
public static let localizedLandmarkType = "LocalizedLandmarkType"
public static let fullDescription = "FullDescription"
public static let headingLevel = "HeadingLevel"
public static let isDialog = "IsDialog"
}
}
4 changes: 2 additions & 2 deletions Tests/WinAppDriverTests/RequestsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RequestsTests: XCTestCase {
}

func testAttributes() throws {
try XCTAssertEqual(app.findWhatEditBox.getAttribute(name: "ClassName"), "Edit")
try XCTAssertEqual(app.findWhatEditBox.getAttribute(name: WinAppDriver.Attributes.className), "Edit")
}

func testElementClickGivesKeyboardFocus() throws {
Expand Down Expand Up @@ -78,6 +78,6 @@ class RequestsTests: XCTestCase {
}

private static func hasKeyboardFocus(_ element: Element) throws -> Bool {
try XCTUnwrap(element.getAttribute(name: "HasKeyboardFocus")).lowercased() == "true"
try XCTUnwrap(element.getAttribute(name: WinAppDriver.Attributes.hasKeyboardFocus)).lowercased() == "true"
}
}

0 comments on commit 67ae66c

Please sign in to comment.