Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Set ViewIdResourceName for Appium based tests (#15436)
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen authored Jun 24, 2022
1 parent b4f3eed commit c4dafd6
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@ public override void OnInitializeAccessibilityNodeInfo(global::Android.Views.Vie
{
host.ContentDescription = value;
}
else if (host.ContentDescription == (_element as VisualElement)?.AutomationId)
else if (host.ContentDescription == (_element as Element)?.AutomationId)
{
host.ContentDescription = null;
}

if (_element is Element element &&
!string.IsNullOrWhiteSpace(element.AutomationId) &&
host?.Context != null)
{
// This is used by Appium and other automation testing frameworks
// to locate views
info.ViewIdResourceName = $"{host.Context.PackageName}:id/{element.AutomationId}";
}
}
}

Expand Down

0 comments on commit c4dafd6

Please sign in to comment.