Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
51c9c8f7
Commit
51c9c8f7
authored
2 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#731 - added selenium tests
parent
86b4e033
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/CsvImportTest.java
+59
-5
59 additions, 5 deletions
...ker8/budgetmaster/integration/selenium/CsvImportTest.java
with
59 additions
and
5 deletions
BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/CsvImportTest.java
+
59
−
5
View file @
51c9c8f7
...
...
@@ -203,7 +203,7 @@ class CsvImportTest extends SeleniumTestBase
assertThat
(
driver
.
findElement
(
By
.
id
(
"csv-file-name"
)).
getText
()).
isEqualTo
(
"three_entries.csv"
);
fillColumnSettings
(
1
,
""
,
2
,
3
,
2
);
fillColumnSettings
(
1
,
""
,
2
,
3
,
"."
,
","
,
2
);
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
cssSelector
(
"#datePattern.invalid"
)));
...
...
@@ -226,7 +226,7 @@ class CsvImportTest extends SeleniumTestBase
assertThat
(
driver
.
findElement
(
By
.
id
(
"csv-file-name"
)).
getText
()).
isEqualTo
(
"three_entries.csv"
);
fillColumnSettings
(-
3
,
"dd.MM.yyyy"
,
200
,
-
12
,
115
);
fillColumnSettings
(-
3
,
"dd.MM.yyyy"
,
200
,
-
12
,
"."
,
","
,
115
);
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
cssSelector
(
"#columnDate.invalid"
)));
...
...
@@ -237,6 +237,52 @@ class CsvImportTest extends SeleniumTestBase
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#columnDescription.invalid"
))).
isNotNull
();
}
@Test
void
test_upload_emptyDecimalSeparator_showValidationError
()
{
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
();
uploadCsv
(
csvPath
,
";"
,
"UTF-8"
,
"1"
);
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
,
""
,
2
,
3
,
""
,
","
,
2
);
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
cssSelector
(
"#decimalSeparator.invalid"
)));
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#decimalSeparator.invalid"
))).
isNotNull
();
}
@Test
void
test_upload_emptyGroupingSeparator_showValidationError
()
{
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
();
uploadCsv
(
csvPath
,
";"
,
"UTF-8"
,
"1"
);
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
,
""
,
2
,
3
,
""
,
","
,
2
);
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
cssSelector
(
"#decimalSeparator.invalid"
)));
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#decimalSeparator.invalid"
))).
isNotNull
();
}
@Test
void
test_upload_valid
()
{
...
...
@@ -268,7 +314,7 @@ class CsvImportTest extends SeleniumTestBase
assertThat
(
driver
.
findElement
(
By
.
id
(
"csv-file-name"
)).
getText
()).
isEqualTo
(
"three_entries.csv"
);
fillColumnSettings
(
1
,
"dd.MM.yyyy"
,
2
,
3
,
2
);
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"
)));
...
...
@@ -494,7 +540,7 @@ class CsvImportTest extends SeleniumTestBase
assertThat
(
columns
.
get
(
1
).
getText
()).
isEqualTo
(
"Lorem"
);
assertThat
(
columns
.
get
(
2
).
getText
()).
isEqualTo
(
"50.00"
);
fillColumnSettings
(
1
,
"dd.MM.yyyy"
,
2
,
3
,
2
);
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"
)));
...
...
@@ -519,7 +565,7 @@ class CsvImportTest extends SeleniumTestBase
driver
.
findElement
(
By
.
id
(
"button-confirm-csv-import"
)).
click
();
}
private
void
fillColumnSettings
(
int
columnDate
,
String
datePattern
,
int
columnName
,
int
columnAmount
,
int
columnDescription
)
private
void
fillColumnSettings
(
int
columnDate
,
String
datePattern
,
int
columnName
,
int
columnAmount
,
String
decimalSeparator
,
String
groupingSeparator
,
int
columnDescription
)
{
final
WebElement
columnDateInput
=
driver
.
findElement
(
By
.
name
(
"columnDate"
));
columnDateInput
.
clear
();
...
...
@@ -537,6 +583,14 @@ class CsvImportTest extends SeleniumTestBase
columnAmountInput
.
clear
();
columnAmountInput
.
sendKeys
(
String
.
valueOf
(
columnAmount
));
final
WebElement
decimalSeparatorInput
=
driver
.
findElement
(
By
.
name
(
"decimalSeparator"
));
decimalSeparatorInput
.
clear
();
decimalSeparatorInput
.
sendKeys
(
String
.
valueOf
(
decimalSeparator
));
final
WebElement
groupingSeparatorInput
=
driver
.
findElement
(
By
.
name
(
"groupingSeparator"
));
groupingSeparatorInput
.
clear
();
groupingSeparatorInput
.
sendKeys
(
String
.
valueOf
(
groupingSeparator
));
final
WebElement
columnDescriptionInput
=
driver
.
findElement
(
By
.
name
(
"columnDescription"
));
columnDescriptionInput
.
clear
();
columnDescriptionInput
.
sendKeys
(
String
.
valueOf
(
columnDescription
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment