Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
- Check for source files
- Check for Google font, which gets packaged indepdently
- Check for results of custom.css getting correctly compiled
- Check for bootstrap layout
  • Loading branch information
scroix committed Apr 7, 2024
1 parent 7315692 commit 326fc65
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions nodel-jyhost/src/test/java/org/nodel/PlaywrightTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,54 @@ public void testActiveNavigationItem() {
assertEquals("Locals", activeNavItemText, "Active navigation item should be 'Locals'");
}

@Test
public void testSourceFileAvailability() {
APIResponse response = page.request().get("http://127.0.0.1:8085/v1/css/components.default.css");
assertEquals(200, response.status(), "components.default.css should be available");

response = page.request().get("http://127.0.0.1:8085/v1/img/logo.png");
assertEquals(200, response.status(), "logo.png should be available");

response = page.request().get("http://127.0.0.1:8085/v1/js/components.min.js");
assertEquals(200, response.status(), "components.min.js should be available");

response = page.request().get("http://127.0.0.1:8085/v1/js/nodel.js");
assertEquals(200, response.status(), "nodel.js should be available");
}

@Test
public void testFontFamily() {
String fontFamily = page.evaluate("() => window.getComputedStyle(document.body).getPropertyValue('font-family')").toString();
assertTrue(fontFamily.contains("Roboto"), "Font family should include Roboto");
}

@Test
public void testBootstrapLayout() {
assertNotNull(page.querySelector("div.row > div.col-sm-12"), "Bootstrap row and column should be present");
}

@Test
public void testNodelAddElement() {
assertNotNull(page.querySelector(".nodel-add"), ".nodel-add should be present");
}

@Test
public void testListGroupItems() {
assertNotNull(page.querySelector(".list-group-item"), "list-group-item elements should be present");
}

@Test
public void testListGroupItemBorder() {
String border = page.evaluate("() => window.getComputedStyle(document.querySelector('.list-group-basic .list-group-item')).getPropertyValue('border')").toString();
assertEquals("none", border, "list-group-item elements should have border: none");
}

@Test
public void testNodelAddButtonMargin() {
String marginBottom = page.evaluate("() => window.getComputedStyle(document.querySelector('.nodel-add .btn')).getPropertyValue('margin-bottom')").toString();
assertEquals("5px", marginBottom, ".nodel-add .btn should have margin-bottom: 5px");
}

@AfterAll
public static void tearDown() {
if (browser != null) {
Expand Down

0 comments on commit 326fc65

Please sign in to comment.