Setting AccessibilityIdentifier on a UILabel and UIButton fails to show in REPL

CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭

I have successfully set an Accessibility identifier for a UIButton (a custom button that inherits from UIButton), and it shows up in the REPL, however setting it on a another UIButton (another custom button that inherits from UIButton), and also a UILabel fails to show in the REPL.

The accessibility identifiers are set together in the same MvxViewController:

btnLogin.AccessibilityIdentifier = "StartScreenView_LoginButton";  // Secondary button which inherits from UIButton
btnSetup.AccessibilityIdentifier = "StartScreenView_SetupButton"; // Primary button which inherits from UIButton
versionLabel.AccessibilityIdentifier = "StartScreenView_VersionNumberTextView"; // UILabel

results in the following in the REPL:

>>> tree                                                                        
[CalabashRootView > ... > UIViewControllerWrapperView]                          
  [MainPageView] id: "Anthony was here!!!"
    [UIImageView] id: "background.png"
    [UIImageView] id: "loadingscreen_logo.png"
    [PrimaryButton] label: "Setup / Create account"
      [UIButtonLabel] label: "Setup / Create account",  text: "Setup / Create account"
    [SecondaryButton] id: "StartScreenView_LoginButton",  label: "Already have an account"
      [UIButtonLabel] label: "Already have an account",  text: "Already have an account"
    [UILabel] label: "2.4.0 (1)",  text: "2.4.0 (1)"
>>>    

You can see that the first button shows an id of "StartScreenView_LoginButton".

However the UILabel that has the following does not show the expected id:

[UILabel] label: "2.4.0 (1)", text: "2.4.0 (1)"

Nor does the other button show an id:

[SecondaryButton] id: "StartScreenView_LoginButton",  label: "Already have an account"
      [UIButtonLabel] label: "Already have an account",  text: "Already have an account"

Any ideas?

My Xamarin.UITest package has a version of 2.1.3.

It's in a Xamarin.iOS project.

Kind regards,

Anthony

Best Answer

  • CaptainXamtasticCaptainXamtastic GB ✭✭✭
    Accepted Answer

    Fixed it.

    I changed the path to the app instead of just referring to the bundle id, vis-a-vis:

    ConfigureApp
                    .iOS
                    .AppBundle("../../../myprojectname/bin/iPhoneSimulator/Debug/myproject.app")
                    .Debug()
                    .PreferIdeSettings()
                    //.InstalledApp("My bundle id")
                    .StartApp()
    

    As it turned out the later was referring to a different build.

    But here are the results for posterity:

    >>> tree                                                                        
    [CalabashRootView > ... > UIViewControllerWrapperView]                          
      [MainPageView] id: "Anthony was here!!!"
        [UIImageView] id: "background.png"
        [UIImageView] id: "loadingscreen_logo.png"
        [PrimaryButton] id: "StartScreenView_SetupButton",  label: "Setup / Create account"
          [UIButtonLabel] label: "Setup / Create account",  text: "Setup / Create account"
        [SecondaryButton] id: "StartScreenView_LoginButton",  label: "Already have an account"
          [UIButtonLabel] label: "Already have an account",  text: "Already have an account"
        [UILabel] id: "StartScreenView_VersionNumberTextView",  label: "2.4.0 (1)",  text: "2.4.0 (1)"
    >>>   
    

Answers

  • CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭
    Accepted Answer

    Fixed it.

    I changed the path to the app instead of just referring to the bundle id, vis-a-vis:

    ConfigureApp
                    .iOS
                    .AppBundle("../../../myprojectname/bin/iPhoneSimulator/Debug/myproject.app")
                    .Debug()
                    .PreferIdeSettings()
                    //.InstalledApp("My bundle id")
                    .StartApp()
    

    As it turned out the later was referring to a different build.

    But here are the results for posterity:

    >>> tree                                                                        
    [CalabashRootView > ... > UIViewControllerWrapperView]                          
      [MainPageView] id: "Anthony was here!!!"
        [UIImageView] id: "background.png"
        [UIImageView] id: "loadingscreen_logo.png"
        [PrimaryButton] id: "StartScreenView_SetupButton",  label: "Setup / Create account"
          [UIButtonLabel] label: "Setup / Create account",  text: "Setup / Create account"
        [SecondaryButton] id: "StartScreenView_LoginButton",  label: "Already have an account"
          [UIButtonLabel] label: "Already have an account",  text: "Already have an account"
        [UILabel] id: "StartScreenView_VersionNumberTextView",  label: "2.4.0 (1)",  text: "2.4.0 (1)"
    >>>   
    
Sign In or Register to comment.