3 Replies Latest reply on Oct 18, 2011 3:19 AM by FlorianFF

    Automate Sprite components

    FlorianFF

      Hi there,

       

      I've built a Flex component where most of its sub-components (I'll call it CustomClass) extend Sprite (for performance reasons)

      You can click on the sprites and they generate some events.

       

      One of my client would like to automate this component but I'm not sure you can automate Sprite.

       

      I've tried implementing IAutomationObject on CustomClass

      I use RIATest and I can see my Flex Component and its children :

       

      + CustomComponent("myAutomationName")

      --- FlexDisplayObject("undefined")

      --- FlexDisplayObject("undefined")

       

      As you can see, CustomClass are typed FlexDisplayObject and have "undefined" as automation name (even if I specify one)

       

      Also, I can see this error on the console :

       

      RIATestAgent: AutomationManager returned IDPart with null automationClassName for class'CustomClass'

       

      It looks like in my CustomComponent delegate the createAutomationIDPart method is called on every sub-component.

      Howevert it returns an AutomationIDPart with no property.

       

      Any advice on the subject ?

        • 1. Re: Automate Sprite components
          Flex harUI Adobe Employee

          If the subcomponents are Sprite but the main component is a UIComponent, the

          main component should be usable in the automated testing.  The issue will be

          what the subcomponents mean to the test.  For example, DataGrid is a

          UIComponent whose renderer children don't have to be UIComponents and

          default to being TextFields.

           

          If the main component is more like a Container, you'll probably have more

          work to do and it might just be easier if your subcomponents were custom

          UIComponents.  You might be able to disable some of the APIs that slow down

          UIComponent compared to Sprite.

          1 person found this helpful
          • 2. Re: Automate Sprite components
            FlorianFF Level 1

            Yes, the main component is a UIComponent.

            I'll look into the DataGrid delegate to see how it deals with non UIComponent elements.

             

            I'm pretty sure we won't replace Sprite for UIComponents because performances is one of the reasons

            why people buy this component instead of similar ones in the market. And I don't think we will get

            similar performances with UIComponents even if we tweak them.

            • 3. Re: Automate Sprite components
              FlorianFF Level 1

              So the nice guys on RIATest forum helped me on that subject, so I thought it would be interesting to update this post

              since it could interest other people.

               

               

              RIATest wrote:

               

              This is because getClassInfoXML does not define automationName. This should fix it:

               

              Code:

                      public static function getClassInfoXML(): XML
                      {
                          return <ClassInfo Name="CustomClass" Extends="FlexDisplayObject">
                                      <Internal Class="CustomClass"/>
                          
                                  <Properties>
                                    <Property Name="automationName" Describes="true">
                                      <PropertyType Type="String"/>
                                    </Property>
                                    <Property Name="automationClassName" Describes="true" Doc="The class name as it is known to RIATest.">
                                      <PropertyType Type="String"/>
                                    </Property>
                                    <Property Name="className" Describes="true" Doc="Internal Flex class name.">
                                      <PropertyType Type="String"/>
                                    </Property>
                                    <Property Name="automationIndex" Describes="true">
                                      <PropertyType Type="String"/>
                                    </Property>
                                    <Property Name="numAutomationChildren" Verify="true" Doc="Number of automation children of this object.">
                                      <PropertyType Type="int"/>
                                    </Property>
                                  </Properties>
                          
                                </ClassInfo>;
                      }