Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading