info:
  name: Login - Backoffice
  type: http
  seq: 1

http:
  method: POST
  url: "{{elixFormsConsoleUrl}}/CISIInformationUnit/ExecuteTransaction.jws?IUXSID=TX_I4453_UNIPR_{{unixTimestamp}}_R{{randomRID}}"
  headers:
    - name: Host
      value: console-unipr.elixforms.it
    - name: Referer
      value: https://console-unipr.elixforms.it/backoffice/
  params:
    - name: IUXSID
      value: TX_I4453_UNIPR_{{unixTimestamp}}_R{{randomRID}}
      type: query
  body:
    type: multipart-form
    data:
      - name: username
        type: text
        value: "{{elixFormsConsoleUsername}}"
      - name: password
        type: text
        value: "{{elixFormsConsolePassword}}"
      - name: INSERT_BTN00000
        type: text
        value: Accedi
  auth: inherit

runtime:
  scripts:
    - type: after-response
      code: |-
        function generateTenDigitNumber() {
            // Minimum 10-digit number: 1000000000
            // Maximum 10-digit number: 9999999999
            const min = 1000000000; // 10^9
            const max = 9999999999; // 10^10 - 1

            // Generate random integer in range [min, max]
            const randomNum = Math.floor(Math.random() * (max - min + 1)) + min;

            return String(randomNum); // Return as string to preserve leading digits
        }

        function getRandomInt(min, max) {
          return Math.floor(Math.random() * (max - min + 1)) + min;
        }

        var unixTimestamp = Date.now();
        //console.log(unixTimestamp);
        bru.setVar("unixTimestamp", unixTimestamp);

        var r = generateTenDigitNumber(); //getRandomInt(-999999999, 9999999999);
        //console.log(r);
        bru.setVar("randomRID", r);

        /*
        const headerSetCookie = res.getHeader('set-cookie');
        console.log(headerSetCookie);

        const split1 = headerSetCookie.map(c => c.split(';')[0]);
        console.log(split1);

        const split2 = split1.map(c => c.split('='));
        console.log(split2);

        const map = new Map(split2);
        console.log(map);

        bru.setVar("elixFormsAjsrvCookie", "AJSRV=" + map.get("AJSRV"));
        bru.setVar("elixFormsJsessionidCookie", "JSESSIONID=" + map.get("JSESSIONID"));
        */

        /*
        const ajsrvCookie = bru.cookies.get("AJSRV");
        const jsessionidCookie = bru.cookies.get("JSESSIONID");

        //console.log("AJSRV: ", ajsrvCookie);
        //console.log("JSESSIONID: ", jsessionidCookie);

        bru.setVar("elixFormsAjsrvCookie", "AJSRV=" + ajsrvCookie);
        bru.setVar("elixFormsJsessionidCookie", "JSESSIONID=" + jsessionidCookie);
        */
    - type: tests
      code: |-
        test("AJSRV cookie found", function () {
          const ajsrvCookie = bru.cookies.get("AJSRV");
          expect(ajsrvCookie).to.not.be.null;
          expect(ajsrvCookie).to.not.be.empty;
        });

        test("JSESSIONID cookie found", function () {
          const jsessionidCookie = bru.cookies.get("JSESSIONID");
          expect(jsessionidCookie).to.not.be.null;
          expect(jsessionidCookie).to.not.be.empty;
        });

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: false

examples:
  - name: example
    request:
      url: https://console-unipr.elixforms.it/CISIInformationUnit/ExecuteTransaction.jws
      method: POST
      headers:
        - name: Host
          value: console-unipr.elixforms.it
        - name: Referer
          value: https://console-unipr.elixforms.it/backoffice/
      params:
        - name: IUXSID
          value: TX_I4453_UNIPR_1787737266508_R-1756946974
          type: query
          disabled: true
      body:
        type: multipart-form
        data:
          - name: username
            type: text
            value: Automation_User
          - name: password
            type: text
            value: n_HH9shL#VPeiiT^%;:t5/,jY
          - name: INSERT_BTN00000
            type: text
            value: Accedi
    response:
      status: 200
      statusText: OK
      headers:
        - name: date
          value: Wed, 26 Aug 2026 10:34:54 GMT
        - name: server
          value: '""'
        - name: content-security-policy
          value: "default-src https: data: 'unsafe-inline' 'unsafe-eval'; img-src 'self' blob: data: https:;"
        - name: x-powered-by
          value: JSP/2.2
        - name: content-type
          value: text/html;charset=UTF-8
        - name: set-cookie
          value: JSESSIONID=da31f0432559043377f947047c89; Path=/; HttpOnly
        - name: vary
          value: Accept-Encoding
        - name: strict-transport-security
          value: max-age=31536000; includeSubDomains
        - name: x-frame-options
          value: SAMEORIGIN
        - name: x-xss-protection
          value: "1"
        - name: x-content-type-options
          value: nosniff
        - name: referrer-policy
          value: unsafe-url
        - name: keep-alive
          value: timeout=10, max=500
        - name: connection
          value: Keep-Alive
        - name: transfer-encoding
          value: chunked
      body:
        type: html
        data: |+
          

















          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
             "http://www.w3.org/TR/html4/loose.dtd">
          <!-- include the local application global jsp file -->





















          <style type="text/css">
          * {
              font-family: Verdana,Arial,Helvetica,sans-serif;
              font-size: 12px;
              color: #444444;
              font-weight: normal;
          }
          .logo {padding:3em 0  0 0; margin:0;text-align:center;}
          .container {padding:0; width:30em;margin:0 auto;text-align:center;}
          h1 {font-weight:bold;margin: 2em 0 1em 0;}
          form fieldset {border: none;text-align:left;}
          form fieldset label {float:left; width:40%;display:block;text-align:right;padding: 0.3em;}
          form fieldset .fieldcontainer {float:left; width55%;}
          .end {clear:both;height:0.1em;line-height:0.1em;font-size:0.1em;width:100%}
          		</style><div class="logo"><img alt="Logo" src="/images/HeaderStemmaLogon.gif"></div><div class="container"><h1>ISIPortal - Backoffice</h1><form action="/CISIInformationUnit/ExecuteTransaction.jws?IUXSID=TX_I4453_UNIPR_1787740495631_R-970713504" method="POST" name="frmFEPA" txid="TX_I4453_UNIPR_1787740495631_R-970713504"><fieldset><label for="username">Nome Utente:</label><div class="fieldcontainer"><input class="isiportalPartialAdminFormFieldSingleLineText" id="username" name="username" type="text" value=""></div><div class="end">&nbsp;</div><label for="password">Password:</label><div class="fieldcontainer"><input class="isiportalPartialAdminFormFieldSingleLineText" id="password" name="password" type="password" value=""></div><div class="end">&nbsp;</div></fieldset><div><input class="isiportalPartialAdminINSERT_BTN00000Button" name="INSERT_BTN00000" type="submit" value="Accedi"></div></form></div>

