Skip to content

Commit

Permalink
#724 - assert parse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlocker8 committed Jan 21, 2023
1 parent 64c0e6d commit 8355cc1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<#if csvTransactions??>
<@renderCsvTransactions/>
<@showColumnSettingsErrors/>
<@showColumnSettingsErrors />
<#elseif csvRows?? >
<div class="container">
<div class="section center-align">
Expand Down Expand Up @@ -294,7 +294,7 @@

<#macro showColumnSettingsErrors>
<#if errorsColumnSettings?has_content>
<div class="container">
<div class="container" id="parseErrors">
<div class="row">
<div class="col s12">
<ul class="collapsible">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,32 @@ void test_upload_valid()
assertRow(row3, "blue", "2023-01-03", "No category", "Lorem", "Lorem", "50.00 €");
}

@Test
void test_upload_valid_parseErrors()
{
driver.get(helper.getUrl() + "/transactionImport");
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "Import from bank CSV"));

final String csvPath = new File(getClass().getClassLoader().getResource("csv/three_entries.csv").getFile()).getAbsolutePath();

// skip zero lines, so first line will lead to parse error because it is the row containing the column names
uploadCsv(csvPath, ";", "UTF-8", "0");
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("button-cancel-csv-import")));

assertThat(driver.findElement(By.id("csv-file-name")).getText()).isEqualTo("three_entries.csv");

fillColumnSettings(1, "dd.MM.yyyy", 2, 3, 2);

wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("button-confirm-csv-column-settings")));

assertThat(driver.findElements(By.className("transaction-import-row"))).hasSize(3);

assertThat(driver.findElements(By.cssSelector("#parseErrors table tr"))).hasSize(1);
}

@Test
void test_cancel()
{
Expand Down

0 comments on commit 8355cc1

Please sign in to comment.