Templates enables you to capture issues even faster during testing, by automatically populating fields in issues with your predefined values. Templates are remembered on your JIRA server, so your templates remain the same regardless of which browser you are testing in. Templates are also shared, so you can create one template that your whole team can use.

Creating and using templates

To create a new template, go to the "Templates" tab in the Bonfire browser extension, then click "Add Template" under the "Mine" section. Here you can pre-fill an issue creation form with any information you would like. (e.g. a particular project, version, or component you are working). Selecting the option "Attach Screenshot by Default" will include a screenshot attachment automatically when you are applying a template.

You can have as many templates as you like, so you can have very specific templates for issues that you may wish to raise during testing.

Templates are used when creating an issue. To do this, simply choose one from the "Use Template" menu on the Create Issue tab in the Bonfire browser extension. The "Use Template" menu will only show templates that you have marked as "Favourite" with a star ((star)). By default, all templates you create are marked favourite for you.

Using a template will keep it selected until you choose otherwise – even across multiple uses of the browser extension.

A template can also be assigned as the default template for a shared test session, allowing all participants of the test session to create consistent issues. For more information on creating test sessions, please read Working with Sessions#CreatingSessions

Using variables in a template

Variables allow templates to contain dynamic information, and are only evaluated into actual values when the template is used during issue creation. Variables previously only worked when used in a template, but as of Bonfire 2.2 they can be used at any time during the issue creation process.

To use a variable, enter the variable name surrounded by braces ("{" and "}") into a text field on the template or issue creation forms.

By default, Bonfire ships with four variables:

  • {cookies} - Are cookies turned on? Value is either true or false.
  • {useragent} - Browser information.
  • {title} - Current page title.
  • {url} - Current page URL.

Creating your own variables to use

The default variables shipped with Bonfire are only a start, but you can create your own variables to do different things. To create another variable, simply click "Add Variable" in the Templates tab of the browser extension. For each variable, you need to provide 2 pieces of information:

  • the name - this is the variable name. You use the variable in templates by enclosing the variable name in '{' and '}'
  • the javascript selector - this is the javascript that will evaluate when you run the variable. This happens when you select a template to use in the create issue tab.

Some other examples:

名前

Javascript Selector

説明

jiraVersion
document.getElementById('footer-build-information').innerHTML

This is one specific to JIRA itself. In our JIRA footer, we always include the JIRA version and build numbers. This javascript selector will get this information for us

日付
new Date().toDateString()

Today's date.

selectedText

Chrome & Safari

window.getSelection().toString(); 

Firefox

document.getSelection().toString();

IE

document.selection.createRange().text;

Will insert any text that's already selected.

Note that the javascript for this differs across browsers, so you will need to create separate variables for each browser you wish to use this in.

Sharing templates and variables

Once you have templates working the way you want, you can also opt to share it with your team by marking the "Share this template" checkbox.

Your teammates will now be able to see this template in their list of available templates to use.

If they "favourite" the template, it will be made available for use in their issue creation under the "Use Template" menu. Note - using a shared template will also include any variables which are included in the template.

Control field visibility using templates

The checkboxes on the template form control the visibility of the field when the template is used. This means that you can choose to view only the fields that matter to you when using the template. These hidden fields will also apply for anyone using your shared template. Mandatory fields that are required for issue creation will always be visible, to minimise the chance of issue creation errors.

 

  • ラベルなし

