Skip to content

Commit

Permalink
Get functional tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Oct 18, 2024
1 parent bcc91f7 commit 3c9e6b1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 32 deletions.
28 changes: 1 addition & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
<jenkins.version>2.414.3</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}</gitHubRepo>
<code.coverage.percentage>50</code.coverage.percentage>
<selenium.version>4.1.4</selenium.version>
<exclude.tests>**/functionaltest/*.java</exclude.tests>
<selenium.version>4.25.0</selenium.version>
<!-- TODO fix existing violations -->
<spotbugs.threshold>High</spotbugs.threshold>
</properties>
Expand Down Expand Up @@ -222,22 +221,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>web-tests</releaseProfiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>${exclude.tests}</exclude>
</excludes>
</configuration>
</plugin>
</plugins>


Expand Down Expand Up @@ -290,15 +273,6 @@
</pluginManagement>
</build>

<profiles>
<profile>
<id>web-tests</id>
<properties>
<exclude.tests>none</exclude.tests>
</properties>
</profile>
</profiles>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public void init() throws Exception {
jr.jenkins.rebuildDependencyGraph();
}

@Ignore
@Test
public void pipelineShouldNotShowRunButtonIfUserNotPermittedToTriggerBuild() throws Exception {
loginLogoutPage.login(UNPRIVILEGED_USER);
Expand All @@ -48,7 +47,6 @@ public void pipelineShouldNotShowRunButtonIfUserNotPermittedToTriggerBuild() thr
pipelinePage.runButtonIsAbsent());
}

@Ignore
@Test
public void pipelineShouldShowRunButtonIfUserPermittedToTriggerBuild() throws Exception {
loginLogoutPage.login(PRIVILEGED_USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public <T extends Page> void login(String username) {

usernameField().sendKeys(username);
passwordField().sendKeys(username);
passwordField().submit();
submitButton().click();
}

private WebElement usernameField() {
Expand All @@ -35,6 +35,10 @@ private WebElement passwordField() {
return waitForElement(By.name("j_password"), driver);
}

private WebElement submitButton() {
return waitForElement(By.name("Submit"), driver);
}

public void logout() {
driver.get(baseUrl + "logout");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView;
import au.com.centrumsystems.hudson.plugin.buildpipeline.DownstreamProjectGridBuilder;
import au.com.centrumsystems.hudson.plugin.buildpipeline.extension.SimpleColumnHeader;
import au.com.centrumsystems.hudson.plugin.buildpipeline.extension.SimpleRowHeader;
import au.com.centrumsystems.hudson.plugin.buildpipeline.extension.StandardBuildCard;
import hudson.model.FreeStyleProject;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.jvnet.hudson.test.FailureBuilder;
import org.jvnet.hudson.test.JenkinsRule;
import org.openqa.selenium.NoSuchSessionException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

Expand All @@ -34,7 +38,7 @@ public void initSharedComponents() throws Exception {

initialJob = jr.createFreeStyleProject(INITIAL_JOB);

pipelineView = new BuildPipelineView("pipeline", "Pipeline", new DownstreamProjectGridBuilder(INITIAL_JOB), "5", false, true, false, false, false, 1, null, null, null, null, null);
pipelineView = new BuildPipelineView("pipeline", "Pipeline", new DownstreamProjectGridBuilder(INITIAL_JOB), "5", false, true, false, false, false, 1, null, null, new SimpleColumnHeader(), new SimpleRowHeader(), new StandardBuildCard());
jr.jenkins.addView(pipelineView);

webDriver = new FirefoxDriver();
Expand All @@ -45,7 +49,11 @@ public void initSharedComponents() throws Exception {
@After
public void cleanUpWebDriver() {
webDriver.close();
webDriver.quit();
try {
webDriver.quit();
} catch (NoSuchSessionException e) {
// Ignore
}
}

protected FreeStyleProject createFailingJob(String name) throws Exception{
Expand Down

0 comments on commit 3c9e6b1

Please sign in to comment.