Skip to content

Commit

Permalink
test(client-assets): update test for relative app bundle location (cr…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Dec 11, 2023
1 parent df7101b commit a626bb9
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 a626bb9

Please sign in to comment.