Skip to content

Commit

Permalink
#2490: fixing oauth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed Jun 19, 2024
1 parent bd6055a commit 4a2a39c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ on:
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
# push:
# paths-ignore:
# - 'README.md'
# - '.github/workflows/build-and-test-postgres.yml'
# - '.github/workflows/publish-image-snapshot.yml'
# - '.gitlab-ci.yml'
push:
paths-ignore:
- 'README.md'
- '.github/workflows/build-and-test-postgres.yml'
- '.github/workflows/publish-image-snapshot.yml'

jobs:
build-skills-service-for-ui-tests:
Expand Down
26 changes: 17 additions & 9 deletions e2e-tests/cypress/e2e/approver/approver_conf_users_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,23 @@ describe('Approver Config Users Tests', () => {
const headerSelector = `${tableSelector} thead tr th`;
cy.get(headerSelector).contains('User').click();

cy.selectItem(`[data-cy="expandedChild_${user1}"] [data-cy="userIdInput"] #existingUserInput`, 'userE', true, true);
cy.get(`[data-cy="expandedChild_${user1}"] [data-cy="addUserConfBtn"]`).click()

cy.validateTable(tableSelector, [
[{ colIndex: 0, value: 'userA' }],
[{ colIndex: 0, value: 'userB' }],
[{ colIndex: 0, value: 'userC' }],
[{ colIndex: 0, value: 'userD' }],
[{ colIndex: 0, value: 'userE' }],
], 4);
cy.fixture('vars.json').then((vars) => {
const defaultUser = Cypress.env('oauthMode') ? 'foo' : vars.defaultUser
cy.selectItem(`[data-cy="expandedChild_${user1}"] [data-cy="userIdInput"] #existingUserInput`, defaultUser, true, true);
cy.get(`[data-cy="expandedChild_${user1}"] [data-cy="addUserConfBtn"]`).click()

const compare = (a, b) => {
return a[0].value?.localeCompare(b[0].value)
}
const expected = [
[{ colIndex: 0, value: 'userA' }],
[{ colIndex: 0, value: 'userB' }],
[{ colIndex: 0, value: 'userC' }],
[{ colIndex: 0, value: 'userD' }],
[{ colIndex: 0, value: defaultUser }],
].sort(compare)
cy.validateTable(tableSelector, expected, 4);
})
})
});
6 changes: 5 additions & 1 deletion e2e-tests/cypress/e2e/projects_admin_management_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,14 @@ describe('Projects Admin Management Tests', () => {
cy.get('[data-pc-section="panel"] [data-pc-section="itemlabel"]').contains('Administrator').click();
cy.wait('@addAdmin')
cy.get(`${tableSelector} thead th`).contains('User').click();

const compare = (a, b) => {
return a[0].value?.localeCompare(b[0].value)
}
cy.validateTable(tableSelector, [
[{ colIndex: 0, value: 'root@' }, { colIndex: 1, value: 'Administrator' }],
[{ colIndex: 0, value: expectedUserName }, { colIndex: 1, value: 'Administrator' }],
], 5, true, null, false);
].sort(compare), 5, true, null, false);
});

it('Existing users are not suggested', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface UserAttrsRepo extends CrudRepository<UserAttrs, Integer> {
@Query(value='''select attrs.email from user_attrs attrs where attrs.user_id = ?1''', nativeQuery = true)
String findEmailByUserId(String userId)

@Query("SELECT DISTINCT(ua.userIdForDisplay) from UserAttrs ua where lower(ua.userIdForDisplay) LIKE %?1% order by ua.userIdForDisplay asc" )
@Query("SELECT DISTINCT(ua.userId) from UserAttrs ua where lower(ua.userId) LIKE %?1% order by ua.userId asc" )
List<String> findDistinctUserIdForDisplay(String userUserIdForDisplayQuery, Pageable pageable)

}

0 comments on commit 4a2a39c

Please sign in to comment.