Skip to content

Instantly share code, notes, and snippets.

@garyjoy
garyjoy / liked_posts.json
Created February 4, 2022 19:18
Sownata Test Fixtures
{
"likes_media_likes": [
{
"title": "instagramuser",
"media_list_data": [
],
"string_list_data": [
{
"href": "https://www.instagram.com/p/?/",
@garyjoy
garyjoy / elevatorSaga02.js
Created October 24, 2019 16:28
Elevator Saga 02 - Getting better...
{
init: function(elevators, floors) {
console.clear()
const DO_NOT_STOP_THRESHOLD = 0.7
var floorsWaitingForUp = new Set()
var floorsWaitingForDown = new Set()
@garyjoy
garyjoy / elevatorSaga01.js
Last active October 24, 2019 16:25
Elevator Saga 01 - Starter for Ten...
{
init: function(elevators, floors) {
function getElevator() {
// Return a random elevator...
return elevators[Math.floor(Math.random() * elevators.length)];
}
floors.forEach(floor => {
floor.on("up_button_pressed", function() {
@endpoints
Feature: Endpoint Tests in IBM BPM
Scenario Outline: Endpoint Test for <description>
When I get "<URL>" (which is "<description>") the HTTP Status Code is <code>
Examples:
| URL | description | code |
# Development
| http://?/ProcessPortal/login.jsp | BPM Load Balancer in Development | 200 |
@garyjoy
garyjoy / serviceTestingGlueCode.java
Created January 29, 2018 14:56
Service Testing Glue Code
@When("^I call \"([^\"]*)\" with \"([^\"]*)\" the \"([^\"]*)\" is \"([^\"]*)\"$")
public void i_call_with_the_is(String serviceName, String input, String property, String expectedValue) throws Throwable {
String userName = configuration.getProperty("bpm.user.name");
String password = configuration.getProperty("bpm.user.password");
String requestURL = configuration.getProperty("rest.url") + configuration.getProperty("rest.unitTest") + serviceName;
Response response = given().auth().
form(userName, password, formAuthConfig).
headers("Accept", "application/json", "Content-Type", "application/x-www-form-urlencoded", "X-Method-Override", "POST").
@garyjoy
garyjoy / url
Created February 3, 2017 15:34
Exposing a Client Side Human Service via a URL
var markup = "";
if (this.context.bpm.system.context.callerModelBranchId != null && this.context.bpm.system.context.callerModelBranchId.length > 0) {
markup = "<a href='/teamworks/executecf?modelID=?&branchID=" + this.context.bpm.system.context.callerModelBranchId + "&tw.local.processInstanceId=" + this.context.options.instanceId.get("value") + "' target=_blank>" + "Process Centre Link" + "</a>";
}
else if (this.context.bpm.system.context.callerModelSnapshotId != null && this.context.bpm.system.context.callerModelSnapshotId.length > 0) {
markup = "<a href='/teamworks/executecf?modelID=?&snapshotID=" + this.context.bpm.system.context.callerModelSnapshotId + "&tw.local.processInstanceId=" + this.context.options.instanceId.get("value") + "' target=_blank>" + "Process Server Link" + "</a>";
}
else {
console.error(“A meaningful error that indicates that you cannot create a link...");
}
/**
* Switch to the specified Frame
*
* @param frameName - This should be a Service/Dashboard name or a Task Subject
*/
public void switchToFrame(String frameName) {
log.message(String.format("Switching to '%s' iFrame", frameName));
// printFrameInformation();
TestFramework.driver.switchTo().defaultContent();
console.log('View Event Handler for Feedback for HHS');
var feedbackId = "#" + this.context.viewid + "_div";
var feedbackDiv = $("#" + this.context.viewid + "_div");
var feedbackTextId = "#" + this.context.viewid + "_text";
$('img', this.context.element).attr("src", com_ibm_bpm_coach.getManagedAssetUrl("feedback.png", com_ibm_bpm_coach.assetType_WEB));
// $('textarea', this.context.element).attr("rows", 5);
<div ng-app='ModalDemo'>
<div ng-controller='MyCtrl'>
<modal-dialog show='modalShown' width='400px' height='60%'>
<!-- Content Box Here -->
</modal-dialog>
</div>
</div>
var elementNode = document.getElementById(this.context.viewid)
console.log('Change Angular Dialog');
if (event.type !== "config") {
if (event.newVal === true) {
var myScope = angular.element(elementNode.children[0].children[0]).scope();
myScope.toggleModal();
myScope.$apply();
}