From ddeb3b4b21b083c7a1a52c5cfa16b0d9e6adbb7b Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sat, 18 May 2024 09:51:53 +0100 Subject: [PATCH 1/2] Update WorkflowJobTest.java --- .../plugins/workflow/job/WorkflowJobTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java b/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java index 1a3ef6e3..533e19d6 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java @@ -116,15 +116,25 @@ public void addAction() throws Exception { assertFalse(p.isDisabled()); assertTrue(p.isBuildable()); JenkinsRule.WebClient wc = j.createWebClient(); - j.submit(wc.getPage(p).getHtmlElementById("disable-project")); - assertTrue(p.isDisabled()); - assertFalse(p.isBuildable()); + + // Disable the project HtmlForm form = wc.getPage(p, "configure").getFormByName("config"); HtmlCheckBoxInput checkbox = form.getInputByName("enable"); + assertTrue(checkbox.isChecked()); + checkbox.setChecked(false); + j.submit(form); + assertTrue(p.isDisabled()); + assertFalse(p.isBuildable()); + + // Re-enable the project + form = wc.getPage(p, "configure").getFormByName("config"); + checkbox = form.getInputByName("enable"); assertFalse(checkbox.isChecked()); - checkbox.setChecked(true); + checkbox.setChecked(false); j.submit(form); assertFalse(p.isDisabled()); + assertTrue(p.isBuildable()); + wc.getPage(new WebRequest(wc.createCrumbedUrl(p.getUrl() + "disable"), HttpMethod.POST)); assertTrue(p.isDisabled()); assertNull(p.scheduleBuild2(0)); From 22a0edd01d2c6e94f7bcaf3d5d28676d5423791a Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Sun, 19 May 2024 11:04:25 +0100 Subject: [PATCH 2/2] Update WorkflowJobTest.java --- .../org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java b/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java index 533e19d6..39ff9b44 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java @@ -130,7 +130,7 @@ public void addAction() throws Exception { form = wc.getPage(p, "configure").getFormByName("config"); checkbox = form.getInputByName("enable"); assertFalse(checkbox.isChecked()); - checkbox.setChecked(false); + checkbox.setChecked(true); j.submit(form); assertFalse(p.isDisabled()); assertTrue(p.isBuildable());