Skip to content

Commit

Permalink
Fix test suites (#164)
Browse files Browse the repository at this point in the history
* test: implement workaround to improve `RadioButtons` performance

Setting values using the Geb `RadioButtons` module currently takes over 2 minutes, significantly slowing down integration tests. This commit introduces a temporary workaround to speed up the tests while awaiting a proper fix for the `RadioButtons` module.

* test: remove unnecessary `@Stepwise` annotations

Removed `@Stepwise` annotations in test classes where they had no observable impact on test execution. This simplifies the test setup and avoids potential confusion.

* test: remove redundant `@DirtiesContext` annotations

Eliminated `@DirtiesContext` annotations from test classes and methods where they were unnecessary, improving test execution time and reducing context reload overhead.

* test: remove `@PendingFeature` from passing test

* chore(test): cleanup

* test: fix and cleanup test suites
  • Loading branch information
matrei authored Jan 7, 2025
1 parent 268a892 commit bd9c6ea
Show file tree
Hide file tree
Showing 91 changed files with 1,240 additions and 1,345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import geb.Page
abstract class AbstractSecurityPage extends Page {

void submit() {
submit.click()
submitBtn.click()
}

protected boolean assertContentContains(String expected) {
assert $().text().contains(expected)
true
}


protected boolean assertContentMatches(String regex) {
assert $().text() ==~ regex
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package page

abstract class CreatePage extends AbstractSecurityPage {

static at = { title == 'Create ' + typeName() }

static at = { title == "Create ${typeName()}" }
static content = {
form { $('createForm') }
submit { $('a', id: 'create') }
submitBtn { $('a', id: 'create') }
}

boolean assertNotUnique() {
assertContentContains 'must be unique'
assertContentContains('must be unique')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package page

abstract class EditPage extends AbstractSecurityPage {

static at = { title == 'Edit ' + typeName() }

static at = { title == "Edit ${typeName()}" }
static content = {
form { $('editForm') }
submit { $('a', id: 'update') }
submitBtn { $('a', id: 'update') }
}

void delete() {
js.exec 'document.forms.deleteForm.submit()'
js.exec('document.forms.deleteForm.submit()')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@ package page

abstract class SearchPage extends AbstractSecurityPage {

static at = { title == typeName() + ' Search' }

static at = { title == "${typeName()} Search" }
static atCheckWaiting = true

static content = {
form { $('search') }
submit { $('a', id: 'searchButton') }
submitBtn { $('a', id: 'searchButton') }
}

boolean assertNoResults() {
assertContentContains 'No results'
assertContentDoesNotContain 'Showing'
assertContentContains('No results')
assertContentDoesNotContain('Showing')
true
}

boolean assertNotSearched() {
assertContentContains 'Search'
assertContentDoesNotContain 'No results'
assertContentDoesNotContain 'Showing'
assertContentContains('Search')
assertContentDoesNotContain('No results')
assertContentDoesNotContain('Showing')
true
}

boolean assertResults(int start, int end, int total) {
assertContentContains "Showing $start through $end out of ${total}."
assertContentContains("Showing $start through $end out of ${total}.")
true
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.CreatePage
class AclClassCreatePage extends CreatePage {

static url = 'aclClass/create'

static typeName = { 'AclClass' }

static content = {
className { $(name: 'className').module(TextInput) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.EditPage
class AclClassEditPage extends EditPage {

static url = 'aclClass/edit'

static typeName = { 'AclClass' }

static content = {
className { $(name: 'className').module(TextInput) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.SearchPage
class AclClassSearchPage extends SearchPage {

static url = 'aclClass/search'

static typeName = { 'AclClass' }

static content = {
className { $(name: 'className').module(TextInput) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import page.CreatePage
class AclEntryCreatePage extends CreatePage {

static url = 'aclEntry/create'

static typeName = { 'AclEntry' }

static content = {
aclObjectIdentityId { $(name: 'aclObjectIdentity.id').module(TextInput) }
aceOrder { $(name: 'aceOrder').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import page.EditPage
class AclEntryEditPage extends EditPage {

static url = 'aclEntry/edit'

static typeName = { 'AclEntry' }

static content = {
aclObjectIdentityId { $(name: 'aclObjectIdentity.id').module(TextInput) }
aceOrder { $(name: 'aceOrder').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.SearchPage
class AclEntrySearchPage extends SearchPage {

static url = 'aclEntry/search'

static typeName = { 'AclEntry' }

static content = {
aclObjectIdentity { $(name: 'aclObjectIdentity.id').module(TextInput) }
aceOrder { $(name: 'aceOrder').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import page.CreatePage
class AclObjectIdentityCreatePage extends CreatePage {

static url = 'aclObjectIdentity/create'

static typeName = { 'AclObjectIdentity' }

static content = {
aclClass { $(name: 'aclClass.id').module(Select) }
objectId { $(name: 'objectId').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.EditPage
class AclObjectIdentityEditPage extends EditPage {

static url = 'aclObjectIdentity/edit'

static typeName = { 'AclObjectIdentity' }

static content = {
objectId { $(name: 'objectId').module(TextInput) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import page.SearchPage
class AclObjectIdentitySearchPage extends SearchPage {

static url = 'aclObjectIdentity/search'

static typeName = { 'AclObjectIdentity' }

static content = {
aclClass { $(name: 'aclClass.id').module(Select) }
objectId { $(name: 'objectId').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import page.CreatePage
class AclSidCreatePage extends CreatePage {

static url = 'aclSid/create'

static typeName = { 'AclSid' }

static content = {
sid { $(name: 'sid').module(TextInput) }
principal { $(name: 'principal').module(Checkbox) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import page.EditPage
class AclSidEditPage extends EditPage {

static url = 'aclSid/edit'

static typeName = { 'AclSid' }

static content = {
sid { $(name: 'sid').module(TextInput) }
principal { $(name: 'principal').module(Checkbox) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import page.SearchPage
class AclSidSearchPage extends SearchPage {

static url = 'aclSid/search'

static typeName = { 'AclSid' }

static content = {
sid { $(name: 'sid').module(TextInput) }
principal { $(name: 'principal').module(RadioButtons) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import page.SearchPage
class PersistentLoginSearchPage extends SearchPage {

static url = 'persistentLogin/search'

static typeName = { 'PersistentLogin' }

static content = {
series { $(name: 'series').module(TextInput) }
token { $(name: 'token').module(TextInput) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@ import page.CreatePage
class ProfileCreatePage extends AbstractSecurityPage {

static at = { title == 'Create Profile' }


static url = 'profile/create'


static content = {
myQuestion { $('#myQuestion1').module(TextInput) }
myQuestion2 { $('#myQuestion2').module(TextInput) }
myAnswer2 { $('#myAnswer2').module(TextInput) }
myAnswer { $('#myAnswer1').module(TextInput) }
submit { $("#create")}
submitBtn { $('#create')}
}

void create(String userName) {
def userSelect = $(name: "user.id").module(Select)
def userSelect = $(name: 'user.id').module(Select)
userSelect.selected = userName
myQuestion = "Count to 8"
myQuestion2 = "Count to 4"
myAnswer2 = "1234"
myAnswer = "12345678"
myQuestion = 'Count to 8'
myQuestion2 = 'Count to 4'
myAnswer2 = '1234'
myAnswer = '12345678'
submit()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,30 @@ import page.AbstractSecurityPage
class ProfileEditPage extends AbstractSecurityPage {

static url = 'profile/edit'

static at = { title == 'Edit Profile' }


static content = {
myQuestion { $('#myQuestion1').module(TextInput) }
myQuestion2 { $('#myQuestion2').module(TextInput) }
myAnswer2 { $('#myAnswer2').module(TextInput) }
myAnswer { $('#myAnswer1').module(TextInput) }
submit { $("#update")}
submitBtn { $('#update')}
}

void updateProfile(String userName) {
def userSelect = $(name: "user.id").module(Select)
def userSelect = $(name: 'user.id').module(Select)
userSelect.selected = userName
myQuestion = "Count to 4"
myQuestion2 = "Count to 5"
myAnswer2 = "12345"
myAnswer = "1234"

myQuestion = 'Count to 4'
myQuestion2 = 'Count to 5'
myAnswer2 = '12345'
myAnswer = '1234'
submit()
}

void deleteProfile() {
$("#deleteButton").click()
$('#deleteButton').click()
waitFor {
$("span", text:"Are you sure?")
$('span', text: 'Are you sure?')
}
$("button", text:"Delete").click()
$('button', text: 'Delete').click()
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package page.profile

import geb.module.Select
import geb.module.TextInput
import page.AbstractSecurityPage

class ProfileListPage extends AbstractSecurityPage {

static at = { title == 'Profile List' }


static url = 'profile'


static at = { title == 'Profile List' }
static content = {

profileEditLink { String username -> $('a', text: "User(username:$username)").parent().parent().children().first().children('a') }
}

void editProfile(String username) {
profileEditLink(username).click()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import page.AbstractSecurityPage
class ForgotPasswordPage extends AbstractSecurityPage {

static url = 'register/forgotPassword'

static at = { title == 'Forgot Password' }

static content = {
form { $('forgotPasswordForm') }

username { $(name: 'username').module(TextInput) }

submit { $('a', id: 'submit') }
submitBtn { $('a', id: 'submit') }
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package page.register

import geb.module.PasswordInput
import geb.module.TextInput
import page.AbstractSecurityPage

class RegisterPage extends AbstractSecurityPage {

static url = 'register'

static at = { title == 'Register' }

static content = {
form { $('registerForm') }

username { $(name: 'username').module(TextInput) }
email { $(name: 'email').module(TextInput) }
password { $(name: 'password').module(TextInput) }
password2 { $(name: 'password2').module(TextInput) }

submit { $('a', id: 'submit') }
password { $(name: 'password').module(PasswordInput) }
password2 { $(name: 'password2').module(PasswordInput) }
submitBtn { $('a', id: 'submit') }
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package page.register

import geb.module.TextInput
import geb.module.PasswordInput
import page.AbstractSecurityPage

class ResetPasswordPage extends AbstractSecurityPage {

static url = 'register/resetPassword'

static at = { title == 'Reset Password' }

static content = {
form { $('resetPasswordForm') }
password { $('#password') }
password2 { $('#password2') }
submit { $('a', id: 'submit') }
password { $('#password').module(PasswordInput) }
password2 { $('#password2').module(PasswordInput) }
submitBtn { $('a', id: 'submit') }
}

def enterNewPassword(String p1, String p2) {
Expand Down
Loading

0 comments on commit bd9c6ea

Please sign in to comment.