29 Comments

  1. francis

    Hi,

    I'm trying out the variable functionality. When adding the date example as a variable I'm getting

    Error in selector "new Date().toDateString()" (SyntaxError: missing ; before statement)
    
    1. Gilmore Davidson

      Hi Francis,

      This appears to be caused by a bug in the Firefox version of Bonfire.
      I have lodged a bug report at https://jira.atlassian.com/browse/BON-157

      Cheers,

      Gilmore

  2. Kyle Sloan

    Will there be a way to include a jQuery or Prototype library in the future?  Selecting with pure javascript is pretty "old school".

    1. Gilmore Davidson

      Hi Kyle,

      With Bonfire, we've tried as much as possible not to alter the page under test, as that might produce "false positive" bug reports. Injecting a complex library like jQuery into unknown pages could produce code conflicts, especially if there is already an older version of jQuery installed on the page.

      If you're using Firefox or Internet Explorer, jQuery and Prototype can be used if they are already included in the page that you are testing.
      Unfortunately, Chrome and Safari effectively run extension scripts in a sandbox, allowing access to the DOM but not global variables and functions, so accessing an existing jQuery include isn't available.
      However, all of Bonfire's supported browsers - except IE7 - support the document.querySelector API, so your example below could be rewritten as:

      document.querySelector('#my_id option[selected]').value
      document.querySelector('#my_id option[selected]').text

      Cheers,

      Gilmore

      1. Anonymous

        Hi Gilmore,

        Is there any progress on this issue/feature? Isn't there a way for the Bonfire extension to have jQuery included in it's sandbox on Chrome? I though that was the whole reason for this isolation and so that you won't get the extension altering the page and producing "false positives".

        Regards,

        Mike

  3. Kyle Sloan

    Here is an example of selecting the values of a drop down where the select tag has an id of "my_id"

    document.getElementById('my_id').options[document.getElementById('my_id').selectedIndex].value
    document.getElementById('my_id').options[document.getElementById('my_id').selectedIndex].text



  4. Michal Szklanowski

    On the following page: http://blogs.atlassian.com/jira/2011/09/bonfire-instant-issue-creation.html you mention the selectedText variable, which can automatically populate issue with currently selected text. I've tried to use it, but no luck.

    Can you provide some advice on how to use/set-up this variable?

    1. Andrew Prentice

      The selectedText variable isn't included by default with Bonfire, because the javascript needed to provide it differs across browsers (and variables aren't conditional yet).

      So you'll need to create a seperate variable for each browser you want to use it in using the appropriate javascript:

      Chrome & Safariwindow.getSelection().toString(); 
      Firefoxdocument.getSelection().toString();
      IEdocument.selection.createRange().text;

       

      1. Michal Szklanowski

        Perfect, can you include this information into the page above, so that it is available to anyone, without need to hunt through the comments?

        1. Andrew Prentice

          Done. Good idea, thanks Michal.

  5. user-cd814

    How to share templates between Jira accounts? As a developer I'd like to be able to provide templates for the testers so issues created through bonfire become more meaningful. It is a little inconvenient if every tester needs to define his or her own templates. In addition to this, is there a way to define a default template for a project?

    It would be even cooler being able to define rules based the page's content. Have a special meta-tag for instance some JavaScript or custom language to define which template to choose when Bonfire creates a new issue.

    1. edwin

      Hi Stefan,

      Thanks for all the suggestions - great ideas. 

      Ideas are usually tracked on our issue tracker, so you may want to watch them or keep an eye on them:

      Sharing templates - https://jira.atlassian.com/browse/BON-34

      Default templates - https://jira.atlassian.com/browse/BON-76

      Meta-tags to drive template decisions - https://jira.atlassian.com/browse/BON-228

       

      Regards,

      Edwin

       

  6. Anonymous

    and i cant link an existing issue like whit jira? when automaticly apeears images and others thinks?

    1. edwin

      Hi there,

       

      I'm not quite sure if I understand your question here, could you explain a little what you mean?

       

      Thanks,

      Edwin

  7. Anonymous

    Hi,

    Is there any way to create templates so that all JIRA users can see/use it?

     

    Thanks

    1. edwin

      Hi there,

      The ability to share templates is not yet available in JIRA. However, we're definitely looking at this request and hope to provide that functionality soon in an upcoming release. In the meantime, feel free to keep track of the request here: https://jira.atlassian.com/browse/BON-34

       

       

      Regards,

      Edwin

  8. Anonymous

    Hi, we're using templates so that our clients can easily submit issues with screengrabs and autocompleted useragent and url values (btw, we're getting around the lack of shared templates by logging in as the client and manually setting up the template for them).

    One issue I've come up against is that although a template can have {url} in our url field and {useragent} in our environment field, when the project or issue type is changed, the url field is cleared. If you change the project or issue type back, the url field remains cleared.

    I can't think of any reason why it would need to do that? ... the {useragent} value in our environment field doesn't have this problem. If no-one else is getting this problem then I suspect it might be something to do with how I've setup URL as a custom field but I can't see what. It's set to be applicable to any issue type and global context.

    I'm not using the Bonfire URL custom field (I now have two of these after the latest update to 1.5.1), might that help?

    thanks,

    andy

    1. Anonymous

      Answered my own question there, I've managed to setup the Bonfire URL field to do what we need. It gets passed through no matter how the templates are used.

      I still think it's odd though that it was being cleared when I was using my own custom URL field?

      andy

      1. edwin

        Hi Andy,

        Sounds like you've got a very interesting use case there for Bonfire.

        Actually, I'd love to learn more about how you've set it up to work with the custom URL field. You are right in that currently, custom fields gets cleared whenever you switch project/issue type.

        Would we be able to take this discussion offline? Feel free to DM me at edwin at atlassian dot com.

         

        Cheers,
        Edwin 

    2. Vicki T

      I also have an issue with having two Bonfire URL custom fields. How can I determine which one is no longer in use, so I can delete it?

       

      1. Gilmore Davidson

        Hi Vicki,

        The correct custom field is titled "Bonfire URL" (note the caps of URL) with description of "The URL where this issue was created. This Custom Field is created programatically by Bonfire."

        The other one was created by an older version of Bonfire and is no longer used - you may remove it safely.

        Cheers,
        Gilmore 

        1. Anonymous

          Thanks!

  9. Udo Müller

    Looks like my Bonfire 1.8.3 with JIRA 1.8.3 has a bug marking templates as favourites: Clicking the star marks it on and off, but they dont appear in the favourites list.

    Waht can i do?

    1. francis

      Got the same issue.

    2. Udo Müller

      Jira is at version 4.4.4, not 1.8.3 (smile) Is there a solution to debug or fix the problem?

    3. Gilmore Davidson

      Bonfire 1.8.3 had a bug with favourite templates which was fixed in 1.8.4. The newly-released 1.9 also contains some other templates-related fixes, as well as the ability to share variables with a template.

  10. Anonymous

    Hi,

     

    I am not able to take screenshots of my flash game. Is that something that Bonfire alllows? If so can you help me out? Right now all i see is a black or grey screen.

     

    Thanks

    1. Gilmore Davidson

      The screen capture of Flash objects in Bonfire depends on the combination of your browser and the method used to embed the Flash object in a page.

      Full details of working combinations are detailed in the Bonfire Compatibility Chart.

  11. Josh Harper

    I'd like to add a variable to detect and include the Flash plugin version with submitted tickets, but cannot seem to find a selector that will include that, any thoughts?