From ff1f5557ee79177c4be371366a8eb92b1f659cc1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 14:39:19 -0500 Subject: [PATCH] test(client-assets): update test for relative app bundle location (#1830) (#1831) * test(client-assets): update test for relative app bundle location * add test for relative base href (cherry picked from commit 1e2efdaacd5e46803f81d0e901cbcb8fd94a6495) Co-authored-by: Andrew Azores --- src/test/java/itest/ClientAssetsIT.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/itest/ClientAssetsIT.java b/src/test/java/itest/ClientAssetsIT.java index 73da9bec55..99f51bc395 100644 --- a/src/test/java/itest/ClientAssetsIT.java +++ b/src/test/java/itest/ClientAssetsIT.java @@ -59,6 +59,18 @@ public void indexHtmlShouldHaveTitle() { MatcherAssert.assertThat(titles.first().text(), Matchers.equalTo("Cryostat")); } + @Test + public void indexHtmlShouldHaveRelativeBaseHref() { + Elements head = doc.getElementsByTag("head"); + MatcherAssert.assertThat("Expected one ", head.size(), Matchers.equalTo(1)); + + Elements bases = head.first().getElementsByTag("base"); + MatcherAssert.assertThat("Expected one ", bases.size(), Matchers.equalTo(1)); + + Element base = bases.get(0); + MatcherAssert.assertThat(base.attr("href"), Matchers.equalTo("./")); + } + @Test public void indexHtmlShouldHaveScriptTag() { Elements head = doc.getElementsByTag("head"); @@ -72,7 +84,7 @@ public void indexHtmlShouldHaveScriptTag() { boolean foundAppBundle = false; for (Element el : scripts) { - foundAppBundle |= el.attr("src").matches("^/app(?:.\\w*)?\\.bundle\\.js$"); + foundAppBundle |= el.attr("src").matches("^app(?:.\\w*)?\\.bundle\\.js$"); } Assertions.assertTrue(foundAppBundle, "No app.bundle.js script tag found"); }