[PM-2737] Adding AutomationIDs for Send page elements (#2583)

* Adding AutomationIDs for Send page elements

* Fixing some spaces

* Adding Matt's suggestion

* Adding Fede's suggestion

* Removing unnecesarry breaks
This commit is contained in:
ifernandezdiaz 2023-06-28 15:07:03 -03:00 committed by GitHub
parent 1014563c75
commit 216c6abcf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 34 deletions

View file

@ -71,7 +71,8 @@
<Label <Label
Text="{u:I18n SendDisabledWarning}" Text="{u:I18n SendDisabledWarning}"
StyleClass="text-muted, text-sm, text-bold" StyleClass="text-muted, text-sm, text-bold"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center"
AutomationId="SendDisabledWarningMessageLabel" />
</Frame> </Frame>
<Frame <Frame
IsVisible="{Binding SendOptionsPolicyInEffect}" IsVisible="{Binding SendOptionsPolicyInEffect}"
@ -83,7 +84,8 @@
<Label <Label
Text="{u:I18n SendOptionsPolicyInEffect}" Text="{u:I18n SendOptionsPolicyInEffect}"
StyleClass="text-muted, text-sm, text-bold" StyleClass="text-muted, text-sm, text-bold"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center"
AutomationId="SendOptionsPolicyInEffectLabel" />
</Frame> </Frame>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row">
<Label <Label
@ -93,7 +95,8 @@
x:Name="_nameEntry" x:Name="_nameEntry"
Text="{Binding Send.Name}" Text="{Binding Send.Name}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-value" /> StyleClass="box-value"
AutomationId="SendNameEntry" />
<Label <Label
Text="{u:I18n NameInfo}" Text="{u:I18n NameInfo}"
StyleClass="box-footer-label" StyleClass="box-footer-label"
@ -123,6 +126,7 @@
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n File}" AutomationProperties.Name="{u:I18n File}"
AutomationProperties.HelpText="{Binding FileTypeAccessibilityLabel}" AutomationProperties.HelpText="{Binding FileTypeAccessibilityLabel}"
AutomationId="SendFileButton"
Grid.Column="0"> Grid.Column="0">
</Button> </Button>
<Button <Button
@ -135,6 +139,7 @@
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Text}" AutomationProperties.Name="{u:I18n Text}"
AutomationProperties.HelpText="{Binding TextTypeAccessibilityLabel}" AutomationProperties.HelpText="{Binding TextTypeAccessibilityLabel}"
AutomationId="SendTextButton"
Grid.Column="1"> Grid.Column="1">
</Button> </Button>
</Grid> </Grid>
@ -152,12 +157,14 @@
Text="{Binding Send.File.FileName, Mode=OneWay}" Text="{Binding Send.File.FileName, Mode=OneWay}"
StyleClass="box-value" StyleClass="box-value"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalOptions="StartAndExpand" /> HorizontalOptions="StartAndExpand"
AutomationId="SendFileNameLabel" />
<Label <Label
Text="{Binding Send.File.SizeName, Mode=OneWay}" Text="{Binding Send.File.SizeName, Mode=OneWay}"
StyleClass="box-sub-label" StyleClass="box-sub-label"
HorizontalTextAlignment="End" HorizontalTextAlignment="End"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center"
AutomationId="SendFileSizeLabel" />
</StackLayout> </StackLayout>
<StackLayout <StackLayout
IsVisible="{Binding EditMode, Converter={StaticResource inverseBool}}" IsVisible="{Binding EditMode, Converter={StaticResource inverseBool}}"
@ -168,20 +175,23 @@
LineBreakMode="CharacterWrap" LineBreakMode="CharacterWrap"
StyleClass="text-sm, text-muted" StyleClass="text-sm, text-muted"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center"
AutomationId="SendNoFileChosenLabel" />
<Label <Label
IsVisible="{Binding FileName, Converter={StaticResource notNull}}" IsVisible="{Binding FileName, Converter={StaticResource notNull}}"
Text="{Binding FileName}" Text="{Binding FileName}"
LineBreakMode="CharacterWrap" LineBreakMode="CharacterWrap"
StyleClass="text-sm, text-muted" StyleClass="text-sm, text-muted"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center"
AutomationId="SendCurrentFileNameLabel" />
<Button <Button
Text="{u:I18n ChooseFile}" Text="{u:I18n ChooseFile}"
IsVisible="{Binding IsAddFromShare, Converter={StaticResource inverseBool}}" IsVisible="{Binding IsAddFromShare, Converter={StaticResource inverseBool}}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-button-row" StyleClass="box-button-row"
Clicked="ChooseFile_Clicked" /> Clicked="ChooseFile_Clicked"
AutomationId="SendChooseFileButton" />
<Label <Label
Margin="0, 5, 0, 0" Margin="0, 5, 0, 0"
Text="{u:I18n MaxFileSize}" Text="{u:I18n MaxFileSize}"
@ -208,6 +218,7 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-value" StyleClass="box-value"
Margin="{Binding EditorMargins}" Margin="{Binding EditorMargins}"
AutomationId="SendTextContentEntry"
effects:ScrollEnabledEffect.IsScrollEnabled="false" > effects:ScrollEnabledEffect.IsScrollEnabled="false" >
<Editor.Behaviors> <Editor.Behaviors>
<behaviors:EditorPreventAutoBottomScrollingOnFocusedBehavior ParentScrollView="{x:Reference _scrollView}" /> <behaviors:EditorPreventAutoBottomScrollingOnFocusedBehavior ParentScrollView="{x:Reference _scrollView}" />
@ -235,7 +246,8 @@
IsToggled="{Binding Send.Text.Hidden}" IsToggled="{Binding Send.Text.Hidden}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
HorizontalOptions="End" HorizontalOptions="End"
Margin="10,0,0,0" /> Margin="10,0,0,0"
AutomationId="SendHideTextByDefaultToggle" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
@ -249,7 +261,8 @@
IsToggled="{Binding ShareOnSave}" IsToggled="{Binding ShareOnSave}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
HorizontalOptions="End" HorizontalOptions="End"
Margin="10,0,0,0" /> Margin="10,0,0,0"
AutomationId="SendShareSendAfterSaveToggle" />
</StackLayout> </StackLayout>
<StackLayout <StackLayout
Orientation="Horizontal" Orientation="Horizontal"
@ -263,21 +276,24 @@
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
Margin="0" Margin="0"
AutomationProperties.IsInAccessibleTree="False"/> AutomationProperties.IsInAccessibleTree="False"
AutomationId="SendShowHideOptionsButton" />
<controls:IconButton <controls:IconButton
x:Name="_btnOptionsUp" x:Name="_btnOptionsUp"
Text="{Binding Source={x:Static core:BitwardenIcons.ChevronUp}}" Text="{Binding Source={x:Static core:BitwardenIcons.ChevronUp}}"
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
IsVisible="{Binding ShowOptions}" IsVisible="{Binding ShowOptions}"
AutomationProperties.IsInAccessibleTree="False"/> AutomationProperties.IsInAccessibleTree="False"
AutomationId="SendOptionsDisplayed" />
<controls:IconButton <controls:IconButton
x:Name="_btnOptionsDown" x:Name="_btnOptionsDown"
Text="{Binding Source={x:Static core:BitwardenIcons.AngleDown}}" Text="{Binding Source={x:Static core:BitwardenIcons.AngleDown}}"
StyleClass="box-row-button" StyleClass="box-row-button"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}" IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}"
AutomationProperties.IsInAccessibleTree="False"/> AutomationProperties.IsInAccessibleTree="False"
AutomationId="SendOptionsHidden" />
</StackLayout> </StackLayout>
<StackLayout IsVisible="{Binding ShowOptions}"> <StackLayout IsVisible="{Binding ShowOptions}">
<StackLayout <StackLayout
@ -294,7 +310,8 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-value" StyleClass="box-value"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n DeletionTime}" /> AutomationProperties.Name="{u:I18n DeletionTime}"
AutomationId="SendDeletionOptionsPicker" />
<Grid <Grid
IsVisible="{Binding ShowDeletionCustomPickers}" IsVisible="{Binding ShowDeletionCustomPickers}"
Margin="0,5,0,0"> Margin="0,5,0,0">
@ -308,14 +325,16 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n DeletionDate}" AutomationProperties.Name="{u:I18n DeletionDate}"
Grid.Column="0" /> Grid.Column="0"
AutomationId="SendCustomDeletionDatePicker" />
<controls:ExtendedTimePicker <controls:ExtendedTimePicker
NullableTime="{Binding DeletionDateTimeViewModel.Time, Mode=TwoWay}" NullableTime="{Binding DeletionDateTimeViewModel.Time, Mode=TwoWay}"
Format="t" Format="t"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n DeletionTime}" AutomationProperties.Name="{u:I18n DeletionTime}"
Grid.Column="1" /> Grid.Column="1"
AutomationId="SendCustomDeletionTimePicker" />
</Grid> </Grid>
<Label <Label
Text="{u:I18n DeletionDateInfo}" Text="{u:I18n DeletionDateInfo}"
@ -334,7 +353,8 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-value" StyleClass="box-value"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n ExpirationTime}" /> AutomationProperties.Name="{u:I18n ExpirationTime}"
AutomationId="SendExpirationOptionsPicker" />
<Grid <Grid
IsVisible="{Binding ShowExpirationCustomPickers}" IsVisible="{Binding ShowExpirationCustomPickers}"
Margin="0,5,0,0"> Margin="0,5,0,0">
@ -349,7 +369,8 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n ExpirationDate}" AutomationProperties.Name="{u:I18n ExpirationDate}"
Grid.Column="0" /> Grid.Column="0"
AutomationId="SendCustomExpirationDatePicker" />
<controls:ExtendedTimePicker <controls:ExtendedTimePicker
NullableTime="{Binding ExpirationDateTimeViewModel.Time, Mode=TwoWay}" NullableTime="{Binding ExpirationDateTimeViewModel.Time, Mode=TwoWay}"
PlaceHolder="--:-- --" PlaceHolder="--:-- --"
@ -357,7 +378,8 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n ExpirationTime}" AutomationProperties.Name="{u:I18n ExpirationTime}"
Grid.Column="1" /> Grid.Column="1"
AutomationId="SendCustomExpirationTimePicker" />
</Grid> </Grid>
<StackLayout <StackLayout
Orientation="Horizontal" Orientation="Horizontal"
@ -374,7 +396,8 @@
FontSize="{Binding SegmentedButtonFontSize}" FontSize="{Binding SegmentedButtonFontSize}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-row-button" StyleClass="box-row-button"
Clicked="ClearExpirationDate_Clicked" /> Clicked="ClearExpirationDate_Clicked"
AutomationId="SendClearExpirationDateButton" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
@ -393,13 +416,15 @@
Keyboard="Numeric" Keyboard="Numeric"
MaxLength="9" MaxLength="9"
TextChanged="OnMaxAccessCountTextChanged" TextChanged="OnMaxAccessCountTextChanged"
HorizontalOptions="FillAndExpand" /> HorizontalOptions="FillAndExpand"
AutomationId="SendMaxAccessCountEntry" />
<controls:ExtendedStepper <controls:ExtendedStepper
x:Name="_maxAccessCountStepper" x:Name="_maxAccessCountStepper"
Value="{Binding MaxAccessCount}" Value="{Binding MaxAccessCount}"
Maximum="999999999" Maximum="999999999"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
Margin="10,0,0,0" /> Margin="10,0,0,0"
AutomationId="SendMaxAccessCountStepper" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n MaximumAccessCountInfo}" Text="{u:I18n MaximumAccessCountInfo}"
@ -419,7 +444,8 @@
<Label <Label
Text="{Binding Send.AccessCount, Mode=OneWay}" Text="{Binding Send.AccessCount, Mode=OneWay}"
StyleClass="box-label" StyleClass="box-label"
VerticalTextAlignment="Center" /> VerticalTextAlignment="Center"
AutomationId="SendCurrentAccessCountLabel" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
@ -436,7 +462,8 @@
StyleClass="box-value" StyleClass="box-value"
IsSpellCheckEnabled="False" IsSpellCheckEnabled="False"
IsTextPredictionEnabled="False" IsTextPredictionEnabled="False"
HorizontalOptions="FillAndExpand" /> HorizontalOptions="FillAndExpand"
AutomationId="SendNewPasswordEntry" />
<controls:IconButton <controls:IconButton
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
@ -445,7 +472,8 @@
Margin="10,0,0,0" Margin="10,0,0,0"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n ToggleVisibility}" AutomationProperties.Name="{u:I18n ToggleVisibility}"
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" /> AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
AutomationId="SendShowHidePasswordButton" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n PasswordInfo}" Text="{u:I18n PasswordInfo}"
@ -464,7 +492,8 @@
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
StyleClass="box-value" StyleClass="box-value"
Margin="{Binding EditorMargins}" Margin="{Binding EditorMargins}"
effects:ScrollEnabledEffect.IsScrollEnabled="false" > effects:ScrollEnabledEffect.IsScrollEnabled="false"
AutomationId="SendNotesEntry">
<Editor.Behaviors> <Editor.Behaviors>
<behaviors:EditorPreventAutoBottomScrollingOnFocusedBehavior ParentScrollView="{x:Reference _scrollView}" /> <behaviors:EditorPreventAutoBottomScrollingOnFocusedBehavior ParentScrollView="{x:Reference _scrollView}" />
</Editor.Behaviors> </Editor.Behaviors>
@ -492,7 +521,8 @@
IsToggled="{Binding Send.HideEmail}" IsToggled="{Binding Send.HideEmail}"
IsEnabled="{Binding DisableHideEmailControl, Converter={StaticResource inverseBool}}" IsEnabled="{Binding DisableHideEmailControl, Converter={StaticResource inverseBool}}"
HorizontalOptions="End" HorizontalOptions="End"
Margin="10,0,0,0" /> Margin="10,0,0,0"
AutomationId="SendHideEmailSwitch" />
</StackLayout> </StackLayout>
<StackLayout <StackLayout
StyleClass="box-row, box-row-switch" StyleClass="box-row, box-row-switch"
@ -506,7 +536,8 @@
IsToggled="{Binding Send.Disabled}" IsToggled="{Binding Send.Disabled}"
IsEnabled="{Binding SendEnabled}" IsEnabled="{Binding SendEnabled}"
HorizontalOptions="End" HorizontalOptions="End"
Margin="10,0,0,0" /> Margin="10,0,0,0"
AutomationId="SendDeactivateSwitch" />
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>

