Set ViewIdResourceName for Appium based tests (#15436)

This commit is contained in:
Shane Neuville 2022-06-24 03:47:28 -05:00 коммит произвёл GitHub
Родитель b4f3eed8d3
Коммит c4dafd6b72
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -34,10 +34,19 @@ namespace Xamarin.Forms.Platform.Android
{
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}";
}
}
}