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
558f6678
Commit
558f6678
authored
Jul 14, 2022
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#696 - added selenium tests for backup settings
parent
92a7e2ee
No related branches found
No related tags found
No related merge requests found
Pipeline
#6631
passed
Jul 14, 2022
Stage: external
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/BackupSettingsTest.java
+102
-0
102 additions, 0 deletions
...ter/integration/selenium/settings/BackupSettingsTest.java
with
102 additions
and
0 deletions
BudgetMasterServer/src/test/java/de/deadlocker8/budgetmaster/integration/selenium/settings/BackupSettingsTest.java
0 → 100644
+
102
−
0
View file @
558f6678
package
de.deadlocker8.budgetmaster.integration.selenium.settings
;
import
de.deadlocker8.budgetmaster.authentication.UserService
;
import
de.deadlocker8.budgetmaster.integration.helpers.IntegrationTestHelper
;
import
de.deadlocker8.budgetmaster.integration.helpers.SeleniumTestBase
;
import
org.junit.jupiter.api.Test
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.support.ui.ExpectedConditions
;
import
org.openqa.selenium.support.ui.WebDriverWait
;
import
java.time.Duration
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
class
BackupSettingsTest
extends
SeleniumTestBase
{
private
static
IntegrationTestHelper
helper
;
@Override
protected
void
importDatabaseOnce
()
{
helper
=
new
IntegrationTestHelper
(
driver
,
port
);
helper
.
start
();
helper
.
login
(
UserService
.
DEFAULT_PASSWORD
);
helper
.
hideBackupReminder
();
helper
.
hideWhatsNewDialog
();
helper
.
hideMigrationDialog
();
}
@Test
void
test_unsavedChangesWarningIsShown
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/settings"
);
driver
.
findElement
(
By
.
id
(
"backupSettingsContainerHeader"
)).
click
();
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
id
(
"backupSettingsContainer"
)));
driver
.
findElement
(
By
.
cssSelector
(
"#backupSettingsContainer .lever"
)).
click
();
// assert
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#backupSettingsContainerHeader .collapsible-header-button"
)).
getText
())
.
contains
(
"unsaved"
);
}
@Test
void
test_save
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/settings"
);
driver
.
findElement
(
By
.
id
(
"backupSettingsContainerHeader"
)).
click
();
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
id
(
"backupSettingsContainer"
)));
driver
.
findElement
(
By
.
cssSelector
(
"#backupSettingsContainer .lever"
)).
click
();
driver
.
findElements
(
By
.
cssSelector
(
"#backupSettingsContainer button"
)).
get
(
1
).
click
();
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
className
(
"toast"
)));
// assert
assertThat
(
driver
.
findElement
(
By
.
className
(
"toast"
)).
getText
())
.
contains
(
"Backup settings saved"
);
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#backupSettingsContainerHeader .collapsible-header-button"
)).
isDisplayed
())
.
isFalse
();
}
@Test
void
test_save_error
()
{
driver
.
get
(
helper
.
getUrl
()
+
"/settings"
);
driver
.
findElement
(
By
.
id
(
"backupSettingsContainerHeader"
)).
click
();
WebDriverWait
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
id
(
"backupSettingsContainer"
)));
driver
.
findElements
(
By
.
cssSelector
(
"#backupSettingsContainer .lever"
)).
get
(
1
).
click
();
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
id
(
"settings-backup-auto-days"
)));
driver
.
findElement
(
By
.
id
(
"settings-backup-auto-days"
)).
sendKeys
(
"x"
);
driver
.
findElements
(
By
.
cssSelector
(
"#backupSettingsContainer button"
)).
get
(
1
).
click
();
wait
=
new
WebDriverWait
(
driver
,
Duration
.
ofSeconds
(
5
));
wait
.
until
(
ExpectedConditions
.
visibilityOfElementLocated
(
By
.
className
(
"toast"
)));
// assert
assertThat
(
driver
.
findElement
(
By
.
className
(
"toast"
)).
getText
())
.
contains
(
"Error saving settings"
);
assertThat
(
driver
.
findElement
(
By
.
cssSelector
(
"#backupSettingsContainerHeader .collapsible-header-button"
)).
isDisplayed
())
.
isTrue
();
}
}
\ 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