From 23329d3e4fa5bc7e6f8be21d247329d6c3a002fd Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Sat, 20 Aug 2022 11:52:50 +0200 Subject: [PATCH] #400 - fixed selenium tests --- .../templates/transactions/transactions.ftl | 12 ++-- .../helpers/TransactionTestHelper.java | 15 ++--- .../integration/selenium/AccountTest.java | 2 +- .../selenium/DeleteDatabaseTest.java | 17 ++++-- .../NewTransactionFromExistingOneTest.java | 8 +-- .../selenium/NewTransactionNormalTest.java | 57 +++++++++++++------ .../selenium/NewTransactionRecurringTest.java | 48 +++++++++++----- .../selenium/NewTransactionTransferTest.java | 17 +++--- 8 files changed, 114 insertions(+), 62 deletions(-) diff --git a/BudgetMasterServer/src/main/resources/templates/transactions/transactions.ftl b/BudgetMasterServer/src/main/resources/templates/transactions/transactions.ftl index e6ce8d4db..b2f61698c 100644 --- a/BudgetMasterServer/src/main/resources/templates/transactions/transactions.ftl +++ b/BudgetMasterServer/src/main/resources/templates/transactions/transactions.ftl @@ -57,10 +57,14 @@ <#assign transactionDate=dateService.getDateStringWithoutYear(transaction.date)/> <#if transactionDate != lastDate> - <div class="col s12 left-align bold transaction-text transaction-date"> - ${transactionDate} - </div> - <#assign lastDate=transactionDate/> + <#if !transaction?is_first> + </div> <#-- close "transaction-date-group" div from previous loop iteration --> + </#if> + <div class="transaction-date-group"> + <div class="col s12 left-align bold transaction-text transaction-date"> + ${transactionDate} + </div> + <#assign lastDate=transactionDate/> </#if> <div class="hide-on-large-only transaction-row-top card transaction-card background-light <#if transaction.isFuture()>transaction-row-transparent</#if> <#if shouldHighlight>background-blue-light transaction-row-transparent-override" id="highlighted-small"<#else>"</#if>> diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/helpers/TransactionTestHelper.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/helpers/TransactionTestHelper.java index 9e489fe65..b211351fe 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/helpers/TransactionTestHelper.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/helpers/TransactionTestHelper.java @@ -16,19 +16,16 @@ import static org.assertj.core.api.Assertions.assertThat; public class TransactionTestHelper { - public static void assertTransactionColumns(List<WebElement> columns, String shortDate, String categoryName, String categoryColor, boolean repeatIconVisible, boolean transferIconIsVisible, String name, String description, String amount) + public static void assertTransactionColumns(List<WebElement> columns, String categoryName, String categoryColor, boolean repeatIconVisible, boolean transferIconIsVisible, String name, String description, String amount) { - // date - assertThat(columns.get(0)).hasFieldOrPropertyWithValue("text", shortDate); - // category - final WebElement categoryCircle = columns.get(1).findElement(By.className("category-circle")); + final WebElement categoryCircle = columns.get(0).findElement(By.className("category-circle")); assertThat(categoryCircle.getCssValue("background-color")).isEqualTo(categoryColor); categoryName = categoryName.substring(0, 1).toUpperCase(); assertThat(categoryCircle.findElement(By.tagName("span"))).hasFieldOrPropertyWithValue("text", categoryName); // icon - final List<WebElement> icons = columns.get(2).findElements(By.tagName("i")); + final List<WebElement> icons = columns.get(1).findElements(By.tagName("i")); assertThat(icons).hasSize(determineNumberOfTransactionTypeIcons(repeatIconVisible, transferIconIsVisible)); assertThat(icons.get(0).isDisplayed()).isEqualTo(repeatIconVisible || transferIconIsVisible); if(repeatIconVisible) @@ -41,19 +38,19 @@ public class TransactionTestHelper } // name - assertThat(columns.get(3).findElement(By.className("transaction-text")).getText()) + assertThat(columns.get(2).findElement(By.className("transaction-text")).getText()) .isEqualTo(name); //description if(description != null) { - assertThat(columns.get(3).findElement(By.className("italic")).getText()) + assertThat(columns.get(2).findElement(By.className("italic")).getText()) .isEqualTo(description); } // amount - assertThat(columns.get(4).getText()).contains(amount); + assertThat(columns.get(3).getText()).contains(amount); } private static int determineNumberOfTransactionTypeIcons(boolean repeatIconVisible, boolean transferIconIsVisible) diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/AccountTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/AccountTest.java index 9fc242ecb..1066cf323 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/AccountTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/AccountTest.java @@ -349,7 +349,7 @@ class AccountTest extends SeleniumTestBase final List<WebElement> columns = row.findElements(By.className("col")); // check columns - final List<WebElement> icons = columns.get(5).findElements(By.tagName("i")); + final List<WebElement> icons = columns.get(4).findElements(By.tagName("i")); assertThat(icons).hasSize(1); assertThat(icons.get(0).getText()).isEqualTo("content_copy"); } diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/DeleteDatabaseTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/DeleteDatabaseTest.java index 73e44514e..b06bfcce1 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/DeleteDatabaseTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/DeleteDatabaseTest.java @@ -65,10 +65,17 @@ class DeleteDatabaseTest extends SeleniumTestBase // assert only transaction "rest" is showing TransactionTestHelper.selectGlobalAccountByName(driver, "Default Account"); TransactionTestHelper.gotoSpecificYearAndMonth(driver, 2022, "March"); - final List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); - assertThat(transactionsRows).hasSize(1); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - TransactionTestHelper.assertTransactionColumns(columns, "01.03.", "Rest", "rgb(255, 255, 0)", false, false, "Rest", null, "0.00"); + + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + assertThat(transactionDateGroups).hasSize(1); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", "01.03."); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + assertThat(transactionsInGroup).hasSize(1); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + TransactionTestHelper.assertTransactionColumns(columns, "Rest", "rgb(255, 255, 0)", false, false, "Rest", null, "0.00"); } } \ No newline at end of file diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromExistingOneTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromExistingOneTest.java index bd9c0ed8d..137e40484 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromExistingOneTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromExistingOneTest.java @@ -49,7 +49,7 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); List<WebElement> columns = transactionsRows.get(0).findElements(By.className("col")); - columns.get(5).findElement(By.className("button-new-from-existing")).click(); + columns.get(4).findElement(By.className("button-new-from-existing")).click(); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "New Transaction")); @@ -87,7 +87,7 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); List<WebElement> columns = transactionsRows.get(0).findElements(By.className("col")); - columns.get(5).findElement(By.className("button-new-from-existing")).click(); + columns.get(4).findElement(By.className("button-new-from-existing")).click(); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "New Transfer")); @@ -125,7 +125,7 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); List<WebElement> columns = transactionsRows.get(0).findElements(By.className("col")); - columns.get(5).findElement(By.className("button-new-from-existing")).click(); + columns.get(4).findElement(By.className("button-new-from-existing")).click(); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "New Transaction")); @@ -159,7 +159,7 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); List<WebElement> columns = transactionsRows.get(0).findElements(By.className("col")); - columns.get(5).findElement(By.className("button-new-from-existing")).click(); + columns.get(4).findElement(By.className("button-new-from-existing")).click(); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "New Transaction")); diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionNormalTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionNormalTest.java index 166a67895..6c5ecb986 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionNormalTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionNormalTest.java @@ -114,12 +114,18 @@ class NewTransactionNormalTest extends SeleniumTestBase transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSize(numberOfTransactionsBefore + 1); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", false, false, name, description, amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", false, false, name, description, amount); } @Test @@ -156,12 +162,19 @@ class NewTransactionNormalTest extends SeleniumTestBase transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSize(numberOfTransactionsBefore + 1); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", false, false, name, description, "-" + amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", false, false, name, description, "-" + amount); } @Test @@ -282,12 +295,18 @@ class NewTransactionNormalTest extends SeleniumTestBase transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSize(numberOfTransactionsBefore + 1); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", false, false, name, null, "-" + amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", false, false, name, null, "-" + amount); } @Test @@ -358,11 +377,17 @@ class NewTransactionNormalTest extends SeleniumTestBase transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSize(numberOfTransactionsBefore + 1); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", false, false, name, null, amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", false, false, name, null, amount); } } \ No newline at end of file diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionRecurringTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionRecurringTest.java index f8c293d0e..1d450648e 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionRecurringTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionRecurringTest.java @@ -73,10 +73,10 @@ class NewTransactionRecurringTest extends SeleniumTestBase for(WebElement row : transactionsRows) { final List<WebElement> columns = row.findElements(By.className("col")); - final String name = columns.get(3).findElement(By.className("transaction-text")).getText(); + final String name = columns.get(2).findElement(By.className("transaction-text")).getText(); if(name.equals(TRANSACTION_NAME)) { - columns.get(5).findElements(By.tagName("a")).get(1).click(); + columns.get(4).findElements(By.tagName("a")).get(1).click(); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("#modalConfirmDelete .modal-content h4"), "Delete Entry")); @@ -134,12 +134,18 @@ class NewTransactionRecurringTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSizeGreaterThan(2); - final WebElement row = transactionsRows.get(transactionsRows.size() - 2); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(transactionDateGroups.size() - 2); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", true, false, TRANSACTION_NAME, description, amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", true, false, TRANSACTION_NAME, description, amount); } @Test @@ -190,12 +196,18 @@ class NewTransactionRecurringTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSizeGreaterThan(2); - final WebElement row = transactionsRows.get(transactionsRows.size() - 2); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(transactionDateGroups.size() - 2); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", true, false, TRANSACTION_NAME, description, "-" + amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", true, false, TRANSACTION_NAME, description, "-" + amount); } @Test @@ -246,15 +258,21 @@ class NewTransactionRecurringTest extends SeleniumTestBase List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); assertThat(transactionsRows).hasSizeGreaterThan(2); - final WebElement row = transactionsRows.get(transactionsRows.size() - 2); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(transactionDateGroups.size() - 2); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); + + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", true, true, TRANSACTION_NAME, description, amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", true, true, TRANSACTION_NAME, description, amount); // open transaction in edit view again - columns.get(5).findElement(By.cssSelector("a")).click(); + columns.get(4).findElement(By.cssSelector("a")).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "Edit " + type)); assertThat(driver.findElement(By.cssSelector(".account-select-wrapper .custom-select-selected-item .category-circle")).getAttribute("data-value")).isEqualTo("2"); diff --git a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionTransferTest.java b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionTransferTest.java index 9fcddb36a..a4f45e162 100644 --- a/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionTransferTest.java +++ b/BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionTransferTest.java @@ -13,9 +13,7 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.io.File; -import java.text.SimpleDateFormat; import java.time.Duration; -import java.util.Date; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -112,15 +110,18 @@ class NewTransactionTransferTest extends SeleniumTestBase // assert assertThat(driver.getCurrentUrl()).endsWith("/transactions"); - List<WebElement> transactionsRows = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); - assertThat(transactionsRows).hasSize(2); + final List<WebElement> transactionDateGroups = driver.findElements(By.className("transaction-date-group")); + + final WebElement dateGroup = transactionDateGroups.get(0); + assertThat(dateGroup.findElement(By.className("transaction-date"))).hasFieldOrPropertyWithValue("text", TransactionTestHelper.getDateString(day)); + final List<WebElement> transactionsInGroup = driver.findElements(By.cssSelector(".transaction-container .hide-on-med-and-down.transaction-row-top")); - final WebElement row = transactionsRows.get(0); - final List<WebElement> columns = row.findElements(By.className("col")); - assertThat(columns).hasSize(6); + final WebElement transactionRow = transactionsInGroup.get(0); + final List<WebElement> columns = transactionRow.findElements(By.className("col")); + assertThat(columns).hasSize(5); // check columns - TransactionTestHelper.assertTransactionColumns(columns, TransactionTestHelper.getDateString(day), categoryName, "rgb(46, 124, 43)", false, true, name, description, amount); + TransactionTestHelper.assertTransactionColumns(columns, categoryName, "rgb(46, 124, 43)", false, true, name, description, amount); } @Test -- GitLab