Add a testing mode to WikiGrok

Also add an extra undefined check to avoid JS errors.

Change-Id: I15c78c8363889d93d068ad35ce92b8a0913f5ec9
Merge "Add a testing mode to WikiGrok"