Shotputter is a development tool that helps small to medium-sized teams report bugs and browser errors, request features and changes, and provide targeted system information for developers via browser screenshots. The main feature of Shotputter is to provide a tab/button that the user can click to take an annotated screenshot, and then send immediately to the dev team via a (self hosted) API that posts to other services that may be in use. Current third party implementions are
- Google Chat
- Slack
- Jira
- Github
- Custom webhook
Additionally for screenshot image hosting, the providers are
- Local filesystem (from the API)
- AWS S3
- Imgur
- Cloudinary
For particularly small teams or if hosting the API proves to be challenging, good old fashion downloads and copy/paste system information is also available for configuration.
To quickly start the API server, a CLI, Docker deployment, and Serverless configuration for use on AWS. A Cloudformation file for an ECS deployment is also provided.
When should I use this?
Shotputter is designed to be an easy-to-use dev tool for small projects and teams before moving on to more robust implementations such as Rollbar or usersnap.
Shotputter is NOT recommended for production environments! It should only be used on a development or staging environment. The main concern is security when interfacing with the API. Future revisions will try to address these issues.
It is possible to set up Shotputter in your development environment to be more friendly for non-technical users to use
Getting started
Shotputter is distributed through NPM, and you can install it the usual NPM way.
npm install @shotputter/browser
The API and its associated files are available through the @shotputter/api package
This is hosted on a CDN at:
https://unpkg.com/@shotputter/browser
npm install @shotputter/api
1) When it’s installed, unless you are only using the download feature demonstrated here, you will need to launch/host an API server somewhere. Details on how to launch an server can be found here 2) With an API server running somewhere in your browser code, you will need to initialize the Shotput object. An example of which is below:
const {Shotput} = require("@shotputter/browser");
Shotput({
service: {
url: "https://my-shotput-api.example.com"
},
captureLogs: true,
errorReporting: {
enabled: true,
slack: {
enabled: true,
channel: "errors"
}
},
github: {
enabled: true,
defaultOwner: "adamsar",
defaultRepo: "shotputter"
},
slack: {
enabled: true,
defaultChannel: "dev"
},
jira: {
enabled: true,
defaultIssueType: "Bug"
}
});
or if you include the Shotput browser library from the CDN, it will be accessible on the window.
window.Shotput({
service: false,
metadata: {userId: 1}
});
you can read more about configuring the application in the browser configuration section of this page.
- Start your application, use the feedback tab on the right side of the page to begin using the application.
Browser configuration
The Shotput object on the browser has the following options configurable. To just use the download feature or a custom endpoint with no server, initialize a Shotput object with service set to false.
const {Shotput} = require("@shotputter/browser");
Shotput({service: false});
service.urlstring URL where the shotput api service is running.service.messageTemplatestring | function Override default template when posting a message to a service.service.autoPostboolean Enable auto posting when submitting screenshots or messages. Default falseservice.autoPostFirstboolean Posts to endpoints that are configured as auto post immediately instead of prompting a post. Default falsemetadataobject Set initial metadata to include in information when submitting screenshots. Useful for adding app-specific data such as current user, etc. Default undefinedcaptureLogsboolean Capture logs (up to 20 lines) to include in reports. Default falseerrorReporting.enabledboolean Enable capturing of errors in the browser (and rejected promises) and report them as per additional configuration in the object. Defaults to falseerrorReporting.slack.enabledboolean Send errors to slack, requires theerrorReporting.slack.channeloption to be set if set to to true. Default falseerrorReporting.slack.channelstring Which slack channel to post browser errors to.errorReporting.slack.templatestring | function Change the default template to use when posting errors to Slack.errorReporting.google.enabledboolean Post errors to Google chats. Defualts to false;errorReporting.google.templatestring | function Change the default template when posting errors to Google Chats.errorReporting.customEndpointstring Send errors to a custom endpoint. The endpoint must accept a POST request with the following JSON body (depending on what is configured)
{
type: "page_error",
payload: {
message: "Stack trace\n", // Stack trace of the error occurred
systemInfo: {}, // All system info obtained from the browser
metadata: {}, // Any metadata that is set
logs: [] // If `captureLogs` is enabled, this will be an array of the last 20 log messages.
},
}
errorReporting.templatestring | function Change the default template for all error reporting endpoints.download.enabledboolean Set to false to explicitly disable the Download option.slack.enabledboolean Enable posting screenshots and messages to slack.slack.defaultChannelstring Name or ID of channel to post screenshots to by default. Ifslack.forceChannelis not set to true, it will be possible to change channels when posting manually.slack.forceChannelboolean When set to true with a channel provided viaslack.defaultChannel, this will force all messages to only post to the specified channel.slack.templatestring | function Change the default template when posting to Slack.slack.autoPostboolean Automatically post to slack when using the auto posting feature. Requiresslack.defaultChannelto also be configured.google.enabledboolean Posting to Google Chats is enabled.google.templatestring | function Change the default template when posting to Google Chats.google.autoPostboolean Automatically post to slack when using the auto posting feature.github.enabledboolean Posting to Github is enabled.github.templatestring | function Change the default template when posting to Github.github.titleTemplatestring | function Change the default template for the issue title when posting to Github. It is recommended to set this when auto posting to Github.github.defaultOwnerstring Automatically set the default Github owner when listing repos from Github. When used with auto posting viagithub.autoPostthis must be set withgithub.defaultRepo.github.defaultRepostring Automatically set the default Github repo when listing repos from Github. When used with auto posting viagithub.autoPostthis must be set withgithub.defaultOwner.github.forceRepoboolean Force posts to automatically to a specific repo for a specific owner. This will disable being able to select a repo.github.defaultRepoandgithub.defaultOwnermust be set with this.github.defaultLabels*array* Set default labels for each post on Github. github.autoPostboolean Include Github when auto posting. Requiresgithub.defaultOwnerandgithub.defaultRepoto also be set.github.titleTemplatestrongly recommended to also be set.jira.enabledboolean Enabled posting to Jira.jira.templatestring | function Change the default template for posting to Jira.jira.defaultProjectstring Default project to select for posting, name or ID. Use withjira.forceProjectto remove the option to select different projects. Required when using the auto posting feature andjira.autoPostjira.forceProjectboolean Use withjira.defaultProjectto force the user to use only a specific Jira Project.jira.defaultIssueTypestring Default issue type to use when posting issues; ID or name permitted. Make sure this issue type exists on the default project, and usejira.forceIssueTypeto force the user to only use this issue type. Required when using the auto posting feature andjira.autoPostjira.defaultSummarystring Default summary to use for issues posted to jira. Recommended when using the auto posting feature andjira.autoPost.jira.defaultPrioritystring PriorityId or name. Required when using the auto posting feature/jira.autoPostand the issue type used requires a priority.jira.autoPostboolean Include jira in auto posting. Requiresjira.defaultProjectandjira.defaultIssueTypeto also be set, andjira.defaultPriorityif required, andjira.defaultSummaryis also recommended to be used.custom.enabledboolean Enabled posting screenshots to a custom webhook.custom.endpointrequired when enabledcustom.endpointstring Endpoint to post screenshots and system information to. The endpoint must handle a POST request with the following JSON body
{
type: "screenshot_post",
payload: {
logs: [], // array of log strings
image: "", //Base64 encoded screenshot
systemInfo: {}, // Object containing browser and system information
metadata: {} // Metadata provided for the current environment is any.
},
timestamp: "2020-09-01T04:44:50.283Z" // ISO string for when the post request was made
}
Metadata
Since Shotputter is designed to help get developers the information they need to make the changes their test users want, sometimes additional data about the user or their actions would help. Metadata can be provided or changed for use in templates through the browser configuration and a small interface on the Shotput instance that is created.
Example:
const {Shotput} = require("@shotputter/browser");
const instance = Shotput({
...config,
metadata: {
userName: getUserName()
}
});
///... later in the application
instance.updateMetadata({
groups: ["test", "test1"]
});
These functions are available on the Shotput instance to manipulate metadata.
updateMetadata(metadata: object)Updates existing metadata with the object provided. Overwrites existing keys.setMetadata(metadata: object)Completely replaces the existing metadata with the new object. All existing data is deleted.purgeMetadata()Sets the metadata object to a blank object
Non technical users
Sometimes you want to fold in non-technical testers and designers and in your workflow, and prompting them to select Github repo or other technical details can be challenging. To automate the posting process for these users, a streamlined workflow is configurable through the browser configuration.
First to replace the selection of which service the user would like to post to with a simple “post” option, set the service.autoPost option to true, and then when configuring services, set their individual autoPost settings, such as github.autoPost to true. On an service-by-service basis additional settings may also be required to be set (such as which repo and owner for github, or which project and issuetype for jira). You can check the browser configuration for the specifics on this.
With this set, the user will be presented with a simple “Download” or “Post” option after making a screenshot. To get rid of the download option, use the service.autoPostFirst option, which will post to third-party services first, and then present the user with the option to download after.