mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-26 19:15:09 +00:00
Enable new Manage Jenkins UI by default (#26999)
This commit is contained in:
1 parent
e2ba107d13
commit
846b53f610
5 files changed
+24
-17
No files matched your search
@@ -94,7 +94,7 @@ class AboutJenkinsTest {
|
||||
wc.login(ADMIN);
|
||||
HtmlPage page = wc.goTo("about/");
|
||||
assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
|
||||
assertThat(page.getWebResponse().getContentAsString(), containsString("Mavenized dependencies"));
|
||||
assertThat(page.querySelector("body").asXml(), containsString("Mavenized dependencies"));
|
||||
}
|
||||
|
||||
{ // manager can access it
|
||||
|
||||
@@ -27,8 +27,8 @@ package hudson.model;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import org.htmlunit.html.DomNodeUtil;
|
||||
import org.htmlunit.html.DomNode;
|
||||
import org.htmlunit.html.DomNodeList;
|
||||
import org.htmlunit.html.HtmlAnchor;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -60,14 +60,15 @@ class ManagementLinkTest {
|
||||
@WithTimeout(300)
|
||||
void links() throws Exception {
|
||||
WebClient wc = j.createWebClient();
|
||||
HtmlPage page = wc.goTo("manage");
|
||||
|
||||
for (int i = 0; ; i++) {
|
||||
HtmlPage page = wc.goTo("manage");
|
||||
List<?> anchors = DomNodeUtil.selectNodes(page, "//div[contains(@class,'jenkins-section__item')]/a[not(contains(@class,'confirmation-link'))]");
|
||||
assertTrue(anchors.size() >= 8);
|
||||
if (i == anchors.size()) return; // done
|
||||
DomNodeList<DomNode> anchors = page.querySelectorAll("a.task-link:not(.confirmation-link)");
|
||||
assertTrue(anchors.size() >= 8);
|
||||
|
||||
((HtmlAnchor) anchors.get(i)).click();
|
||||
String prefix = j.contextPath + '/';
|
||||
for (DomNode anchor : anchors) {
|
||||
System.out.println(((HtmlAnchor) anchor).getHrefAttribute());
|
||||
wc.goTo(((HtmlAnchor) anchor).getHrefAttribute().substring(prefix.length()), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class Jenkins64991Test {
|
||||
|
||||
final Page redirectedPage = HtmlFormUtil.submit(loginPage.getFormByName("login"));
|
||||
assertTrue(redirectedPage.isHtmlPage());
|
||||
assertEquals(j.getURL() + "manage/", redirectedPage.getUrl().toExternalForm());
|
||||
assertEquals(j.getURL() + "manage/configure", redirectedPage.getUrl().toExternalForm());
|
||||
assertThat(redirectedPage.getWebResponse().getContentAsString(), containsStringIgnoringCase(Messages.GlobalSecurityConfiguration_DisplayName()));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CspHeaderDeciderTest {
|
||||
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
htmlPage.getWebResponse().getContentAsString(),
|
||||
htmlPage.querySelector("body").asXml(),
|
||||
hasBlurb(jellyResource(DevelopmentHeaderDecider.class, "message.properties")));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), not(nullValue()));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), nullValue());
|
||||
@@ -67,7 +67,7 @@ public class CspHeaderDeciderTest {
|
||||
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
htmlPage.getWebResponse().getContentAsString().replace("Content-Security-Policy", "{0}"),
|
||||
htmlPage.querySelector("body").asXml().replace("Content-Security-Policy", "{0}"),
|
||||
hasBlurb(jellyResource(SystemPropertyHeaderDecider.class, "message.properties")));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), not(nullValue()));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), nullValue());
|
||||
@@ -92,7 +92,7 @@ public class CspHeaderDeciderTest {
|
||||
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
htmlPage.getWebResponse().getContentAsString().replace("Content-Security-Policy-Report-Only", "{0}"),
|
||||
htmlPage.querySelector("body").asXml().replace("Content-Security-Policy-Report-Only", "{0}"),
|
||||
hasBlurb(jellyResource(SystemPropertyHeaderDecider.class, "message.properties")));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), nullValue());
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), not(nullValue()));
|
||||
@@ -117,7 +117,7 @@ public class CspHeaderDeciderTest {
|
||||
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
htmlPage.getWebResponse().getContentAsString(),
|
||||
htmlPage.querySelector("body").asXml(),
|
||||
hasMessage(jellyResource(SystemPropertyHeaderDecider.class, "message.properties"), "blurbUnset"));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), nullValue());
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), nullValue());
|
||||
@@ -142,7 +142,7 @@ public class CspHeaderDeciderTest {
|
||||
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
htmlPage.getWebResponse().getContentAsString(),
|
||||
htmlPage.querySelector("body").asXml(),
|
||||
allOf(
|
||||
hasBlurb(jellyResource(DevelopmentHeaderDecider.class, "message.properties")),
|
||||
not(hasBlurb(jellyResource(SystemPropertyHeaderDecider.class, "message.properties")))));
|
||||
@@ -172,7 +172,7 @@ public class CspHeaderDeciderTest {
|
||||
final HtmlPage htmlPage = webClient.goTo("configureSecurity");
|
||||
assertThat(
|
||||
// Workaround to placeholder for context path in this string
|
||||
htmlPage.getWebResponse().getContentAsString().replace("/jenkins/", "{0}/"),
|
||||
htmlPage.querySelector("body").asXml().replace("/jenkins/", "{0}/"),
|
||||
hasBlurb(jellyResource(FallbackDecider.class, "message.properties")));
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), nullValue());
|
||||
assertThat(htmlPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), not(nullValue()));
|
||||
@@ -220,7 +220,7 @@ public class CspHeaderDeciderTest {
|
||||
assertFalse(ExtensionList.lookupSingleton(CspRecommendation.class).isActivated());
|
||||
|
||||
// We can see the checkbox now
|
||||
assertThat(setupPage.getWebResponse().getContentAsString(), containsString("Enforce Content Security Policy"));
|
||||
assertThat(setupPage.querySelector("body").asXml(), containsString("Enforce Content Security Policy"));
|
||||
assertThat(setupPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy"), nullValue());
|
||||
assertThat(setupPage.getWebResponse().getResponseHeaderValue("Content-Security-Policy-Report-Only"), not(nullValue()));
|
||||
|
||||
|
||||
Reference in new issue
Block a user