Automatic Visibility/Observability

 View Only
  • 1.  Side Scripts.

    Posted Thu June 08, 2023 02:33 PM

    I've been reading here: GitHub - instana/synthetic-browser-script

    GitHub remove preview
    GitHub - instana/synthetic-browser-script
    Contribute to instana/synthetic-browser-script development by creating an account on GitHub.
    View this on GitHub >

     ... and it seems like I should be able to use Selenium scripts in the Synthetic monitoring, but I'm not quite getting how to do this ... has anyone tried this?



    ------------------------------
    IBM Account
    ------------------------------


  • 2.  RE: Side Scripts.

    Posted Fri June 09, 2023 03:25 AM

    Hi stranger,

    You need to follow all the pre-requisites : install npm and nvm, and then have a driver available, personally, I'm using the chromedriver

    ❯ chromedriver
    Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 9515
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.

    Once you have that, I created a (project) directory where I saved all my Selenium IDE tests (.side files), I used the local approach:

    npm install @instana/synthetic-browser-script --save-dev

    Note that the local approach uses npx

    npx synb --help
    Options:
          --help             Show help                                     [boolean]
      -v, --version          Show version number                           [boolean]
      -f, --file             run test script
                                        [string] [default: "./user-script/index.js"]
      -b, --browser          chrome|firefox             [string] [default: "chrome"]
          --enableRecording  whether to enable recording true|false
                                                          [boolean] [default: false]
          --verbose          set verbose level, [-2, -1, 0, 1, 2, 3]. mapping {"erro
                             r": -2, "warn": -1, "info": 0, "log": 1, "debug": 2, "t
                             race": 3}                         [number] [default: 0]
          --loglevel         user script console log level, ["debug", "log", "info",
                              "warn", "error"]             [string] [default: "log"]
          --winsize          window size                      [string] [default: ""]
          --delay            delay metric collector       [boolean] [default: false]
          --url              url for ping test                [string] [default: ""]
          --side             run selenium side script     [boolean] [default: false]
          --noxvfb           disable xvfb                 [boolean] [default: false]

    And now you follow the Example Number 5

    ❯ npx synb -b chrome --side -f Ibmtest.side
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  Playback engine log level: info
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  chrome loading [/Users/israelochoa/Desktop/Synthetics/Ibmtest.side], verbose=0
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  ready to run 32254,
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  integration type is side
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  parsed script path is /Users/israelochoa/Desktop/Synthetics/DefaultSuite.test.js
    2023-06-09T07:11:16Z [SyntheticPoP] [INFO]  workdir /Users/israelochoa/Desktop/Synthetics/sbs-playback-3sw6ZB
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  Mark requests as synthetic call. Use command line to disable.
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  modheader - Default X-INSTANA-SYNTHETIC=1
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  apply header done
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  User script log level: log
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  User Script started >>>>>>>>>>

    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]  pid: 32254
    2023-06-09T07:11:18Z [SyntheticPoP] [INFO]   RUNS  Default Suite → Testing
    2023-06-09T07:11:22Z [SyntheticPoP] [INFO]  checkpoint
    2023-06-09T07:11:22Z [SyntheticPoP] [INFO]  8 har entries flushed
    2023-06-09T07:11:25Z [LOG]   User invoked driver.close. Ignore it here.
    2023-06-09T07:11:25Z [SyntheticPoP] [INFO]   PASS  Default Suite → Testing
    2023-06-09T07:11:25Z [SyntheticPoP] [INFO]  [beforeExit] pid: 32254
    2023-06-09T07:11:25Z [SyntheticPoP] [INFO]  INSIGHTS =>  Map(0) {}
    2023-06-09T07:11:25Z [SyntheticPoP] [INFO]  complete
    2023-06-09T07:11:25Z [SyntheticPoP] [INFO]  Dump browser logs.
    2023-06-09T07:11:30Z [SyntheticPoP] [INFO]  11 har entries flushed
    2023-06-09T07:11:30Z [SyntheticPoP] [INFO]  Cleanup Browser

    2023-06-09T07:11:30Z [SyntheticPoP] [INFO]  User Script finished <<<<<<<<<<

    2023-06-09T07:11:30Z [SyntheticPoP] [INFO]
     PASS  /Users/israelochoa/Desktop/Synthetics/DefaultSuite.test.js
        Default Suite
          ✓ Testing (6.457 s)

    Tests:       1 passed, 1 total
    Time:        6.457 s
    ✨ Done in 14.041 s

    I hope this helps.



    ------------------------------
    Israel Ochoa
    Technical Value Advisor - NCEE Market for IBM Instana
    IBM
    Stockholm
    ------------------------------



  • 3.  RE: Side Scripts.

    Posted Fri June 09, 2023 10:21 AM

    Hi,

      Awesome. This does help. My other question would be when the above testing is complete...is it possible to use the side file in the Instana Synthetic tests? Or does the current beta only support Node? We have quite a few side files with Selenium and it would be quite handy to use those in the Instana Cloud.

    Regards,

      Rick Mitterer 



    ------------------------------
    Rick Mitterer
    ------------------------------



  • 4.  RE: Side Scripts.

    Posted Sun June 11, 2023 08:28 AM

    Hi, Rick

    The browser test in Instana is in tech-preview and only available to IBM internal users currently, if you are able to use a browser test of Node.js script as an trial account,  yes,  you can also use a browser test of Selenium IDE script, they are both supported at the same time.

    Since we do not have UIs for setting up a browser test, you have to use Open API to create a browser test of Selenium IDE script, make sure you specify the test type as WebpageScript in test payload.



    ------------------------------
    RUI YIN
    ------------------------------