Skip to content
Snippets Groups Projects
Commit aaddd21e authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#577 - added test

parent bff4e319
No related branches found
No related tags found
No related merge requests found
......@@ -169,4 +169,36 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/transactions");
}
@Test
void test_newTransactionFromExisting_transactionFromReadonlyAccount()
{
TransactionTestHelper.selectGlobalAccountByName(driver, "Readonly Account");
gotoSpecificYearAndMonth(2021, "October");
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();
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "New Transaction"));
// assert
assertThat(driver.findElement(By.className("buttonExpenditure")).getAttribute("class")).contains("background-red");
assertThat(driver.findElement(By.id("transaction-name")).getAttribute("value")).isEqualTo("Transaction in readonly account");
assertThat(driver.findElement(By.id("transaction-amount")).getAttribute("value")).isEqualTo("12.00");
// should fall back to default account as the readonly account will not allow new transactions
assertThat(driver.findElement(By.cssSelector(".account-select-wrapper .custom-select-selected-item .category-circle")).getAttribute("data-value")).isEqualTo("3");
// submit form
driver.findElement(By.id("button-save-transaction")).click();
wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".headline-date")));
// assert
assertThat(driver.getCurrentUrl()).endsWith("/transactions");
}
}
\ No newline at end of file
......@@ -3,19 +3,19 @@
"VERSION": 7,
"categories": [
{
"ID": 192,
"ID": 3,
"name": "Custom Category",
"color": "#ff9500",
"type": "CUSTOM"
},
{
"ID": 190,
"ID": 1,
"name": "No Category",
"color": "#FFFFFF",
"type": "NONE"
},
{
"ID": 191,
"ID": 2,
"name": "Rest",
"color": "#FFFF00",
"type": "REST"
......@@ -23,22 +23,28 @@
],
"accounts": [
{
"ID": 169,
"ID": 1,
"name": "Placeholder",
"accountState": "FULL_ACCESS",
"type": "ALL"
},
{
"ID": 170,
"ID": 2,
"name": "Default Account",
"accountState": "FULL_ACCESS",
"type": "CUSTOM"
},
{
"ID": 171,
"ID": 3,
"name": "Second Account",
"accountState": "FULL_ACCESS",
"type": "CUSTOM"
},
{
"ID": 4,
"name": "Readonly Account",
"accountState": "READ_ONLY",
"type": "CUSTOM"
}
],
"transactions": [
......@@ -46,8 +52,8 @@
"amount": -1200,
"isExpenditure": true,
"date": "2021-10-17",
"accountID": 170,
"categoryID": 192,
"accountID": 2,
"categoryID": 3,
"name": "Full normal",
"description": "lorem ipsum",
"tags": [
......@@ -60,8 +66,8 @@
"amount": -1500,
"isExpenditure": true,
"date": "2021-09-17",
"accountID": 170,
"categoryID": 192,
"accountID": 2,
"categoryID": 3,
"name": "Full transfer",
"description": "dolor sit amet",
"tags": [
......@@ -69,14 +75,14 @@
"name": "456"
}
],
"transferAccountID": 171
"transferAccountID": 3
},
{
"amount": -200,
"isExpenditure": true,
"date": "2021-06-17",
"accountID": 170,
"categoryID": 192,
"accountID": 2,
"categoryID": 3,
"name": "normal recurring",
"description": "apple",
"tags": [
......@@ -95,6 +101,16 @@
"times": 1
}
}
},
{
"amount": -1200,
"isExpenditure": true,
"date": "2021-10-19",
"accountID": 4,
"categoryID": 1,
"name": "Transaction in readonly account",
"description": "",
"tags": []
}
],
"templates": [],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment