Shedul (sample App)

This app displays graphics from the Shedul Service

The app’s Script code

Script CodeExpand source

type("""input[name="email"]""" , """{{email|default:'a@b.c'|safe|addslashes}}""")
type("""input[name="password"]""" , """{{password|default:'password'|safe|addslashes}}""")
runScript("""
  document.querySelector('input[name="email"]').dispatchEvent(new Event("input", { bubbles: true }))
  document.querySelector('input[name="password"]').dispatchEvent(new Event("input", { bubbles: true }))
""")
pause(1)
clickAndWait("""button""")
repeat(0){
  pause({{refresh|default:180}})
  refreshAndWait()
  waitForPageLoad()
  runScript("""
    if(document.querySelector('div[id="react"]')){
    var elem = j('div[id="react"]');
    j('body').append(elem);
    j('body>:visible').not(':last').remove();
    }
  """)
}

The app’s JSON Schema

We need the declare a schema for the required configuration fields:

  1. email: the email of the user
  2. password: the password of the user
  3. refresh: the refresh rate of the dashboard

JSON SchemaExpand source

{
  "fields": [
    "email",
    "password",
    "refresh"
  ],
  "schema": {
    "password": {
      "title": "Password",
      "type": "Password",
      "validators": [
        "required"
      ]
    },
    "email": {
      "title": "Email Address",
      "type": "Text",
      "validators": [
        "required",
        "email"
      ]
    },
    "refresh": {
      "title": "Refresh Interval (sec)",
      "type": "Number",
      "validators": [
        "required"
      ]
    }
  }
}