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 ...@@ -169,4 +169,36 @@ class NewTransactionFromExistingOneTest extends SeleniumTestBase
// assert // assert
assertThat(driver.getCurrentUrl()).endsWith("/transactions"); 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 @@ ...@@ -3,19 +3,19 @@
"VERSION": 7, "VERSION": 7,
"categories": [ "categories": [
{ {
"ID": 192, "ID": 3,
"name": "Custom Category", "name": "Custom Category",
"color": "#ff9500", "color": "#ff9500",
"type": "CUSTOM" "type": "CUSTOM"
}, },
{ {
"ID": 190, "ID": 1,
"name": "No Category", "name": "No Category",
"color": "#FFFFFF", "color": "#FFFFFF",
"type": "NONE" "type": "NONE"
}, },
{ {
"ID": 191, "ID": 2,
"name": "Rest", "name": "Rest",
"color": "#FFFF00", "color": "#FFFF00",
"type": "REST" "type": "REST"
...@@ -23,22 +23,28 @@ ...@@ -23,22 +23,28 @@
], ],
"accounts": [ "accounts": [
{ {
"ID": 169, "ID": 1,
"name": "Placeholder", "name": "Placeholder",
"accountState": "FULL_ACCESS", "accountState": "FULL_ACCESS",
"type": "ALL" "type": "ALL"
}, },
{ {
"ID": 170, "ID": 2,
"name": "Default Account", "name": "Default Account",
"accountState": "FULL_ACCESS", "accountState": "FULL_ACCESS",
"type": "CUSTOM" "type": "CUSTOM"
}, },
{ {
"ID": 171, "ID": 3,
"name": "Second Account", "name": "Second Account",
"accountState": "FULL_ACCESS", "accountState": "FULL_ACCESS",
"type": "CUSTOM" "type": "CUSTOM"
},
{
"ID": 4,
"name": "Readonly Account",
"accountState": "READ_ONLY",
"type": "CUSTOM"
} }
], ],
"transactions": [ "transactions": [
...@@ -46,8 +52,8 @@ ...@@ -46,8 +52,8 @@
"amount": -1200, "amount": -1200,
"isExpenditure": true, "isExpenditure": true,
"date": "2021-10-17", "date": "2021-10-17",
"accountID": 170, "accountID": 2,
"categoryID": 192, "categoryID": 3,
"name": "Full normal", "name": "Full normal",
"description": "lorem ipsum", "description": "lorem ipsum",
"tags": [ "tags": [
...@@ -60,8 +66,8 @@ ...@@ -60,8 +66,8 @@
"amount": -1500, "amount": -1500,
"isExpenditure": true, "isExpenditure": true,
"date": "2021-09-17", "date": "2021-09-17",
"accountID": 170, "accountID": 2,
"categoryID": 192, "categoryID": 3,
"name": "Full transfer", "name": "Full transfer",
"description": "dolor sit amet", "description": "dolor sit amet",
"tags": [ "tags": [
...@@ -69,14 +75,14 @@ ...@@ -69,14 +75,14 @@
"name": "456" "name": "456"
} }
], ],
"transferAccountID": 171 "transferAccountID": 3
}, },
{ {
"amount": -200, "amount": -200,
"isExpenditure": true, "isExpenditure": true,
"date": "2021-06-17", "date": "2021-06-17",
"accountID": 170, "accountID": 2,
"categoryID": 192, "categoryID": 3,
"name": "normal recurring", "name": "normal recurring",
"description": "apple", "description": "apple",
"tags": [ "tags": [
...@@ -95,6 +101,16 @@ ...@@ -95,6 +101,16 @@
"times": 1 "times": 1
} }
} }
},
{
"amount": -1200,
"isExpenditure": true,
"date": "2021-10-19",
"accountID": 4,
"categoryID": 1,
"name": "Transaction in readonly account",
"description": "",
"tags": []
} }
], ],
"templates": [], "templates": [],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment