1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-27 17:08:00 +01:00

[PS-2558] Mobile Automation - Starting automationIDs additions to our codebase (#2558)

* Adding locators for Environment, Hope, Login and Register pages

* Adding Locators on LockPage

* Adding Álison's suggestions
This commit is contained in:
ifernandezdiaz 2023-06-06 21:00:01 -03:00 committed by GitHub
parent eeb634e698
commit 1c13ed9895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 35 deletions

View File

@ -34,7 +34,8 @@
Placeholder="ex. https://bitwarden.company.com" Placeholder="ex. https://bitwarden.company.com"
StyleClass="box-value" StyleClass="box-value"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" /> ReturnCommand="{Binding SubmitCommand}"
AutomationId="ServerUrlEntry"/>
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n SelfHostedEnvironmentFooter}" Text="{u:I18n SelfHostedEnvironmentFooter}"
@ -53,7 +54,8 @@
x:Name="_webVaultEntry" x:Name="_webVaultEntry"
Text="{Binding WebVaultUrl}" Text="{Binding WebVaultUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value"
AutomationId="WebVaultUrlEntry"/>
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row">
<Label <Label
@ -63,7 +65,8 @@
x:Name="_apiEntry" x:Name="_apiEntry"
Text="{Binding ApiUrl}" Text="{Binding ApiUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value"
AutomationId="ApiUrlEntry"/>
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row">
<Label <Label
@ -73,7 +76,8 @@
x:Name="_identityEntry" x:Name="_identityEntry"
Text="{Binding IdentityUrl}" Text="{Binding IdentityUrl}"
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" /> StyleClass="box-value"
AutomationId="IdentityUrlEntry"/>
</StackLayout> </StackLayout>
<StackLayout StyleClass="box-row"> <StackLayout StyleClass="box-row">
<Label <Label
@ -85,7 +89,8 @@
Keyboard="Url" Keyboard="Url"
StyleClass="box-value" StyleClass="box-value"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" /> ReturnCommand="{Binding SubmitCommand}"
AutomationId="IconsUrlEntry"/>
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n CustomEnvironmentFooter}" Text="{u:I18n CustomEnvironmentFooter}"

View File

@ -49,7 +49,9 @@
Keyboard="Email" Keyboard="Email"
StyleClass="box-value" StyleClass="box-value"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding ContinueCommand}"> ReturnCommand="{Binding ContinueCommand}"
AutomationId="EmailAddressEntry"
>
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled"> <VisualState x:Name="Disabled">
@ -78,7 +80,8 @@
FontSize="13" FontSize="13"
TextColor="{DynamicResource PrimaryColor}" TextColor="{DynamicResource PrimaryColor}"
VerticalOptions="Center" VerticalOptions="Center"
VerticalTextAlignment="Center"/> VerticalTextAlignment="Center"
AutomationId="RegionSelectorDropdown"/>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
Orientation="Horizontal" Orientation="Horizontal"
@ -92,21 +95,27 @@
StyleClass="text-sm" StyleClass="text-sm"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="Center" VerticalOptions="Center"
VerticalTextAlignment="Center"/> VerticalTextAlignment="Center"
/>
<Switch <Switch
Scale="0.8" Scale="0.8"
IsToggled="{Binding RememberEmail}" IsToggled="{Binding RememberEmail}"
VerticalOptions="Center"/> VerticalOptions="Center"
AutomationId="RememberMeSwitch"
/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
<Button Text="{u:I18n Continue}" <Button Text="{u:I18n Continue}"
StyleClass="btn-primary" StyleClass="btn-primary"
IsEnabled="{Binding CanContinue}" IsEnabled="{Binding CanContinue}"
Command="{Binding ContinueCommand}" /> Command="{Binding ContinueCommand}"
AutomationId="ContinueButton"
/>
<Label FormattedText="{Binding CreateAccountText}" <Label FormattedText="{Binding CreateAccountText}"
Margin="0, 10" Margin="0, 10"
StyleClass="box-footer-label"> StyleClass="box-footer-label"
AutomationId="CreateAccountLabel">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding CreateAccountCommand}" /> <TapGestureRecognizer Command="{Binding CreateAccountCommand}" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
@ -132,5 +141,4 @@
MainPage="{Binding Source={x:Reference _page}}" MainPage="{Binding Source={x:Reference _page}}"
BindingContext="{Binding AccountSwitchingOverlayViewModel}"/> BindingContext="{Binding AccountSwitchingOverlayViewModel}"/>
</AbsoluteLayout> </AbsoluteLayout>
</pages:BaseContentPage> </pages:BaseContentPage>

View File

@ -71,7 +71,8 @@
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" /> ReturnCommand="{Binding SubmitCommand}"
AutomationId="PinEntry"/>
<controls:IconButton <controls:IconButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -81,7 +82,8 @@
Grid.RowSpan="2" Grid.RowSpan="2"
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="PinVisibilityToggle"/>
</Grid> </Grid>
<Grid <Grid
x:Name="_passwordGrid" x:Name="_passwordGrid"
@ -111,7 +113,8 @@
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" /> ReturnCommand="{Binding SubmitCommand}"
AutomationId="MasterPasswordEntry"/>
<controls:IconButton <controls:IconButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -121,7 +124,9 @@
Grid.RowSpan="2" Grid.RowSpan="2"
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="PasswordVisibilityToggle"
/>
</Grid> </Grid>
<StackLayout <StackLayout
StyleClass="box-row" StyleClass="box-row"
@ -147,7 +152,8 @@
x:Name="_unlockButton" x:Name="_unlockButton"
Text="{u:I18n Unlock}" Text="{u:I18n Unlock}"
StyleClass="btn-primary" StyleClass="btn-primary"
Clicked="Unlock_Clicked" /> Clicked="Unlock_Clicked"
AutomationId="UnlockVaultButton"/>
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

View File

@ -9,16 +9,15 @@
xmlns:u="clr-namespace:Bit.App.Utilities" xmlns:u="clr-namespace:Bit.App.Utilities"
x:DataType="pages:LoginPageViewModel" x:DataType="pages:LoginPageViewModel"
x:Name="_page" x:Name="_page"
Title="{Binding PageTitle}"> Title="{Binding PageTitle}"
AutomationId="PageTitleLabel">
<ContentPage.BindingContext> <ContentPage.BindingContext>
<pages:LoginPageViewModel /> <pages:LoginPageViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<controls:ExtendedToolbarItem <controls:ExtendedToolbarItem
x:Name="_accountAvatar" x:Name="_accountAvatar"
x:Key="accountAvatar"
IconImageSource="{Binding AvatarImageSource}" IconImageSource="{Binding AvatarImageSource}"
Command="{Binding Source={x:Reference _accountListOverlay}, Path=ToggleVisibililtyCommand}" Command="{Binding Source={x:Reference _accountListOverlay}, Path=ToggleVisibililtyCommand}"
Order="Primary" Order="Primary"
@ -34,7 +33,8 @@
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" <ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
x:Name="_moreItem" x:Key="moreItem" x:Name="_moreItem" x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" /> AutomationProperties.Name="{u:I18n Options}"
AutomationId="OptionsButton"/>
<ToolbarItem Text="{u:I18n GetPasswordHint}" <ToolbarItem Text="{u:I18n GetPasswordHint}"
x:Key="getPasswordHint" x:Key="getPasswordHint"
x:Name="_getPasswordHint" x:Name="_getPasswordHint"
@ -75,7 +75,9 @@
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding LogInCommand}" /> ReturnCommand="{Binding LogInCommand}"
AutomationId="MasterPasswordEntry"
/>
<controls:IconButton <controls:IconButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -84,6 +86,7 @@
Grid.Column="1" Grid.Column="1"
Grid.RowSpan="1" Grid.RowSpan="1"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationId="PasswordVisibilityToggle"
AutomationProperties.Name="{u:I18n ToggleVisibility}" AutomationProperties.Name="{u:I18n ToggleVisibility}"
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"/> AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"/>
<Label <Label
@ -93,7 +96,9 @@
Padding="0,5,0,0" Padding="0,5,0,0"
Grid.Row="2" Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="2"> Grid.ColumnSpan="2"
AutomationId="GetMasterPasswordHintLabel"
>
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Hint_Clicked" /> <TapGestureRecognizer Tapped="Hint_Clicked" />
</Label.GestureRecognizers> </Label.GestureRecognizers>
@ -104,19 +109,24 @@
<Button x:Name="_loginWithMasterPassword" <Button x:Name="_loginWithMasterPassword"
Text="{u:I18n LogInWithMasterPassword}" Text="{u:I18n LogInWithMasterPassword}"
StyleClass="btn-primary" StyleClass="btn-primary"
Clicked="LogIn_Clicked" /> Clicked="LogIn_Clicked"
AutomationId="LogInWithMasterPasswordButton"
/>
<controls:IconLabelButton <controls:IconLabelButton
HorizontalOptions="Fill" HorizontalOptions="Fill"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
Icon="{Binding Source={x:Static core:BitwardenIcons.Device}}" Icon="{Binding Source={x:Static core:BitwardenIcons.Device}}"
Label="{u:I18n LogInWithAnotherDevice}" Label="{u:I18n LogInWithAnotherDevice}"
ButtonCommand="{Binding LogInWithDeviceCommand}" ButtonCommand="{Binding LogInWithDeviceCommand}"
IsVisible="{Binding IsKnownDevice}"/> IsVisible="{Binding IsKnownDevice}"
AutomationId="LogInWithAnotherDeviceButton"
/>
<controls:IconLabelButton <controls:IconLabelButton
HorizontalOptions="Fill" HorizontalOptions="Fill"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
Icon="{Binding Source={x:Static core:BitwardenIcons.Suitcase}}" Icon="{Binding Source={x:Static core:BitwardenIcons.Suitcase}}"
Label="{u:I18n LogInSso}"> Label="{u:I18n LogInSso}"
AutomationId="LogInWithSsoButton">
<controls:IconLabelButton.GestureRecognizers> <controls:IconLabelButton.GestureRecognizers>
<TapGestureRecognizer Tapped="LogInSSO_Clicked" /> <TapGestureRecognizer Tapped="LogInSSO_Clicked" />
</controls:IconLabelButton.GestureRecognizers> </controls:IconLabelButton.GestureRecognizers>
@ -124,12 +134,15 @@
<Label <Label
Text="{Binding LoggingInAsText}" Text="{Binding LoggingInAsText}"
StyleClass="text-sm" StyleClass="text-sm"
Margin="0,40,0,0"/> Margin="0,40,0,0"
AutomationId="LoggingInAsLabel"
/>
<Label <Label
Text="{u:I18n NotYou}" Text="{u:I18n NotYou}"
StyleClass="text-md" StyleClass="text-md"
HorizontalOptions="Start" HorizontalOptions="Start"
TextColor="{DynamicResource HyperlinkColor}"> TextColor="{DynamicResource HyperlinkColor}"
AutomationId="NotYouLabel">
<Label.GestureRecognizers> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Cancel_Clicked" /> <TapGestureRecognizer Tapped="Cancel_Clicked" />
</Label.GestureRecognizers> </Label.GestureRecognizers>

