Page tree
Skip to end of metadata
Go to start of metadata

Agenda

Table of contents

After running the example project, it is time to add UI tests to your own plugin. We are starting with a minimal example.

1. Required directory structure

Add the following directories to your plugin (<project root>/src/test/ should already exist):

<project root>/
 └── src/
      └── test/
           └── ui-tests/
                ├── specs/
                |    └── common/
                └── page-objects/


2. Configuration files

For adding required resources and configuring the protractor UI tests, you need to add the package.json (project-root/) and a protractorConfig.js (project-root/src/test/ui-tests/).

You can just copy the files from the random page sources and change your project attributes (name, description, etc) in the package.json

(question) If you already have package.json, extend it with the 'devDependencies' and 'scripts'. 


3. Plugin installation spec

For you very first spec you may start by uploading your plugin via UI test. Therefore copy the uploadPlugin.spec.js (project-root/src/test/ui-tests/specs/common/) into your project and change the plugin information, meaning 'artifact id' and 'plugin name' (can be found in the pom.xml).

(warning) If you do not bundle an *.obr file, changes it to *.jar

var mavenVersion = universalPluginManager.parseMavenVersionFromPom();
// "randompage" -> plugin <artifactId> from pom.xml
var pluginPath = "./target/randompage-" + mavenVersion + ".obr";
// "Random Page" -> plugin <name> from pom.xml
universalPluginManager.uploadPlugin("Random Page", pluginPath, PLUGIN_UPLOAD_TIMEOUT);

As you only provide one spec file, remove the other specs in the protractorConfig.js 

specs: [
		'specs/common/uploadPlugin.spec.js'
	]


4. Run UI test

Your directory structure should now look like this

<project root>/
 ├── src/
 |     └── test/
 |          └── ui-tests/
 |               ├── specs/
 |               |    └── common/
 |               |         └── uploadPlugin.spec.js
 |               ├── page-objects/
 |               └── protractorConfig.js
 └── package.json

Do as documented here: Requirements

Make sure you've built the plugin before (atlas-package)

You should see a browser, where 'admin' logs-in and uploads your plugin

(tick) Congratulations you've successfully installed UI tests in your project


5. Next steps

After installing your plugin you have two options

If you want further information about the package.json and the protractorConfig.js, have a look at Part 2: Infrastructure.

If you want to implement your tests in TypeScript, see Part 6: Implementing in TypeScript first.

  • No labels