{"info":{"_postman_id":"11474d5a-c051-bffc-7f3a-7d54432fbb58","name":"AUF","description":"<html><head></head><body><h1 id=\"auto-fill-orangehrm-timesheet\">Auto Fill OrangeHRM Timesheet</h1>\n<p>This tool helps you <strong>auto-fill</strong> <del>annonying</del> <strong>timesheet</strong> in orangeHRM. It supports searching project and activity by name. Most importantly, it fills <strong>public holiday</strong> for you. Follow the instruction to setup and you are set free!</p>\n<h2 id=\"instructions\">Instructions:</h2>\n<h3 id=\"1-update-environment-variables\">1. Update environment variables</h3>\n<table>\n<tbody><tr>\n    <th>Variable</th>\n    <th>Description</th>\n    <th>Example</th>\n</tr>\n<tr>\n    <td>user</td>\n    <td><code>string</code> Your login id</td>\n    <td>eason.chan</td>\n</tr>\n<tr>\n    <td>pw</td>\n    <td><code>string</code> Your password. would be deleted after login</td>\n    <td>passw0rd</td>\n</tr>\n<tr>\n    <td>month</td>\n    <td><code>integer</code> 1 to 12</td>\n    <td>11</td>\n</tr>\n<tr>\n    <td>project</td>\n    <td><code>string</code> Project name, will read as RegExp for case-insensitive search</td>\n    <td>hactl.*lcs</td>\n</tr>\n<tr>\n    <td>activity</td>\n    <td><code>string</code> Activity name, will read as RegExp for case-insensitive search</td>\n    <td>bug fix</td>\n</tr>\n<tr>\n    <td>session</td>\n    <td><code>auto-generated</code> Your session</td>\n    <td>N/A</td>\n</tr>\n<tr>\n    <td>HRM_HOST</td>\n    <td><code>string</code> URL to the orangehrm</td>\n    <td>http://www.xxx.com/orangehrm</td>\n</tr>\n</tbody></table>\n\n\n<h3 id=\"2-click-run-for-this-collection\">2. Click Run for this collection</h3>\n<ul>\n<li>Environment: choose the one you setup</li>\n</ul>\n<h3 id=\"3-enjoy\">3. Enjoy</h3>\n<ul>\n<li>Note that submitted timesheet would be skipped</li>\n<li>For private use only</li>\n</ul>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Auto Fill OrangeHRM Timesheet","slug":"auto-fill-orangehrm-timesheet"}],"owner":"5919958","collectionId":"11474d5a-c051-bffc-7f3a-7d54432fbb58","publishedId":"RzfdrAzV","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2018-12-02T14:37:40.000Z"},"item":[{"name":"Login","event":[{"listen":"prerequest","script":{"id":"21c94148-cffe-4550-b947-5104d006d34e","exec":["var Base64={_keyStr:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",e:function(e){var t=\"\";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},d:function(e){var t=\"\";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\\r\\n/g,\"n\");var t=\"\";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t=\"\";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}","","// wipe working env variable.","postman.clearEnvironmentVariable(\"token\");","postman.clearEnvironmentVariable(\"txtStartDate\");","postman.clearEnvironmentVariable(\"txtEndDate\");","postman.clearEnvironmentVariable(\"timesheetIds\");","postman.clearEnvironmentVariable(\"timesheetId\");","postman.clearEnvironmentVariable(\"employeeId\");","postman.clearEnvironmentVariable(\"holidayList\");","postman.clearEnvironmentVariable(\"projectId\");","postman.clearEnvironmentVariable(\"activityId\");","postman.clearEnvironmentVariable(\"hdnGridCount\");","postman.clearEnvironmentVariable(\"pw3\");","postman.clearEnvironmentVariable(\"verifyList\");","postman.clearEnvironmentVariable(\"STATUS\");","postman.clearEnvironmentVariable(\"tempTxtEndDate\");","postman.clearEnvironmentVariable(\"tempTxtStartDate\");","","for (var i=0; i<=6; i++){","    postman.clearEnvironmentVariable(\"hdnReportedDate\" + i);","    postman.clearEnvironmentVariable(\"duration0\" + i);","    postman.clearEnvironmentVariable(\"duration1\" + i);","    postman.clearEnvironmentVariable(\"cmbActivity\" + i);","    postman.clearEnvironmentVariable(\"cmbProject\" + i);","}","","s = postman.getEnvironmentVariable(\"session\")","ns = postman.getEnvironmentVariable(\"nSession\")","pw = postman.getEnvironmentVariable(\"pw\")","u = postman.getEnvironmentVariable(\"user\")","","if (s) pw = decodeURIComponent(Base64.d(s)).slice(u.length);","postman.setEnvironmentVariable(\"pw3\", pw)","    "],"type":"text/javascript"}},{"listen":"test","script":{"id":"d2cacc41-4830-4eae-b14a-db4ace182f50","exec":["var pw = postman.getEnvironmentVariable(\"pw\")","var pw3 = postman.getEnvironmentVariable(\"pw3\")","var s = postman.getEnvironmentVariable(\"session\")","var month = postman.getEnvironmentVariable(\"month\")","isLoggedIn = responseBody.has(\"Welcome \")","","var Base64={_keyStr:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",e:function(e){var t=\"\";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},d:function(e){var t=\"\";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\\r\\n/g,\"n\");var t=\"\";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t=\"\";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}","","if (!month","        || !postman.getEnvironmentVariable(\"user\")","        || !pw3){","    tests[\"Please specify your Environment!\"] = 0","    tests[\"- user: your login id\"] = 0","    tests[\"- pw: your password\"] = 0","    tests[\"- month: 1 to 12\"] = 0","    tests[\"- project: project name\"] = 0","    tests[\"- activity: activity name\"] = 0","    tests[\"For detail, please read the collection instruction\"] = 1","    postman.setNextRequest(null)","    ","} else if (!isLoggedIn){","    tests[\"Invalid user/password.\"] = 0","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"A10\", msg: \"Invalid user / password.\"}))","        ","    postman.clearEnvironmentVariable(\"pw3\")","    postman.clearEnvironmentVariable(\"session\");","    if (s != null) {","        postman.setEnvironmentVariable(\"pw\", \"\");","    }","    postman.setNextRequest(null)","    ","} else {","    tests[\"Logged in successfully.\"] = 1","    // A0. Greeting","    regex = /Welcome (\\w+)/","    match = regex.exec(responseBody)","    yourName = match[1]","    ","    date = new Date()","    date.setUTCHours(8,0,0,0)","    ","    // if it is Janurary and filling for last Decemeber","    // Put last year","    if (date.getMonth() == 0 && month == 12){","        date.setFullYear(date.getFullYear() - 1);","    }","    ","    date.setMonth(month - 1)","    dateString = date.toISOString().slice(0, 7)","    tests[\"Welcome, \" + yourName + \"!\"] = 1","    tests[\"You're now auto-filling for \" + dateString + \".\"] = 1","    ","    ","    // A1. grep for employeeId","    regex = /employeeId=(\\d+)/","    match = regex.exec(responseBody)","    employeeId = match[1]","    postman.setEnvironmentVariable(\"employeeId\", employeeId);","    tests[\"OK. Your employeeId is \" + employeeId + \".\"] = true","    ","    ","    // A2. ","    // get first sunday of input month and","    // set txtEndDate to 2 weeks ago","    u = postman.getEnvironmentVariable(\"user\")","    y = date.getFullYear()","    m = date.getMonth()","    ","    prevSunday = new Date(y, m, 1) // first day in month","    prevSunday.setUTCHours(8,0,0,0)","    while (prevSunday.getDay() != 0){","        prevSunday.setDate(prevSunday.getDate() + 1)","    } ","    ","    prevSunday.setDate(prevSunday.getDate() - 15) // 2 weeks ago, + 1 week from pre-request of FetchNextTimesheet, + 1 week from FetchNextTimesheet logic itself","    prevSunday = prevSunday.toISOString().slice(0, 10)","    ","    postman.setEnvironmentVariable(\"txtEndDate\", prevSunday)","    postman.setEnvironmentVariable(\"session\", Base64.e(encodeURIComponent(u+pw3)))","    postman.clearEnvironmentVariable(\"pw\")","    postman.clearEnvironmentVariable(\"pw3\");","    console.log(\"[Login] Prearing txtEndDate:\", prevSunday)","    ","    postman.setNextRequest(\"Validate_Project\")","}"],"type":"text/javascript"}}],"id":"9facef22-ed5b-8b13-d75f-cb4c0aab8c5f","request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"actionID","value":"chkAuthentication","type":"text"},{"key":"hdnUserTimeZoneOffset","value":"8","type":"text"},{"key":"txtUserName","value":"{{user}}","type":"text"},{"key":"txtPassword","value":"{{pw3}}","type":"text"}]},"url":"{{HRM_HOST}}/login.php?actionID=chkAuthentication&hdnUserTimeZoneOffset=8&txtUserName={{user}}&txtPassword={{pw3}}","description":"<ul>\n<li>Login with <code>user</code> and <code>pw</code></li>\n<li>Produce <code>employeeId</code> working variables</li>\n<li>Creates <code>session</code> to encrypt credentials</li>\n</ul>\n","urlObject":{"path":["login.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"actionID","value":"chkAuthentication"},{"key":"hdnUserTimeZoneOffset","value":"8"},{"key":"txtUserName","value":"{{user}}"},{"key":"txtPassword","value":"{{pw3}}"}],"variable":[]}},"response":[],"_postman_id":"9facef22-ed5b-8b13-d75f-cb4c0aab8c5f"},{"name":"Validate_Project","event":[{"listen":"test","script":{"id":"dc84bdc1-3ba1-4306-a567-9cf582da4028","exec":["// Validate Input","var project = postman.getEnvironmentVariable(\"project\")","// project = \"145\"","projectRegex = new RegExp(project, \"i\")","","// B1. Validate Project Id","const projectsMap = {}","","// <option value=\"20\">XXX - 015 - XXXXX</option>","regex = /<option value=\"\\d+\">.*<.option>/g","matches = responseBody.match(regex)","console.log(\"[ValidateProject] Sample check:\", matches[1])","","","regex = /value=\"(\\d+)\">(.*)<.option>/","matches.map(item => regex.exec(item)) ","    .filter(match => match != null)","    .filter(match => projectRegex.test(match[2])) // match user's input","    .forEach(match => {projectsMap[match[1]] = match[2]}) ","resolvedCnt = Object.keys(projectsMap).length;","console.log(\"[ValidateProject]\", \"Resolved:\", resolvedCnt, JSON.stringify(projectsMap))","","","if (resolvedCnt == 0){","    // Sorry, no project can be found.","    tests[\"No projects found with '\" + project + \"'\"] = 0","    postman.setNextRequest(\"Logout\")","    ","} else if (resolvedCnt > 1){","    // more than 1 record","    tests[ resolvedCnt + \" projects found with '\" + project + \"'\"] = 0 ","    tests[\"Modify 'project' env var to match 1 record only.\"] = 0","    tests[\"Matching projects:\"] = 0","    i = 0","    ","    values = Object.values(projectsMap).sort()","    for (var p in values){","        if (++i > 150){","            tests[\"(only first 150 projects displayed here)\"] = 0","            break;","        }","        tests[\">> \" + values[p]] = 0","    }","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"B20\", msg: resolvedCnt + \" projects found. Please choose one of them.\"}))","    postman.setNextRequest(\"Logout\")","} else if (resolvedCnt == 1){","    // only 1 record","    var k = Object.keys(projectsMap)[0]","    var v = projectsMap[k]","    console.log(\"[ValidateProject] selected:\", k, v)","    tests[\"Selected project \" + k + \": \" + v] = 1","    postman.setEnvironmentVariable(\"projectId\", k);","    postman.setEnvironmentVariable(\"project\", v); // update user's input","    postman.setNextRequest(\"Validate_Activity\")","} else {","    // unknown err","    tests[\"Unknow err\"] = 0","    postman.setNextRequest(null)","}"],"type":"text/javascript"}}],"id":"fcf7f8d5-d4af-b2d8-bec0-b34fada36204","request":{"method":"GET","header":[],"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=View_Edit_Timesheet&id=1","description":"<ul>\n<li>Search any projects can be found with <code>project</code></li>\n<li>Produce <code>projectId</code> working variable</li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"View_Edit_Timesheet"},{"key":"id","value":"1"}],"variable":[]}},"response":[],"_postman_id":"fcf7f8d5-d4af-b2d8-bec0-b34fada36204"},{"name":"Validate_Activity","event":[{"listen":"test","script":{"id":"23c26b5b-7ca1-4684-83ce-4a0fcd2e273e","exec":["var activity = postman.getEnvironmentVariable(\"activity\")","actRegex = new RegExp(activity, \"i\")","","// B2. Validate Activity","const actMap = {}","","regex = /(.*)%(\\d+)/","matches = responseBody.split(\";\") ","console.log(\"[ValidateActivity] Sample check:\", matches[1])","","","matches.map(item => regex.exec(item)) // \"01 Project Management%1466\"","    .filter(match => match != null)","    .filter(match => actRegex.test(match[1])) // match user's input","    .forEach(match => {actMap[match[2]] = match[1]}) // {1466: \"01 Project Management\"}","resolvedCnt = Object.keys(actMap).length;","console.log(\"[ValidateActivity]\", \"Resolved:\", resolvedCnt, JSON.stringify(actMap))","","","if (resolvedCnt == 0){","    // Sorry, no activities can be found.","    tests[\"No activities found with '\" + activity + \"'\"] = 0","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"C20\", msg: \"Sorry, no activities found.\"}))","    postman.setNextRequest(\"Logout\")","    ","} else if (resolvedCnt > 1){","    // more than 1 record","    tests[ resolvedCnt + \" activities found with '\" + activity + \"'\"] = 0","    tests[\"Modify 'activity' env var to match 1 record only.\"] = 0","    tests[\"Matching activities:\"] = 0","    i = 0","    ","    values = Object.values(actMap).sort()","    for (var p in values){","        if (++i > 20){","            tests[\"(only first 20 activities displayed here)\"] = 0","            break;","        }","        tests[\">> \" + values[p]] = 0","    }","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"C21\", msg: resolvedCnt + \" activities found. Please choose 1.\"}))","    postman.setNextRequest(\"Logout\")","    ","} else if (resolvedCnt == 1){","    // only 1 record, proceed to get HK holiday","    var k = Object.keys(actMap)[0]","    var v = actMap[k]","    console.log(\"[ValidateActivity] selected:\", k, v)","    tests[\"Selected activity \" + k + \": \" + v] = 1","    postman.setEnvironmentVariable(\"activityId\", k);","    postman.setEnvironmentVariable(\"activity\", v); // update user's input","    postman.setNextRequest(\"HK_Holiday\")","} else {","    // unknown err","    tests[\"Unknow err\"] = 0","    postman.setNextRequest(null)","}"],"type":"text/javascript"}}],"id":"f5ae3ca3-6507-eb67-0486-117d58b0b24c","request":{"method":"GET","header":[],"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=Timegrid_Fetch_Activities&projectId={{projectId}}","description":"<ul>\n<li>Search any <code>activity</code> can be found within the project</li>\n<li>Produce <code>activityId</code> working variable</li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"Timegrid_Fetch_Activities"},{"key":"projectId","value":"{{projectId}}"}],"variable":[]}},"response":[],"_postman_id":"f5ae3ca3-6507-eb67-0486-117d58b0b24c"},{"name":"HK_Holiday","event":[{"listen":"test","script":{"id":"997c401a-a91f-4356-86f9-521b5440355b","exec":["var txtEndDate = postman.getEnvironmentVariable(\"txtEndDate\")","","// B1. Get Gazetted Holidays","tempMonth = new Date(txtEndDate)","tempMonth.setMonth(tempMonth.getMonth() + 1)","tempMonth.setUTCHours(8,0,0,0)","secondMonth = tempMonth.toISOString().slice(0, 7).replace(\"-\", \"\")","","tempMonth.setMonth(tempMonth.getMonth() + 1)","thirdMonth = tempMonth.toISOString().slice(0, 7).replace(\"-\", \"\")","","// B2. Perform regex search for .ics","ymString = \"(\" + secondMonth + \"|\" + thirdMonth + \")\"","regex = new RegExp(\"DTSTART.*\" + ymString + \"\\\\d\\\\d\",\"g\")","matches = responseBody.match(regex)","console.log(regex, matches)","holidayList = matches ? matches.map(m => {","    ds = m.slice(-8); // 20181001","    var d = new Date(ds.slice(0,4), ds.slice(4,6) - 1, ds.slice(6), 12, 0, 0)","    d.setUTCHours(8,0,0,0) // 2018-10-01T08:00:00.000Z","    return d.toISOString().slice(0, 10) // 2018-10-01","}) : []","","// B3. Display output and save results","console.log(\"[HKHoliday]\", holidayList)","if (holidayList.length == 0)","    tests[\"No Holiday between \" + secondMonth + \" and \" + thirdMonth + \".\"] = 1","else","    tests[\"Holiday List: \" + JSON.stringify(holidayList, null, 2)] = 1","","// B4. Proceed ","if (responseBody.has(\"BEGIN:VCALENDAR\")){","    postman.setEnvironmentVariable(\"holidayList\", JSON.stringify(holidayList, null, 2));","    postman.setEnvironmentVariable(\"tempTxtEndDate\", txtEndDate)","    postman.setNextRequest(\"Pre_Fetch_Timesheet\")","} else {","    tests[\"Unable to fetch HK Public Holidays\"] = 0","    postman.setNextRequest(\"Logout\")","}"],"type":"text/javascript"}}],"id":"838bf602-edd5-bc92-d415-24dc9f92b206","request":{"method":"GET","header":[],"url":"http://www.1823.gov.hk/common/ical/tc.ics","description":"<ul>\n<li>Get HK holiday for the month and the month after it</li>\n<li>Produce <code>holidayList</code> working variable</li>\n</ul>\n","urlObject":{"protocol":"http","path":["common","ical","tc.ics"],"host":["www","1823","gov","hk"],"query":[],"variable":[]}},"response":[],"_postman_id":"838bf602-edd5-bc92-d415-24dc9f92b206"},{"name":"Pre_Fetch_Timesheet","event":[{"listen":"prerequest","script":{"id":"b3c1ec92-b38e-4d2d-8442-11e713169722","exec":["var txtEndDate = postman.getEnvironmentVariable(\"tempTxtEndDate\");","","// C0. Iternate txtEndDate","var c = new Date(txtEndDate)","c.setDate(c.getDate() + 1)","c.setUTCHours(8,0,0,0)","var nextSunday = c.toISOString().slice(0, 10);","","var d = new Date(txtEndDate)","d.setDate(d.getDate() + 7)","d.setUTCHours(8,0,0,0)","var nextSaturday = d.toISOString().slice(0, 10);","","postman.setEnvironmentVariable(\"tempTxtStartDate\", nextSunday)","postman.setEnvironmentVariable(\"tempTxtEndDate\", nextSaturday)",""],"type":"text/javascript"}},{"listen":"test","script":{"id":"f35e20fd-ec19-4347-b3c5-c63631457424","exec":["tests[responseBody] = true // HTML","","var txtStartDate = postman.getEnvironmentVariable(\"tempTxtStartDate\"),","    txtEndDate = postman.getEnvironmentVariable(\"tempTxtEndDate\"),","    autoFillMonth = postman.getEnvironmentVariable(\"month\")","console.log(\"[PreFetchTimesheet] Input:\", txtStartDate, txtEndDate)","","// C1. Plausibility check: getting too far away","expectedDateShown = new Date(txtEndDate)","expectedDateShown.setDate(expectedDateShown.getDate() + 3)","expectedDateShown.setUTCHours(8,0,0,0)","cp = responseBody.has(expectedDateShown.toISOString().slice(0, 10))","","regex = /next.startDate = '([0-9\\-]+)/","match = regex.exec(responseBody)","nextStartDate = match[1]","","maxStart = new Date()","maxStart.setDate(1)","maxStart.setMonth(autoFillMonth)","maxStart.setUTCHours(8,0,0,0)","maxStart = maxStart.toISOString().slice(0, 10)","","// I2. Loop this request until next start date exceed autofill month","","console.log(\"[PreFetchTimesheet] maxStart:\", maxStart, \", nextStartDate:\", nextStartDate, \", \",  nextStartDate > maxStart)","","if (nextStartDate < maxStart){","    console.log(\"[PreFetchTimesheet] loop again until end of month...\")","    postman.setNextRequest(\"Pre_Fetch_Timesheet\")","    ","} else {","    console.log(\"[PreFetchTimesheet] STOPSTOPSTOP! Should go \\\"fetch next timesheet\\\"...\")","    // postman.clearEnvironmentVariable(\"tempTxtEndDate\");","    // postman.clearEnvironmentVariable(\"tempTxtStartDate\");","    tests[\"Should go next action\"] = true","    postman.setNextRequest(\"Fetch_Next_Timesheet\")","    ","}",""],"type":"text/javascript"}}],"id":"a0d5711e-d425-403f-9245-0fb55d29df7b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"txtEmployeeId","value":"{{employeeId}}","type":"text"},{"key":"txtTimesheetPeriodId","value":"1","type":"text"},{"key":"txtStartDate","value":"{{tempTxtStartDate}}","type":"text"},{"key":"txtEndDate","value":"{{tempTxtEndDate}}","type":"text"}]},"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=View_Timesheet","description":"<p>EL20190303</p>\n<ul>\n<li>Self-iterate until next week timesheet is another month</li>\n<li>Pre-fetch to ensure Fetch_Next_Timesheet without error</li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"View_Timesheet"}],"variable":[]}},"response":[],"_postman_id":"a0d5711e-d425-403f-9245-0fb55d29df7b"},{"name":"Fetch_Next_Timesheet","event":[{"listen":"prerequest","script":{"id":"a40f1ba3-a459-48a6-ac92-39a941b7870a","exec":["var txtEndDate = postman.getEnvironmentVariable(\"txtEndDate\")","","// C0. Iternate txtEndDate","var d = new Date(txtEndDate)","d.setDate(d.getDate() + 7)","d.setUTCHours(8,0,0,0)","var nextSunday = d.toISOString().slice(0, 10);","","postman.setEnvironmentVariable(\"txtStartDate\", txtEndDate)","postman.setEnvironmentVariable(\"txtEndDate\", nextSunday)",""],"type":"text/javascript"}},{"listen":"test","script":{"id":"52771fae-970f-419f-a986-0c989ee25242","exec":["tests[responseBody] = true // HTML","","var timesheetIds = postman.getEnvironmentVariable(\"timesheetIds\"),","    txtStartDate = postman.getEnvironmentVariable(\"txtStartDate\"),","    txtEndDate = postman.getEnvironmentVariable(\"txtEndDate\"),","    autoFillMonth = postman.getEnvironmentVariable(\"month\")","console.log(\"[FetchNextTimesheet] Input:\", txtStartDate, txtEndDate)","","// C1. Plausibility check: getting too far away","expectedDateShown = new Date(txtEndDate)","expectedDateShown.setDate(expectedDateShown.getDate() + 3)","expectedDateShown.setUTCHours(8,0,0,0)","cp = responseBody.has(expectedDateShown.toISOString().slice(0, 10))","","if (!cp){","    console.log(\"[FetchNextTimesheet]\", \"too far away, lead to logout now..\")","    tests[\"Fail to fetch. Are you trying to fill a month too far away?\"]=0","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"E10\", msg: \"Fail to fetch timesheet.\"}))","    postman.setNextRequest(\"Logout\")","    ","} else {","","    // C2. grep week, timeSheetId and nextStartDate","    regex = /txtTimesheetId..value=.(\\d+)/","    match = regex.exec(responseBody)","    timesheetId = match[1]","    ","    regex = /Timesheet for week starting ([0-9\\-]+)/","    match = regex.exec(responseBody)","    processingWeek = match[1]","    ","    regex = /next.startDate = '([0-9\\-]+)/","    match = regex.exec(responseBody)","    nextStartDate = match[1]","    ","    regex = /Not submitted/","    match = regex.exec(responseBody)","    isSubmitted = (match == null)","    ","    ","    // C3. add current timesheetId to list for filling","    tests[\"Getting week \" + processingWeek + \": \" + timesheetId] = true","    console.log(\"[FetchNextTimesheet]\", \"Getting week \" + processingWeek + \": \" + timesheetId)","    ","    if (isSubmitted){","        tests[\"... SKIP! This week has been submitted. \" + processingWeek] = 1","    } else {","    ","        if (timesheetIds == null || timesheetIds.length == 0){","            vo = {}","            vo[timesheetId] = processingWeek","            timesheetIds = [vo]","        } else {","            timesheetIds = JSON.parse(timesheetIds)","            ","            // prevent duplicate entry","            isDuplicate = timesheetIds","                .map(v => Object.keys(v)[0])","                .filter(v => v == timesheetId)","                .length >= 1","            if (!isDuplicate){","                vo = {}","                vo[timesheetId] = processingWeek","                timesheetIds.push(vo)","            }","        }","        postman.setEnvironmentVariable(\"timesheetIds\", JSON.stringify(timesheetIds, null, 2));","        console.log(\"[FetchNextTimesheet] TimesheetIds: \" + JSON.stringify(timesheetIds))","    }","    ","    ","    // C4. Loop this request until next start date exceed autofill month","    nextStartDate = new Date(nextStartDate)","    console.log(\"[FetchNextTimesheet] aufmonth-1:\", autoFillMonth-1, \"nextstartdate:\",nextStartDate.getMonth(), \"timesheetIds==null: \", timesheetIds == null)","    ","    if (nextStartDate.getMonth() == autoFillMonth - 1){","        console.log(\"[FetchNextTimesheet] loop again until end of month...\")","        postman.setNextRequest(\"Fetch_Next_Timesheet\")","        ","    } else if (!timesheetIds || timesheetIds.length == 0){","        // nothing needed to fill...","        console.log(\"[FetchNextTimesheet] Should go logout page now...\")","        tests[\"Nothing needed to fill for this month!\"] = true","        postman.setNextRequest(\"Logout\")","        ","    } else {","        console.log(\"[FetchNextTimesheet] STOPSTOPSTOP! Should go \\\"update timesheet grid\\\"...\")","        tests[\"TimesheetIds: \" + JSON.stringify(timesheetIds)] = true","        postman.setNextRequest(\"Update_Timesheet_Grid\")","    }","}","",""],"type":"text/javascript"}}],"id":"1e7ac0cb-117d-f9ec-ac26-8baae6dfd386","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"txtStartDate","value":"{{txtStartDate}}","type":"text"},{"key":"txtEndDate","value":"{{txtEndDate}}","type":"text"}]},"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=Fetch_Next_Timesheet&txtEmployeeId={{employeeId}}","description":"<ul>\n<li>Self-iterate until next timesheet is another month</li>\n<li>collect all timesheetId into <code>timesheetIds</code> list</li>\n<li><strong>Submitted timesheets are ignored</strong></li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"Fetch_Next_Timesheet"},{"key":"txtEmployeeId","value":"{{employeeId}}"}],"variable":[]}},"response":[],"_postman_id":"1e7ac0cb-117d-f9ec-ac26-8baae6dfd386"},{"name":"Update_Timesheet_Grid","event":[{"listen":"prerequest","script":{"id":"cf6d809d-bd3c-4ef7-af57-f16e2e95428f","exec":["var timesheetIds = postman.getEnvironmentVariable(\"timesheetIds\")","var token = postman.getEnvironmentVariable(\"token\")","var holidayList = postman.getEnvironmentVariable(\"holidayList\")","timesheetIds = JSON.parse(timesheetIds)","holidayList = JSON.parse(holidayList)","vo = timesheetIds.shift()","hasHoliday = false","console.log(JSON.stringify(timesheetIds), holidayList)","","// D0. Go to \"Tests - After Response\" to get token","// return","","// D1. Prepare form inputs","timesheetId = Object.keys(vo)[0]","txtStartDate = vo[timesheetId]","postman.setEnvironmentVariable(\"timesheetId\", timesheetId)","postman.setEnvironmentVariable(\"txtStartDate\", txtStartDate)","console.log(\"[UpdateTimesheetGrid]\", timesheetId, txtStartDate)","","","var tempDate = new Date(txtStartDate), dateString = \"\"","tempDate.setUTCHours(8,0,0,0)","for (var i=0;i<=6;i++){","    if (i > 0) tempDate.setDate(tempDate.getDate() + 1)","    ","    var dateString = tempDate.toISOString().slice(0, 10)","    postman.setEnvironmentVariable(\"hdnReportedDate\" + i, dateString)","    ","    if (i < 1 || i > 5 || token == null) continue;","    console.log(\"[UpdateTimesheetGrid]\", \"processing for\", i, \":\", dateString)","    ","    // D2. weekday - Check holiday ","    if(holidayList.includes(dateString)){","        hasHoliday = true","        postman.setEnvironmentVariable(\"duration0\" + i, 0)","        postman.setEnvironmentVariable(\"duration1\" + i, 8)","        ","    } else {","        postman.setEnvironmentVariable(\"duration0\" + i, 8)","        postman.setEnvironmentVariable(\"duration1\" + i, 0)","    }","}","","","postman.setEnvironmentVariable(\"txtEndDate\", dateString)","postman.setEnvironmentVariable(\"cmbProject0\", 207)","postman.setEnvironmentVariable(\"cmbActivity0\", 1689)","","if (hasHoliday){","    postman.setEnvironmentVariable(\"hdnGridCount\", 2)","    // Office - Office - leaves","    postman.setEnvironmentVariable(\"cmbProject1\", 111) ","    // Public Hoidays","    postman.setEnvironmentVariable(\"cmbActivity1\", 648)","} else {","    postman.setEnvironmentVariable(\"hdnGridCount\", 1)","    postman.setEnvironmentVariable(\"cmbProject1\", \"\")","    postman.setEnvironmentVariable(\"cmbActivity1\", \"\")","    ","    for (var i=1; i<=5; i++){","        postman.setEnvironmentVariable(\"duration1\" + i, \"\")","    }","}","",""],"type":"text/javascript"}},{"listen":"test","script":{"id":"8fdb1cef-a55f-4387-857a-818e37ace768","exec":["var txtStartDate = postman.getEnvironmentVariable(\"txtStartDate\")","var timesheetIds = postman.getEnvironmentVariable(\"timesheetIds\")","","// D0. Renew Token","if (responseBody.has(\"Failed to update\")){","    // capture token and replay","    regex = /value=\"([\\d\\w]+)\" name=\"token\"/","    match = regex.exec(responseBody)","    token = match[1]","    ","    console.log(\"[UpdateTimesheetGrid] get token:\", token)","    tests[\"Get Token: \" + token] = true","    postman.setEnvironmentVariable(\"token\", token)","    postman.setNextRequest(\"Update_Timesheet_Grid\") // retry","    ","} else if (responseBody.has(\"Successfully updated\")){","    tests[\"Auto filled for week: \" + txtStartDate] = 1","    ","    // D3. submit the timesheet","    postman.setEnvironmentVariable(\"token\", null)","    postman.setNextRequest(\"Submit_Timesheet\")","","} else {","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"F10\", msg: \"Error - F10\"}))","    tests[\"D3. Huh? Please contact system administrator.\"] = 0;","    postman.setNextRequest(\"Logout\")","}","",""],"type":"text/javascript"}}],"id":"059ee8a8-65ad-254c-179e-acee0bbae270","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"token","value":"{{token}}","type":"text"},{"key":"hdnReportedDate-0","value":"{{hdnReportedDate0}}","type":"text"},{"key":"hdnReportedDate-1","value":"{{hdnReportedDate1}}","type":"text"},{"key":"hdnReportedDate-2","value":"{{hdnReportedDate2}}","type":"text"},{"key":"hdnReportedDate-3","value":"{{hdnReportedDate3}}","type":"text"},{"key":"hdnReportedDate-4","value":"{{hdnReportedDate4}}","type":"text"},{"key":"hdnReportedDate-5","value":"{{hdnReportedDate5}}","type":"text"},{"key":"hdnReportedDate-6","value":"{{hdnReportedDate6}}","type":"text"},{"key":"cmbProject-0","value":"{{cmbProject0}}","type":"text"},{"key":"cmbActivity-0","value":"{{cmbActivity0}}","type":"text"},{"key":"txtDuration-0-0","value":"","type":"text"},{"key":"txtComment-0-0","value":"","type":"text"},{"key":"txtDuration-0-1","value":"{{duration01}}","type":"text"},{"key":"txtComment-0-1","value":"","type":"text"},{"key":"txtDuration-0-2","value":"{{duration02}}","type":"text"},{"key":"txtComment-0-2","value":"","type":"text"},{"key":"txtDuration-0-3","value":"{{duration03}}","type":"text"},{"key":"txtComment-0-3","value":"","type":"text"},{"key":"txtDuration-0-4","value":"{{duration04}}","type":"text"},{"key":"txtComment-0-4","value":"","type":"text"},{"key":"txtDuration-0-5","value":"{{duration05}}","type":"text"},{"key":"txtComment-0-5","value":"","type":"text"},{"key":"txtDuration-0-6","value":"","type":"text"},{"key":"txtComment-0-6","value":"","type":"text"},{"key":"txtEmployeeId","value":"{{employeeId}}","type":"text"},{"key":"txtTimesheetId","value":"{{timesheetId}}","type":"text"},{"key":"txtStartDate","value":"{{txtStartDate}}","type":"text"},{"key":"txtEndDate","value":"{{txtEndDate}}","type":"text"},{"key":"hdnGridCount","value":"{{hdnGridCount}}","type":"text"},{"key":"hdnDatesCount","value":"7","type":"text"},{"key":"hdnShowComments","value":"No","type":"text"},{"key":"txtDuration-1-1","value":"{{duration11}}","type":"text"},{"key":"txtDuration-1-2","value":"{{duration12}}","type":"text"},{"key":"txtDuration-1-3","value":"{{duration13}}","type":"text"},{"key":"txtDuration-1-4","value":"{{duration14}}","type":"text"},{"key":"txtDuration-1-5","value":"{{duration15}}","type":"text"},{"key":"cmbProject-1","value":"{{cmbProject1}}","type":"text"},{"key":"cmbActivity-1","value":"{{cmbActivity1}}","type":"text"},{"key":"txtComment-1-1","value":"","type":"text"},{"key":"txtComment-1-2","value":"","type":"text"},{"key":"txtComment-1-0","value":"","type":"text"},{"key":"txtComment-1-3","value":"","type":"text"},{"key":"txtComment-1-4","value":"","type":"text"},{"key":"txtComment-1-5","value":"","type":"text"},{"key":"txtComment-1-6","value":"","type":"text"},{"key":"txtDuration-1-0","value":"","type":"text"},{"key":"txtDuration-1-6","value":"","type":"text"}]},"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=Update_Timeesheet_Grid","description":"<p>For each <code>timesheetIds</code></p>\n<ul>\n<li>auto fill timesheet for 40 hours a week</li>\n<li>auto fill public holiday for 8 hours</li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"Update_Timeesheet_Grid"}],"variable":[]}},"response":[],"_postman_id":"059ee8a8-65ad-254c-179e-acee0bbae270"},{"name":"Submit_Timesheet","event":[{"listen":"test","script":{"id":"08fce3d6-d4f4-43e4-a9d8-e0d2bc070a10","exec":["var txtStartDate = postman.getEnvironmentVariable(\"txtStartDate\")","var timesheetId = postman.getEnvironmentVariable(\"timesheetId\")","var timesheetIds = postman.getEnvironmentVariable(\"timesheetIds\")","var verifyList = postman.getEnvironmentVariable(\"verifyList\")","isThisWeekError = false","","if (!responseBody.has(\"Submit failed\") ","        && !responseBody.has(\"succeeded\") ) {","    postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"G10\", msg: \"Error - G10\"}))","    tests[\"E3. Huh? Please contact system administrator. \"] = 0;","    postman.setNextRequest(null)","}","","if (responseBody.has(\"Submit failed\")){","    regex = /<th >([\\d]+)<.th>/g","    matches = responseBody.match(regex)","    matches = matches[matches.length - 1]","    match = regex.exec(matches)","    total = match[1]","    ","    if (total == 40){","        // E0. Renew Token","        // capture token and replay","        regex = /value=\"([\\d\\w]+)\" name=\"token\"/","        match = regex.exec(responseBody)","        token = match[1]","        ","        console.log(\"[SubmitTimesheet] get token:\", token)","        tests[\"Submit Token: \" + token] = true","        postman.setEnvironmentVariable(\"token\", token)","        postman.setNextRequest(\"Submit_Timesheet\")","        ","    } else {","        // E1. Something wrong with total working hours","        tests[\"Total working hrs of wk \"+ txtStartDate + \" is \" + total + \". Please manual update yourself.\"] = 0","        postman.setEnvironmentVariable(\"STATUS\", JSON.stringify({code: \"G20\", msg: \"Total working hours exceed 40. Manual update yourself.\"}))","        console.log(\"[SubmitTimesheet] Found\", total, \". proceed for next week.\")","        isThisWeekError = true","    }","}","","if (responseBody.has(\"succeeded\") || isThisWeekError){","    // E2. Pop update list and add to verify list","    timesheetIds = JSON.parse(timesheetIds)","    timesheetIds.shift()","    postman.setEnvironmentVariable(\"timesheetIds\", JSON.stringify(timesheetIds, null, 2))","    ","    verifyList = (verifyList != null)","        ? JSON.parse(verifyList)","        : []","    ","    if (!verifyList.includes(timesheetId))","        verifyList.push(timesheetId)","    postman.setEnvironmentVariable(\"verifyList\", JSON.stringify(verifyList, null, 2))","    ","    if (!isThisWeekError)","        tests[\"Submitted for week: \" + txtStartDate] = 1","    ","    // E2. repeat until no more timesheetIds","    if (timesheetIds.length >= 1){","        postman.setEnvironmentVariable(\"token\", null)","        postman.setNextRequest(\"Update_Timesheet_Grid\")","    } else {","        postman.setNextRequest(\"Verify_Timesheet\")","    }","}","","","",""],"type":"text/javascript"}}],"id":"53f9e469-2ffc-293a-a335-0936e47b9cc7","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"token","value":"{{token}}","type":"text"},{"key":"txtEmployeeId","value":"{{employeeId}}","type":"text"},{"key":"txtTimesheetId","value":"{{timesheetId}}","type":"text"},{"key":"txtStartDate","value":"{{txtStartDate}}","type":"text"},{"key":"txtEndDate","value":"{{txtEndDate}}","type":"text"}]},"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=Submit_Timesheet","description":"<p>For each <code>timesheetIds</code></p>\n<ul>\n<li>submit the timesheet</li>\n</ul>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"Submit_Timesheet"}],"variable":[]}},"response":[],"_postman_id":"53f9e469-2ffc-293a-a335-0936e47b9cc7"},{"name":"Verify_Timesheet","event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["var verifyList = postman.getEnvironmentVariable(\"verifyList\")","","// F1. Pop list to get first timesheetId","verifyList = JSON.parse(verifyList)","timesheetId = verifyList.pop()","postman.setEnvironmentVariable(\"verifyList\", JSON.stringify(verifyList, null, 2))","postman.setEnvironmentVariable(\"timesheetId\", timesheetId);"]}},{"listen":"test","script":{"type":"text/javascript","exec":["var verifyList = postman.getEnvironmentVariable(\"verifyList\")","verifyList = JSON.parse(verifyList)","","space = \"\"","for (var i=0; i<verifyList.length; i++) space += \" \"","","// F2. Verify timesheet","regex = /Timesheet.*starting.([\\d-]+)/","match = regex.exec(responseBody)","week = match[1]","","tests[\"Verifying Week: \" + week + \"...\"] = 1","console.log(\"[VerifyTimesheet]\", \"verifiying week:\", week)","","    // F2.1. submitted","regex = /Status: Submitted/","match = regex.exec(responseBody)","tests[\"> Submitted\" + space] = match != null","","    // F2.2. total >= 40","regex = /<th >([\\d]+)<.th>/g","matches = responseBody.match(regex)","matches = matches[matches.length - 1]","match = regex.exec(matches)","total = match[1]","tests[\"> Total Working Hours = \" + total + space] = total >= 40","","    // F2.3. Project","regex = /<td >([^0-9].*)<.td>/g","matches = responseBody.match(regex)","regex = /<td >(.*)<.td>/","matches = matches.map(m => regex.exec(m))","    .map(match => match[1])","// match = regex.exec(matches)","console.log(\"[VerifyTimesheet]\",\"Projects:\", JSON.stringify(matches))","tests[\"> \" + matches.length + \" related projects: \" + space] = 1","for (var p in matches){","    tests[\">> \" + matches[p] + space] = 1","}","","// F3. Self-iterate or leave loop ","if (verifyList.length > 0){","    console.log(\"[VerifyTimesheet]\", \"loop again. Remaining:\", verifyList)","    postman.setNextRequest(\"Verify_Timesheet\")","} else {","    console.log(\"[VerifyTimesheet]\", \"verified all. go logout\")","    postman.setNextRequest(\"Logout\")","}"]}}],"id":"9103602a-9f07-97ea-e750-88ca4acd9f76","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"{{HRM_HOST}}/lib/controllers/CentralController.php?timecode=Time&action=View_Timesheet&id={{timesheetId}}","description":"<p>For each <code>timesheetIds</code></p>\n<ol>\n<li>Submitted</li>\n<li>Working hours &gt;= 40</li>\n<li>Display filled projects</li>\n</ol>\n","urlObject":{"path":["lib","controllers","CentralController.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"timecode","value":"Time"},{"key":"action","value":"View_Timesheet"},{"key":"id","value":"{{timesheetId}}"}],"variable":[]}},"response":[],"_postman_id":"9103602a-9f07-97ea-e750-88ca4acd9f76"},{"name":"Logout","event":[{"listen":"test","script":{"id":"2d926bbc-fe2c-40a5-aa3a-9a215983b01b","exec":["// wipe working env variable.","postman.clearEnvironmentVariable(\"token\");","postman.clearEnvironmentVariable(\"txtStartDate\");","postman.clearEnvironmentVariable(\"txtEndDate\");","postman.clearEnvironmentVariable(\"timesheetIds\");","postman.clearEnvironmentVariable(\"timesheetId\");","postman.clearEnvironmentVariable(\"employeeId\");","postman.clearEnvironmentVariable(\"holidayList\");","postman.clearEnvironmentVariable(\"projectId\");","postman.clearEnvironmentVariable(\"activityId\");","postman.clearEnvironmentVariable(\"hdnGridCount\");","postman.clearEnvironmentVariable(\"pw3\");","postman.clearEnvironmentVariable(\"verifyList\");","postman.clearEnvironmentVariable(\"tempTxtEndDate\");","postman.clearEnvironmentVariable(\"tempTxtStartDate\");","","for (var i=0; i<=6; i++){","    postman.clearEnvironmentVariable(\"hdnReportedDate\" + i);","    postman.clearEnvironmentVariable(\"duration0\" + i);","    postman.clearEnvironmentVariable(\"duration1\" + i);","    postman.clearEnvironmentVariable(\"cmbActivity\" + i);","    postman.clearEnvironmentVariable(\"cmbProject\" + i);","}","","tests[\"Finished. Logout. Bye!\"] = true","postman.setNextRequest(null)"],"type":"text/javascript"}}],"id":"9c3adc24-4f74-14bc-9b0b-5375cd3679c6","request":{"method":"GET","header":[],"url":"{{HRM_HOST}}/index.php?ACT=logout","description":"<ul>\n<li>wipe working environments</li>\n</ul>\n","urlObject":{"path":["index.php"],"host":["{{HRM_HOST}}"],"query":[{"key":"ACT","value":"logout"}],"variable":[]}},"response":[],"_postman_id":"9c3adc24-4f74-14bc-9b0b-5375cd3679c6"}]}