Table of contents

As you know the structure of a Confluence app (or any other maven project), there's a pom.xml and a src folder including a main and test package.

Let's have a look at the required files for adding UI tests. For Protractor there have to be added at least two files: package.json and protractorConfig.js


The package.json is similar to the pom.xml, but for nodejs projects. It provides information about the project and sets up dependent resources like the Confluence Protractor Base or eslint. Furthermore it's the place to add scripts, which can be run via npm run <script-name>. You already know one command from running the UI tests 'test-e2e'

The properties in detail (the important one are bold)

nameThe name of the project
descriptionA meaningful description for your project
versionThe version of the project (can be left at 0.0.0)
dependenciesDependencies needed for the project (fetches from npmjs)
devDependenciesDependencies needed for the project in development, would not be bundled.
scriptsAlias commands to be run via 'npm run <script-name>'
repositoryThe place where the source code lies
authorThe author of the project
licenseThe license of the project

See the complete file on GitHub:

The UI test itself can be found underneath src/test/ui-test, this is the place for the second required file to run UI tests


This file contains the configuration for the UI tests, it includes required sources, sets up some default values and specifies the test files (so called specs) to be run.

This is the first time, where the Confluence Protractor Base can be seen in action. The local configuration extends some default settings from the CPB.

See the whole file on GitHub:

The first thing is the import of the Confluence Protractor Base

var confluenceProtractorBase = require('confluence-protractor-base').confluenceProtractorBase;

Then the some default timeouts are set in your project: 

pageObjectUtils.setDefaultElementTimeout(2 * 1000);
pageObjectUtils.setDefaultLoadingTimeout(20 * 1000);

The next block is a bigger one and extends the protractorConfig.js from the Confluence Protractor Base by merging two objects.

Most properties can be left the way way they are in the CPB, simply three proerties are overriden

baseUrlSet the current base url from your Confluence instance.


Sets up common Confluence params like user logins and page title.
Use the default scheme, no changes needed.
specsSpecifies the path to you test case files (specs) and maybe used to define an order of execution.

Recommendation for the specs order

Two common specs should be run before the others: uploadPlugin.spec.js and prepareTestSetup.spec.js. Those files install your plugin and setup some test data

After all tests are done you might want to cleanup all the prepared test data:  cleanupTestSetup.spec.js

All other test cases should be via wildcard (*.spec.js), which means they are executed in random order and therefore should not be dependent on each other! Inside a spec file the test are executed in order of appearance.

Take away

Simply two files are needed to setup and configure the UI tests, the required files can be taken as provided from the Random Page app with only small adjustments.


< Part 1: First Steps | Part 3: Common Spec Files >

  • No labels

This content was last updated on 02/12/2018.

This content hasn't been updated in a while. That doesn't have to be a problem. Some of our pages live for years without becoming obsolete. Please click this link if you want us to update this page. Old content can be incorrect, misleading or outdated. Please get in contact with us via a form on this page, our live chat or via email with if you are in doubt, have a question, suggestion, or want changes from us.