View file

@ -44,13 +44,15 @@
<controls:SendViewCell <controls:SendViewCell
Send="{Binding Send}" Send="{Binding Send}"
ButtonCommand="{Binding BindingContext.SendOptionsCommand, Source={x:Reference _page}}" ButtonCommand="{Binding BindingContext.SendOptionsCommand, Source={x:Reference _page}}"
ShowOptions="{Binding BindingContext.SendEnabled, Source={x:Reference _page}}" /> ShowOptions="{Binding BindingContext.SendEnabled, Source={x:Reference _page}}"
AutomationId="SendCell" />
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="sendGroupTemplate" <DataTemplate x:Key="sendGroupTemplate"
x:DataType="pages:SendGroupingsPageListItem"> x:DataType="pages:SendGroupingsPageListItem">
<controls:ExtendedStackLayout Orientation="Horizontal" <controls:ExtendedStackLayout Orientation="Horizontal"
StyleClass="list-row, list-row-platform"> StyleClass="list-row, list-row-platform"
AutomationId="{Binding AutomationId}">
<controls:IconLabel Text="{Binding Icon, Mode=OneWay}" <controls:IconLabel Text="{Binding Icon, Mode=OneWay}"
HorizontalOptions="Start" HorizontalOptions="Start"
VerticalOptions="Center" VerticalOptions="Center"
@ -64,12 +66,14 @@
LineBreakMode="TailTruncation" LineBreakMode="TailTruncation"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
StyleClass="list-title" /> StyleClass="list-title"
AutomationId="SendFilterNameLabel" />
<Label Text="{Binding ItemCount, Mode=OneWay}" <Label Text="{Binding ItemCount, Mode=OneWay}"
HorizontalOptions="End" HorizontalOptions="End"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
HorizontalTextAlignment="End" HorizontalTextAlignment="End"
StyleClass="list-sub" /> StyleClass="list-sub"
AutomationId="SendFilterCountLabel" />
</controls:ExtendedStackLayout> </controls:ExtendedStackLayout>
</DataTemplate> </DataTemplate>

View file

@ -66,5 +66,27 @@ namespace Bit.App.Pages
return _icon; return _icon;
} }
} }
public string AutomationId
{
get
{
if (_name != null)
{
return "SendItem";
}
if (Type != null)
{
switch (Type.Value)
{
case SendType.Text:
return "SendTextFilter";
case SendType.File:
return "SendFileFilter";
}
}
return null;
}
}
} }
} }

View file

@ -59,7 +59,8 @@
Margin="20, 0" Margin="20, 0"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"
HorizontalTextAlignment="Center" /> HorizontalTextAlignment="Center"
AutomationId="NoSendDisplayedLabel" />
<controls:ExtendedCollectionView <controls:ExtendedCollectionView
IsVisible="{Binding ShowList}" IsVisible="{Binding ShowList}"
ItemsSource="{Binding Sends}" ItemsSource="{Binding Sends}"