Wikidata:How to create Wikidata Tours/Test

Deploy to test.wikidata.org edit

Now that you have a wiki page, JavaScript file and tour item you are ready to create a functioning draft of the finished tour. This will allow you to fix issues, gain feedback and generally refine the tour before the final deployment to main wikidata.org. You will need to complete the following steps in order get the tour up and running on test.wikidata.org.

Copy tour files to test.wikidata.org edit

Create new files on test.wikidata.org, using copies of the tour files that have been created on wikidata.org.

Copy the contents of each file listed below, and use it to create a new page at the location specified (replace TOUR NAME with the name of the tour you are deploying).

1. Tour Wiki Page edit

Copy to https://test.wikidata.org/wiki/Tours:TOUR NAME

2. Tour JavaScript File edit

Copy the JavaScript file from your User namespace to https://test.wikidata.org/wiki/MediaWiki:Guidedtour-tour-wbTOUR NAME.

User namespace
(JavaScript step)
MediaWiki namespace test.wikidata.org
(Current step)
MediaWiki namespace www.wikidata.org
(Publish step)

3. Tour Wikidata item' edit

Create a new item on test.wikidata.org, or make a note of an existing tour item that can be used. You should never share Wikidata items between multiple tours on main wikidata.org, but it's fine to do this on test.wikidata.org.

Replace all items and properties in the JavaScript file edit

Because wikidata.org and test.wikidata.org do not have the same properties and items, you will need to temporarily replace all of the properties and items referenced in your JavaScript file.

The only parts of the file you need change are:

  1. tourEntityId - Change to the test.wikidata item you wish to use
  2. newData - Change all references to properties and items in the initial data added to the item.

For each change, you should leave the original property or item in a comment at the end of the line. You will need to put these back to the original values once the tour is deployed to main wikidata.org.

For example, the snippet below shows one statement added as part of the newData object. The property on line 3 and the item on 7 have been replaced with a test.wikidata.org equivalents, with the original values to use on main wikidata.org left in the comment at the end of the line.

"mainsnak": {
    "snaktype": "value",
    "property": "P39", // "P31"
    "datavalue": {
        "value": {
            "entity-type": "item",
            "id": "Q497", // "Q24699794"
            },
            "type": "wikibase-entityid"
    },
    "datatype": "wikibase-item"
}
Important: When replacing properties you will need to make sure that they have the correct data type.

For example, when replacing coordinate location (P625) with a test.wikidata equivalent, you would need to make sure that the property has data type "Geographic coordinates" or the startup data will be rejected. In this case, you can find the exact equivalent property P125 on test.wikidata.org. If you can't find an exact match, any property of the correct data type will allow the tour to load for testing. Just go to https://test.wikidata.org/wiki/Special:ListProperties, select the data type you need and click the "find" button to generate a list of options.

When replacing items, there are no issues with datatype so any valid item will do. However, it's advisable to create or choose an item with the same label as the equivalent as wikidata item as this will help test the tour in a more realistic context.

Test and improve edit

You should now be able to load the tour for testing using a URL of the following format:

https://test.wikidata.org/w/index.php?title=TOUR ITEM&tour=TOUR NAME

Replace TOUR ITEM and TOUR NAME with the values specified in the tour JavaScript file. If the tour does not load at this point, check the Troubleshooting section for help identifying and fixing the problem.

It is important to ask people to test your tour before you publish it so that you can catch any errors and make sure the steps are clear for new users. The creator of the tour wiki page should also thoroughly check the behaviour of the tour to make sure it matches their original plan. NOTE: You can edit the tour text and section heading names without changing anything in the JavaScript file.