Get your 6-month No-Cost Opt-Out offer for Unlimited software automation!

Reuse script

Reuse script

Home Forums Ask Expert Reuse script

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #33033
    Marco Malziotti
    Participant

      Good evening
      I have written a script for these two views (see attachment “HeaderMenu-web.jpg” and “RegistryFilled-web.jpg”).
      Now these views are visible through a web view in an app.
      Question: Can I reuse (with minor changes) the script written for the web also for the app as well?
      Or do I have to re-edit all the screens and re-write another script for the same test case run by the app?
      Thanks.

      Marco Malziotti

      #33034
      Marco Malziotti
      Participant

        P.S. To use AUT replace the password in the .csv file with this one: https://ots.octotelematics.com/secret/2ao86iuutmctr6lxsz8oliev3gemxz0

        #33068
        Sasha ZAP
        Moderator

          Hello Marco,
          In your attached script the Application object’ “regexpwndtitle” Property is set to the “CBPRO_PhoneModify.png ‎- Foto” value, which means this Application object will be recognized only for the specific device it was captured from:
          If you would like to enable the Application object to be recognized in any type of environment you can empty this Property value or set it as a parameter which its values will be changed based on some condition statement.
          If you’ll do this change and if there is no significant difference between the Desktop and the mobile app’s UI, the script supposes to run in both platforms.
          Please note, in mobile devices usually app pages objects are not fully visible as they are in the Desktop app’s pages (Usually due to screen size limitations), in such cases you can use methods such as “SwipeTo” orand “ScrollTo” to locate specific objects during runtime.
          Hope this helps.
          Thanks,
          ZAPTEST Team

          #33069
          Marco Malziotti
          Participant

            Thanks Sasha
            I followed your advice and set the regexpwndclass and regexpwndtitle properties of the “CBPRO-it” application in the code that I want to reuse when running on Android.
            In case of web execution everything is ok.
            In the case of execution from mobile I have the same error as before. ZapTest recognizes lblEmail but not iconModify1 (line 81). Perhaps this is also a problem that can be solved with the Scalability parameter?
            My goal, I repeat, is not to create a new application (like “Android”) in which to re-load and re-edit all the CBPRO screenshots viewed from a mobile device.
            Thanks
            Marco Malziotti

            #33137
            Sasha ZAP
            Moderator

              Hello Marco,
              It appears your website does not work when I’m answering your question, maybe the server is down.

              Regarding the “iconModify1” object, basically this is an image based object which means its recognition depends on its location upon the View (And the View depends on the screen’s resolution and size) – Please check the following video regarding the “Scalability” object property, which is one of the significant Image based object properties:

              Scalability Property

              Also please check the following creating a cross-platform testing script tutorial video :

              iPhone and Android

              As you can see if there is a setting which is different in each platform you can use, for example, the following condition:
              If Application(“CBPRO-it”).GetPlatformType = “android” Then
              Application(“Android”).View(“RegistryFilled”).Object(“lblEmail”).Object(“iconModify1”).Click
              Else
              Application(“CBPRO-it”).View(“RegistryFilled”).Object(“lblEmail”).Object(“iconModify1”).Click
              End If
              Wait 4

              Hope this helps.

              Thanks,
              ZAPTEST Team

              #33182
              Marco Malziotti
              Participant

                Hello Sasha,
                Here is the new version of the script.
                ‘CBPRO-it’ Application did not evaluate the following parameters: regexpwndtitle, Width and Height.
                Parameters regexpwndclass and regexpwndtitle are setted at runtime in case of execeution on mobile device (line 36 and 37).
                ‘iconModify1’ at line 81 are not recognized in execution on mobile device.
                Please confirm that I am forced to create a new application (type “Android”) in which to reload and edit again all the CBPRO screenshots viewed from a mobile device.
                What parameter can I change at runtime to avoid this?
                Thank you.

                in the following links:
                Mobile app Android: https://octospa-my.sharepoint.com/:u:/g/personal/m_malziotti_octotelematics_com/EWCJ5G5XUX1IpTSWM928o7IBiJjoDq4H-2T4Uue9knm73A?e=QTpVcx

                Password to replace in “dt-cbpro-modify-email.csv” file (password field): https://ots.octotelematics.com/secret/ttjug2hhi0vyt3idpe7vj1fgf29gyt0
                Both expires in 3 days

                Attachments:
                #33183
                Sergey ZAP
                Keymaster

                  Hello Marco!

                  In line 81 you use Exist method against a relative object. In this case Exist applies to the parent object, which is the same as your line 80.
                  If relative position of object “iconModify1” is different on a mobile, you need to use a different view (mobile version).
                  Also you may not get correct reading for “GetPlatformName” in line 35. You need to use Launch method first.
                  Hope this helps.

                  #33184
                  Marco Malziotti
                  Participant

                    Thankyou SergeyP
                    you confirm that to allow execution on a PC of different resolution screen, is necessary to indicate in the application (CBPRO-it in my case):
                    regexpwndclass: ApplicationFrameWindows
                    regexpwndtitle:
                    width:

                    height:

                    ?
                    And to click “iconModify1” set “Relative Object” = lblEmail and “Scalability” = “Location” in “iconModify1” object properties?
                    Thankyou
                    Marco Malziotti

                    #33185
                    Sergey ZAP
                    Keymaster

                      Hi Marco!
                      You need to use Class (“regexpwndclass”) and Title (“regexpwndtitle”) properties to uniquely identify an AUT window. Width and Height don’t matter.
                      The value that you use (regexpwndclass = ApplicationFrameWindows) is good as long as ZAPTEST focuses on your application during the test run.
                      In order to run your test on a mobile device you need ZAPTEST to focus on ZAP Viewer, and you do it correctly by updating the Class and Title properties.
                      Your main challenge is that your Registry form looks very different on a mobile device, and you can not use same “iconModify1” object for both Desktop and Mobile tests. Scalability will not help here. You need to use a different view for the mobile version of this form.

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.