View File

@ -35,7 +35,8 @@
x:Name="_email" x:Name="_email"
Text="{Binding Email}" Text="{Binding Email}"
Keyboard="Email" Keyboard="Email"
StyleClass="box-value" /> StyleClass="box-value"
AutomationId="EmailAddressEntry"/>
</StackLayout> </StackLayout>
<Grid StyleClass="box-row"> <Grid StyleClass="box-row">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -59,7 +60,8 @@
IsTextPredictionEnabled="False" IsTextPredictionEnabled="False"
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}" IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
Grid.Row="1" Grid.Row="1"
Grid.Column="0" /> Grid.Column="0"
AutomationId="MasterPasswordEntry"/>
<controls:IconButton <controls:IconButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -69,7 +71,8 @@
Grid.RowSpan="2" Grid.RowSpan="2"
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="PasswordVisibilityToggle"/>
</Grid> </Grid>
<Label <Label
StyleClass="box-sub-label" StyleClass="box-sub-label"
@ -109,7 +112,8 @@
IsTextPredictionEnabled="False" IsTextPredictionEnabled="False"
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}" IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
Grid.Row="1" Grid.Row="1"
Grid.Column="0" /> Grid.Column="0"
AutomationId="ConfirmMasterPasswordEntry"/>
<controls:IconButton <controls:IconButton
StyleClass="box-row-button, box-row-button-platform" StyleClass="box-row-button, box-row-button-platform"
Text="{Binding ShowPasswordIcon}" Text="{Binding ShowPasswordIcon}"
@ -118,6 +122,7 @@
Grid.Column="1" Grid.Column="1"
Grid.RowSpan="2" Grid.RowSpan="2"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationId="ConfirmPasswordVisibilityToggle"
AutomationProperties.Name="{u:I18n ToggleVisibility}" AutomationProperties.Name="{u:I18n ToggleVisibility}"
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" /> AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
</Grid> </Grid>
@ -130,7 +135,8 @@
Text="{Binding Hint}" Text="{Binding Hint}"
StyleClass="box-value" StyleClass="box-value"
ReturnType="Go" ReturnType="Go"
ReturnCommand="{Binding SubmitCommand}" /> ReturnCommand="{Binding SubmitCommand}"
AutomationId="MasterPasswordHintLabel" />
</StackLayout> </StackLayout>
<Label <Label
Text="{u:I18n MasterPasswordHintDescription}" Text="{u:I18n MasterPasswordHintDescription}"
@ -142,7 +148,8 @@
IsToggled="{Binding CheckExposedMasterPassword}" IsToggled="{Binding CheckExposedMasterPassword}"
StyleClass="box-value" StyleClass="box-value"
HorizontalOptions="Start" HorizontalOptions="Start"
Margin="0, 0, 10, 0"/> Margin="0, 0, 10, 0"
AutomationId="CheckExposedMasterPasswordToggle"/>
<Label <Label
Text="{u:I18n CheckKnownDataBreachesForThisPassword}" Text="{u:I18n CheckKnownDataBreachesForThisPassword}"
StyleClass="box-footer-label" StyleClass="box-footer-label"
@ -154,7 +161,8 @@
IsToggled="{Binding AcceptPolicies}" IsToggled="{Binding AcceptPolicies}"
StyleClass="box-value" StyleClass="box-value"
HorizontalOptions="Start" HorizontalOptions="Start"
Margin="0, 0, 10, 0"/> Margin="0, 0, 10, 0"
AutomationId="AcceptPoliciesToggle"/>
<Label StyleClass="box-footer-label" <Label StyleClass="box-footer-label"
HorizontalOptions="Fill"> HorizontalOptions="Fill">
<Label.FormattedText> <Label.FormattedText>