[PM-2678] Adding IDs for Settings Page elements (#2584)

* Adding IDS for Settings elements

* Adding IDS for Settings elements
This commit is contained in:
ifernandezdiaz 2023-06-23 13:31:24 -03:00 committed by GitHub
parent 16f59e2698
commit 1407aa5655
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 5 deletions

View file

@ -20,7 +20,8 @@
x:Key="regularTemplate"
x:DataType="pages:SettingsPageListItem">
<controls:ExtendedStackLayout Orientation="Horizontal"
StyleClass="list-row, list-row-platform">
StyleClass="list-row, list-row-platform"
AutomationId="{Binding AutomationId}">
<Frame
IsVisible="{Binding UseFrame}"
Padding="10"
@ -37,14 +38,16 @@
LineBreakMode="{Binding LineBreakMode}"
HorizontalOptions="StartAndExpand"
VerticalOptions="CenterAndExpand"
StyleClass="list-title"/>
StyleClass="list-title"
AutomationId="SettingTitleLabel" />
<Label Text="{Binding SubLabel, Mode=OneWay}"
IsVisible="{Binding ShowSubLabel}"
HorizontalOptions="End"
HorizontalTextAlignment="End"
VerticalOptions="CenterAndExpand"
TextColor="{Binding SubLabelColor}"
StyleClass="list-sub" />
StyleClass="list-sub"
AutomationId="SettingStatusLabel" />
</controls:ExtendedStackLayout>
</DataTemplate>
<DataTemplate
@ -57,7 +60,8 @@
Padding="10"
HasShadow="False"
BackgroundColor="Transparent"
BorderColor="{DynamicResource PrimaryColor}">
BorderColor="{DynamicResource PrimaryColor}"
AutomationId="SettingActivePolicyTextLabel">
<Label
Text="{Binding Name, Mode=OneWay}"
StyleClass="text-muted, text-sm, text-bold"
@ -75,7 +79,8 @@
VerticalOptions="Center"
FontSize="Small"
TextColor="{Binding SubLabelColor}"
StyleClass="list-sub" Margin="-5"/>
StyleClass="list-sub" Margin="-5"
AutomationId="SettingCustomVaultTimeoutPicker" />
<controls:ExtendedStackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="ActivateTimePicker"/>
</controls:ExtendedStackLayout.GestureRecognizers>

View file

@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using Bit.App.Resources;
using Bit.App.Utilities;
@ -22,5 +23,24 @@ namespace Bit.App.Pages
public Color SubLabelColor => SubLabelTextEnabled ?
ThemeManager.GetResourceColor("SuccessColor") :
ThemeManager.GetResourceColor("MutedColor");
public string AutomationId
{
get
{
if (!UseFrame)
{
var idText = new CultureInfo("en-US", false)
.TextInfo
.ToTitleCase(Name)
.Replace(" ", String.Empty)
.Replace("-", String.Empty);
return $"{idText}Cell";
}
else
{
return "EnabledPolicyCell";
}
}
}
}
}