Skip to content
Browse files

Fixed some of the integration tests.

  • Loading branch information...
1 parent 75584d8 commit eb94ec33d855eb88d64f9fc21df4875bdeeffc83 @bripkens committed May 21, 2012
View
7 README.md
@@ -5,6 +5,13 @@ This project provides a user interface for the
interface leverages [Jenkins CI](http://jenkins-ci.org/) as a platform to
achieve a seamless integration with existing company toolsets.
+# Integration Test Configuration
+
+JIRA and Confluence need to be running for the integration tests. Both should
+share the user database and accessible over locahost. JIRA should be running
+under localhost:47623 and Confluence under localhost:47624. The admin account
+should have the name `janustestadmin` with password `janusRocks`.
+
# Deployment
## Prerequisites
View
2 ...gin-integration-test/src/test/java/de/codecentric/janus/plugin/step/BootstrapProject.java
@@ -233,7 +233,7 @@ public Select getCISelectField() {
}
public Select getScaffoldSelectField() {
- return findAllSelectsByCSS(CSS_SELECTOR.SCAFFOLD_SELECT_BOX).get(2);
+ return findAllSelectsByCSS(CSS_SELECTOR.SCAFFOLD_SELECT_BOX).get(4);
}
public WebElement getScaffoldDescriptionDIV() {
View
4 ...ugin-integration-test/src/test/java/de/codecentric/janus/plugin/step/CIConfiguration.java
@@ -82,7 +82,7 @@ public void givenAStandardCiConfig(@Named("ciName") String name)
* ############################
*/
private WebElement getAddCIConfigButton() {
- return findByCSS(CSS_SELECTOR.ADD_VCS_CONFIG_BUTTON);
+ return findByCSS(CSS_SELECTOR.ADD_CI_CONFIG_BUTTON);
}
private WebElement getNameInputField() {
@@ -102,7 +102,7 @@ private WebElement getApiTokenInputField() {
}
public static interface CSS_SELECTOR {
- String ADD_VCS_CONFIG_BUTTON = ".janusCIConfig + div .repeatable-add " +
+ String ADD_CI_CONFIG_BUTTON = ".janusCIConfig + div .repeatable-add " +
"button";
String REPEATED_CHUNK_SELECTOR = ".janusCIConfig + div .repeated-chunk";
View
116 ...in-integration-test/src/test/java/de/codecentric/janus/plugin/step/JiraConfiguration.java
@@ -0,0 +1,116 @@
+package de.codecentric.janus.plugin.step;
+
+import com.google.inject.Inject;
+import de.codecentric.janus.plugin.library.SeleniumAdapter;
+import de.codecentric.janus.plugin.suite.AbstractStep;
+import de.codecentric.janus.plugin.suite.Config;
+import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Named;
+import org.jbehave.core.annotations.When;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+/**
+ * @author Ben Ripkens <bripkens.dev@gmail.com>
+ */
+public class JiraConfiguration extends AbstractStep {
+ private Configuration configuration;
+
+ @Inject
+ public JiraConfiguration(SeleniumAdapter selenium,
+ Configuration configuration) {
+ super(selenium);
+ this.configuration = configuration;
+ }
+
+ /*
+ * ############################
+ * ### GIVEN
+ * ############################
+ */
+ @Given("a JIRA configuration $jiraName is added with the default integration test configuration")
+ @When("the JIRA system is configured with name $jiraName")
+ public void givenAStandardConfig(@Named("$jiraName") String name)
+ throws Exception {
+ goToConfigurationPage();
+
+ // add a new entry to the list
+ getAddJiraConfigButton().click();
+
+ // wait until a new configuration entry is added the repeatable list
+ waitUntilPageContains(By
+ .cssSelector(CSS_SELECTOR.REPEATED_CHUNK_SELECTOR));
+
+ getNameInputField().sendKeys(name);
+ getUsernameInputField().sendKeys(Config.getDefaultJiraUsername());
+ getPasswordInputField().sendKeys(Config.getDefaultJiraPassword());
+ getJiraUrlInputField().sendKeys(Config.getDefaultJiraUrl());
+ getConfluenceInputField().sendKeys(Config.getDefaultConfluenceUrl());
+
+ // submit the form
+ configuration.getSubmitButton().click();
+ }
+
+ /*
+ * ############################
+ * ### WHEN
+ * ############################
+ */
+
+ /*
+ * ############################
+ * ### THEN
+ * ############################
+ */
+
+ /*
+ * ############################
+ * ### WEB ELEMENTS
+ * ############################
+ */
+ private WebElement getAddJiraConfigButton() {
+ return findByCSS(CSS_SELECTOR.ADD_JIRA_CONFIG_BUTTON);
+ }
+
+ private WebElement getNameInputField() {
+ return findByCSS(CSS_SELECTOR.NAME_INPUT_FIELD);
+ }
+
+ private WebElement getJiraUrlInputField() {
+ return findByCSS(CSS_SELECTOR.JIRA_URL_INPUT_FIELD);
+ }
+
+ private WebElement getConfluenceInputField() {
+ return findByCSS(CSS_SELECTOR.CONFLUENCE_URL_INPUT_FIELD);
+ }
+
+ private WebElement getUsernameInputField() {
+ return findByCSS(CSS_SELECTOR.USERNAME_INPUT_FIELD);
+ }
+
+ private WebElement getPasswordInputField() {
+ return findByCSS(CSS_SELECTOR.PASSWORD_INPUT_FIELD);
+ }
+
+ public static interface CSS_SELECTOR {
+ String ADD_JIRA_CONFIG_BUTTON = ".janusJiraConfig + div .repeatable-add " +
+ "button";
+
+ String REPEATED_CHUNK_SELECTOR = ".janusJiraConfig + div .repeated-chunk";
+
+ String NAME_INPUT_FIELD = REPEATED_CHUNK_SELECTOR +
+ " input[name=\"_.name\"]";
+
+ String JIRA_URL_INPUT_FIELD = REPEATED_CHUNK_SELECTOR +
+ " input[name=\"_.jiraUrl\"]";
+
+ String CONFLUENCE_URL_INPUT_FIELD = REPEATED_CHUNK_SELECTOR +
+ " input[name=\"_.confluenceUrl\"]";
+
+ String USERNAME_INPUT_FIELD = REPEATED_CHUNK_SELECTOR +
+ " input[name=\"_.username\"]";
+
+ String PASSWORD_INPUT_FIELD = REPEATED_CHUNK_SELECTOR +
+ " input[name=\"_.password\"]";
+ }
+}
View
16 janus-plugin-integration-test/src/test/java/de/codecentric/janus/plugin/suite/Config.java
@@ -91,4 +91,20 @@ public static String getDefaultPassword() {
public static String getDefaultApiToken() {
return getString("auth.apiToken");
}
+
+ public static String getDefaultJiraUsername() {
+ return getString("jira.username");
+ }
+
+ public static String getDefaultJiraPassword() {
+ return getString("jira.password");
+ }
+
+ public static String getDefaultJiraUrl() {
+ return getString("jira.url");
+ }
+
+ public static String getDefaultConfluenceUrl() {
+ return getString("confluence.url");
+ }
}
View
6 ...-plugin-integration-test/src/test/resources/de/codecentric/janus/plugin/config.properties
@@ -6,4 +6,8 @@ reload.strategy=${RELOAD_STRATEGY}
execute.single=${EXECUTE_SINGLE}
auth.username=janusit
auth.password=12janus34
-auth.apiToken=3a7c71777abf4312df2c234d07d84e28
+auth.apiToken=3a7c71777abf4312df2c234d07d84e28
+jira.username=janustestadmin
+jira.password=janusRocks
+jira.url=http://127.0.0.1:47623
+confluence.url=http://127.0.0.1:47624
View
22 janus-plugin-integration-test/src/test/stories/bootstrap_project.story
@@ -35,7 +35,7 @@ Given a clean Jenkins installation
And a build <creationBuild>
And a build <checkoutBuild>
And a build <commitBuild>
-And a VCS configuration <name> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
+And a VCS configuration <vcsName> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
And a configured scaffold directory <scaffoldDir> and catalog <catalog> and working directory <tmpDir>
When the project bootstrap page is accessed
@@ -47,6 +47,23 @@ Examples:
| OurDetaultVCS | MERCURIAL | creationBuild | checkoutBuild | commitBuild | ./src/test/resources/scaffolds | ./src/test/resources/catalog.json | ./target/applied-scaffolds |
+Scenario: Jenkins contains no JIRA configuration
+
+Given a clean Jenkins installation
+And a build <creationBuild>
+And a build <checkoutBuild>
+And a build <commitBuild>
+And a VCS configuration <vcsName> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
+And a configured scaffold directory <scaffoldDir> and catalog <catalog> and working directory <tmpDir>
+And a CI configuration <ciName> is added with the default integration test user data
+
+When the project bootstrap page is accessed
+
+Then an invalid configuration error message is shown
+
+Examples:
+| vcsName | type | creationBuild | checkoutBuild | commitBuild | scaffoldDir | catalog | tmpDir |
+| OurDetaultVCS | MERCURIAL | creationBuild | checkoutBuild | commitBuild | ./src/test/resources/scaffolds | ./src/test/resources/catalog.json | ./target/applied-scaffolds |
Scenario: Project bootstrap available scaffolds
@@ -58,6 +75,7 @@ And a build <commitBuild>
And a VCS configuration <vcsName> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
And a configured scaffold directory <scaffoldDir> and catalog <catalog> and working directory <tmpDir>
And a CI configuration <ciName> is added with the default integration test user data
+And a JIRA configuration training is added with the default integration test configuration
When the project bootstrap page is accessed
@@ -71,6 +89,7 @@ Examples:
+
Scenario: Project bootstrap
Given a clean Jenkins installation
@@ -80,6 +99,7 @@ And a build <commitBuild>
And a VCS configuration <vcsName> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
And a CI configuration <ciName> is added with the default integration test user data
And the Janus generation is configured
+And a JIRA configuration training is added with the default integration test configuration
When a project <projectName> with package <package> and VCS <vcsName> is bootstrapped
View
8 janus-plugin-integration-test/src/test/stories/configure_jira.story
@@ -0,0 +1,8 @@
+Meta:
+@themes Configuration
+
+Scenario: Configure the Janus JIRA system
+
+Given a clean Jenkins installation
+When the JIRA system is configured with name Training
+Then the Janus JIRA configuration is persisted
View
26 janus-plugin-integration-test/src/test/stories/wip.story
@@ -0,0 +1,26 @@
+Scenario: Project bootstrap
+
+Given a clean Jenkins installation
+And a build <creationBuild>
+And a build <checkoutBuild>
+And a build <commitBuild>
+And a VCS configuration <vcsName> is added with <type> and builds <creationBuild>, <checkoutBuild> and <commitBuild>
+And a CI configuration <ciName> is added with the default integration test user data
+And the Janus generation is configured
+And a JIRA configuration training is added with the default integration test configuration
+
+When a project <projectName> with package <package> and VCS <vcsName> is bootstrapped
+
+Then the bootstrap success message is shown
+And no failure log message is shown
+And the build <creationBuild> is successfully executed
+And the build <checkoutBuild> is successfully executed
+And the build <commitBuild> is successfully executed
+And the target directory contains the scaffold named <projectName>
+And the pom.xml file contains the artifactId <projectName> and groupId <package>
+And the build Worblehat-build is created
+And the build Worblehat-deploy-staging is created
+
+Examples:
+| projectName | package | vcsName | type | creationBuild | checkoutBuild | commitBuild |
+| Worblehat | de.codecentric.worblehat | OurDetaultVCS | MERCURIAL | creationBuild | checkoutBuild | commitBuild |
View
2 ...plugin/src/main/resources/de/codecentric/janus/plugin/jira/JiraConfiguration/global.jelly
@@ -4,7 +4,7 @@
<f:section title="Janus JIRA and Confluence System Configuration">
<f:entry title="Jira and Confluence"
description="List of JIRA and Confluence systems which can be configured using the Janus application.">
- <a class="janusCIConfig"></a>
+ <a class="janusJiraConfig"></a>
<f:repeatable var="inst" field="configurations">
<table width="100%">
<f:entry title="Name"

0 comments on commit eb94ec3

Please sign in to comment.
Something went wrong with that request. Please try again.