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)
|name||The name of the project|
|description||A meaningful description for your project|
|version||The version of the project (can be left at 0.0.0)|
|dependencies||Dependencies needed for the project (fetches from npmjs)|
|devDependencies||Dependencies needed for the project in development, would not be bundled.|
|scripts||Alias commands to be run via 'npm run <script-name>'|
|repository||The place where the source code lies|
|author||The author of the project|
|license||The license of the project|
See the complete file on GitHub: https://github.com/seibert-media/random-page/blob/develop/package.json
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: https://github.com/seibert-media/random-page/blob/develop/src/test/ui-tests/protractorConfig.js
The first thing is the import of the Confluence Protractor Base
Then the some default timeouts are set in your project:
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
|baseUrl||Set 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.
|specs||Specifies the path to you test case files (specs) and maybe used to define an order of execution.|
Recommendation for the specs order
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.
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.
- No labels