Skip to content

Commit

Permalink
test(client-assets): update test for relative app bundle location (#1830
Browse files Browse the repository at this point in the history
) (#1831)

* test(client-assets): update test for relative app bundle location

* add test for relative base href

(cherry picked from commit 1e2efda)

Co-authored-by: Andrew Azores <[email protected]>
  • Loading branch information
mergify[bot] and andrewazores authored Dec 11, 2023
1 parent 47b5fc9 commit ff1f555
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/test/java/itest/ClientAssetsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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>", head.size(), Matchers.equalTo(1));

Elements bases = head.first().getElementsByTag("base");
MatcherAssert.assertThat("Expected one <base>", 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");
Expand All @@ -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");
}
Expand Down

0 comments on commit ff1f555

Please sign in to comment.