We prepared for you a few manually introduced bugs in order to learn how to use Rookout. The first two will make sure you understand how to create and analyze our most complete rule - the Dump Frame. The third bug will introduce a new rule type - Log. You will be walked through the process of editing the rule in order to add custom elements to it.
For more information about Rule Scripting refer to (our documentation)[https://rookout.github.io/scripts/index.md]
Level: Beginner
- The bug: Clear Completed button hangs, does not do what is intended - nothing is cleared.
- Reproduce: Add a few tasks, check one or more as completed using the checkbox on the left of the task and click the
Clear completed
button on the bottom right corner. - Debug:
- In the Rookout app, open the file
/src/utils/store.js
- Using the Rules pane on the right, select the Rule Type "Dump Frame"
- Add this rule to line 131 and try again to click on
Clear completed
to see the message that pops in the Rookout app - We can now see the whole stacktrace leading to this point and we pinpoint the error to this message :
- We see the
Locals
object and all we have in isthis
, which hastodos
inside it.- it means we need to access todos as
this.todos.filter(...
and nottodos.filter(...
- it means we need to access todos as
- We can now know what is not working on the server-side and fix it.
- In the Rookout app, open the file
- Reproduce: Add a few tasks, check one or more as completed using the checkbox on the left of the task and click the
Level: Beginner
- The bug: Special characters (<,>,;,`,&,/,\) are not being accepted as part of the title when Adding or Updating a Todo.
- Reproduce: Add a task with special characters. All these characters should not be saved.
- Debug:
- In the Rookout app, open the file
/src/services/todos.js
- At lines 14 and 61 we see that the title passes the function
utils.cleanString(...)
- Let's add aDump Frame
to the end of the function in file/src/services/utils.js
. - Try to add a task with some of these characters to get the frame.
- We can see that after using this function, on line 3 these characters are being found and replaced by regex. We found the source of the issue.
regex = ... this = ... str = "Test < > &&" trimmedStr = "Test"
- In the Rookout app, open the file
Level: Intermediate
- The bug: Duplicate Todo adds an invalid todo instead of an exact copy of an existing one.
-
Reproduce: Add a task and when hovering on the text, on the right side you have the & symbol. Click on it to duplicate the task.
-
Debug:
- In the Rookout app, open the file
/src/services/todos.js
- Using the Rules pane on the right, select the Rule Type "Log"
- Add this rule to line 92
- Before triggering the rule, let's edit it so it returns what we want
- In the Rules pane on the right, click the Edit Rule (pen) icon next to the rule you just added. It will open up the Rule configuration as a JSON file
- On line 6 in the
paths
object let's add a property"store.rookout.locals.todo": "frame.todo"
- On line 28 we have
processing.operations
object, let's add a new operation in the array :
name: send_rookout - means we are sending the information to the rookout web application path: store.rookout.locals.todo - we tell the rule what information to send
{ "name": "send_rookout", "path": "store.rookout.locals.todo" }
- Add and duplicate a todo in order to see the output, and now we can see what is being given to the object and match if we have an error in the function (parameters missing or in bad order).
- In the Rookout app, open the file
-