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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
4aa6b96e
Commit
4aa6b96e
authored
4 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#533 - added integration tests
parent
f4f4fca7
No related branches found
No related tags found
No related merge requests found
Pipeline
#4070
failed
4 years ago
Stage: external
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromTemplateTest.java
+177
-3
177 additions, 3 deletions
.../integration/selenium/NewTransactionFromTemplateTest.java
with
177 additions
and
3 deletions
src/test/java/de/deadlocker8/budgetmaster/integration/selenium/NewTransactionFromTemplateTest.java
+
177
−
3
View file @
4aa6b96e
...
@@ -4,7 +4,7 @@ import de.deadlocker8.budgetmaster.Main;
...
@@ -4,7 +4,7 @@ import de.deadlocker8.budgetmaster.Main;
import
de.deadlocker8.budgetmaster.authentication.UserService
;
import
de.deadlocker8.budgetmaster.authentication.UserService
;
import
de.deadlocker8.budgetmaster.integration.helpers.IntegrationTestHelper
;
import
de.deadlocker8.budgetmaster.integration.helpers.IntegrationTestHelper
;
import
de.deadlocker8.budgetmaster.integration.helpers.SeleniumTest
;
import
de.deadlocker8.budgetmaster.integration.helpers.SeleniumTest
;
import
de.
deadlocker8.budgetmaster.integration.helpers.TransactionTestHelper
;
import
de.
thecodelabs.utils.util.Localization
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -13,6 +13,7 @@ import org.junit.rules.TestWatcher;
...
@@ -13,6 +13,7 @@ import org.junit.rules.TestWatcher;
import
org.junit.runner.Description
;
import
org.junit.runner.Description
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.Keys
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
...
@@ -25,9 +26,7 @@ import org.springframework.test.annotation.DirtiesContext;
...
@@ -25,9 +26,7 @@ import org.springframework.test.annotation.DirtiesContext;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.io.File
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -130,4 +129,179 @@ public class NewTransactionFromTemplateTest
...
@@ -130,4 +129,179 @@ public class NewTransactionFromTemplateTest
// assert
// assert
assertThat
(
driver
.
findElement
(
By
.
className
(
"buttonIncome"
)).
getAttribute
(
"class"
)).
contains
(
"budgetmaster-green"
);
assertThat
(
driver
.
findElement
(
By
.
className
(
"buttonIncome"
)).
getAttribute
(
"class"
)).
contains
(
"budgetmaster-green"
);
}
}
@Test
public
void
test_selectTemplateHotkeys_initialSelect
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
// assert
assertThat
(
templateItemHeaders
).
hasSize
(
2
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_keyDown
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_DOWN
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_keyDown_goBackToTopFromLastItem
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_DOWN
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_DOWN
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_keyUp_goBackToBottomFromFirstItem
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_UP
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_keyUp
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_UP
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_UP
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_confirmSelection
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
final
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ENTER
);
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"New Transaction"
));
}
@Test
public
void
test_selectTemplateHotkeys_searchContainsSelection
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_DOWN
);
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
"emp"
);
// assert
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
).
hasSize
(
2
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_searchNotContainsSelection
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
Keys
.
ARROW_DOWN
);
List
<
WebElement
>
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item .collapsible-header"
));
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
doesNotContain
(
"template-selected"
);
assertThat
(
templateItemHeaders
.
get
(
1
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
driver
.
findElement
(
By
.
id
(
"searchTemplate"
)).
sendKeys
(
"Income"
);
// assert
templateItemHeaders
=
driver
.
findElements
(
By
.
cssSelector
(
".template-item:not(.hidden) .collapsible-header"
));
assertThat
(
templateItemHeaders
).
hasSize
(
1
);
assertThat
(
templateItemHeaders
.
get
(
0
).
getAttribute
(
"class"
)).
contains
(
"template-selected"
);
}
@Test
public
void
test_selectTemplateHotkeys_dontBlockEnterInGlobalSearch
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/templates"
);
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
5
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
"Templates"
));
WebElement
inputSearch
=
driver
.
findElement
(
By
.
id
(
"search"
));
inputSearch
.
sendKeys
(
"e"
);
inputSearch
.
sendKeys
(
Keys
.
ENTER
);
wait
=
new
WebDriverWait
(
driver
,
5
);
String
expected
=
Localization
.
getString
(
"menu.search.results"
,
24
);
wait
.
until
(
ExpectedConditions
.
textToBePresentInElementLocated
(
By
.
cssSelector
(
".headline"
),
expected
));
}
}
}
\ No newline at end of file
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