Skip to content

Commit

Permalink
Remove more dead code (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Aug 27, 2024
1 parent a0f92c2 commit 7c0e2f7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.jenkinsci.test.acceptance.po.Job;
import org.jenkinsci.test.acceptance.po.PageAreaImpl;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;

/**
* Build timeout plugin setting in the job config page.
Expand Down Expand Up @@ -46,12 +45,8 @@ private void chooseStrategy(String name) {
public void abortBuild() {
if (addAction != null) {
addAction.click();
try {
waitFor(by.button("Abort the build"));
clickButton("Abort the build");
} catch (TimeoutException te) {
clickLink("Abort the build");
}
waitFor(by.button("Abort the build"));
clickButton("Abort the build");
}
}

Expand All @@ -61,12 +56,8 @@ public void writeDescription() {
}
catch (NoSuchElementException ex) {
addAction.click();
try {
waitFor(by.button("Writing the build description"));
clickButton("Writing the build description");
} catch (TimeoutException te) {
clickLink("Writing the build description");
}
waitFor(by.button("Writing the build description"));
clickButton("Writing the build description");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,7 @@ public boolean installPlugins(final PluginSpec... specs) throws UnableToResolveD
tickPluginToInstall(n);
}

// Temporary until https://github.com/jenkinsci/jenkins/pull/8025 is in LTS
if (find(by.button("Download now and install after restart")) != null) {
control(by.button("Download now and install after restart")).clickAndWaitToBecomeStale();
} else {
control(by.button("Update")).clickAndWaitToBecomeStale();
}
control(by.button("Update")).clickAndWaitToBecomeStale();
}
}

Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/jenkinsci/test/acceptance/po/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import hudson.util.VersionNumber;
import java.net.URL;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;

public class User extends ContainerPageObject {

Expand Down Expand Up @@ -99,12 +98,7 @@ public URL getConfigUrl() {
}

public void delete() {
try {
runThenHandleDialog(() -> clickLink("Delete"));
} catch (TimeoutException te) {
visit("delete");
clickButton("Yes");
}
runThenHandleDialog(() -> clickLink("Delete"));
}

@Override
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/org/jenkinsci/test/acceptance/po/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.hamcrest.Description;
import org.jenkinsci.test.acceptance.Matcher;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;

/**
Expand Down Expand Up @@ -57,13 +56,7 @@ public void matchJobs(String regex) {
*/
public void delete() {
configure();
try {
runThenHandleDialog(() -> clickLink("Delete View"));
} catch (TimeoutException te) {
visit("delete");
waitFor(by.button("Yes"));
clickButton("Yes");
}
runThenHandleDialog(() -> clickLink("Delete View"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.jenkinsci.test.acceptance.junit.Resource;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;

Expand All @@ -51,12 +50,7 @@ public void set(String text) {
// As of JENKINS-28769, the textarea is set display: none due to the ACE editor, so CapybaraPortingLayerImpl.find, called by super.resolve, calls isDisplayed and fails.
// Anyway we cannot use the web driver to interact with the hidden textarea.
// Some code cannibalized from #45:
String cssSelector;
try {
cssSelector = waitFor("#workflow-editor-1");
} catch (TimeoutException e) {
cssSelector = waitFor("#workflow-editor");
}
String cssSelector = waitFor("#workflow-editor-1");
executeScript(
"var targets = document.getElementsBySelector(arguments[0]);" +
"if (!targets || targets.length === 0) {" +
Expand Down
7 changes: 1 addition & 6 deletions src/test/java/plugins/JobDslPluginTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -916,13 +916,8 @@ public void are_columns_created() {
assertThat(view, containsColumnHeader("Last Duration"));

String searchText = "Schedule a Build for " + job1.name;
// behaviour change in https://github.com/jenkinsci/jenkins/pull/6084
WebElement webElement = view.getElement(By.cssSelector(String.format("a[tooltip='%s']", searchText)));
if (webElement != null) {
assertThat(view, containsLinkWithTooltip(searchText));
} else {
assertThat(view, containsSvgWithText(searchText));
}
assertThat(view, containsLinkWithTooltip(searchText));
}

/**
Expand Down

0 comments on commit 7c0e2f7

Please sign in to comment.