-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,62 @@ | ||
describe('header', () => { | ||
const fakeUser = { | ||
username: 'user', | ||
password: 'Abcde12!', | ||
email: '[email protected]', | ||
name: 'Homer', | ||
surname: 'Simpson', | ||
} | ||
const fakeUser = { | ||
username: 'user', | ||
password: 'Abcde12!', | ||
email: '[email protected]', | ||
name: 'Homer', | ||
surname: 'Simpson', | ||
} | ||
|
||
before(() => { | ||
cy.visit('/geonetwork') | ||
cy.get('.cookie-warning-actions').find('button').eq(0).click() | ||
cy.scrollTo('top') | ||
cy.loginGN('admin', 'admin', false) | ||
cy.get('a[title="Admin console"]').click() | ||
cy.get('.fa-group').click() | ||
cy.get('#gn-btn-user-add').click() | ||
cy.get('#username').type(fakeUser.username) | ||
cy.get('#gn-user-password').type(fakeUser.password) | ||
cy.get('#gn-user-password2').type(fakeUser.password) | ||
cy.get('[name="name"]').type(fakeUser.name) | ||
cy.get('[name="surname"]').type(fakeUser.surname) | ||
cy.get('[name="email"]').type(fakeUser.email) | ||
cy.get('.fa-save').click() | ||
}) | ||
const gnBaseUrl = 'http://localhost:8080/geonetwork/srv/eng/' | ||
|
||
describe('avatar', () => { | ||
describe('display avatar for user without gravatar hash', () => { | ||
it('should display placeholder url', () => { | ||
cy.loginGN('admin', 'admin', false) | ||
cy.visit(`${gnBaseUrl}admin.console#/organization`) | ||
cy.get('#gn-btn-user-add').click() | ||
cy.get('#username').type(fakeUser.username) | ||
cy.get('#gn-user-password').type(fakeUser.password) | ||
cy.get('#gn-user-password2').type(fakeUser.password) | ||
cy.get('[name="name"]').type(fakeUser.name) | ||
cy.get('[name="surname"]').type(fakeUser.surname) | ||
cy.get('[name="email"]').type(fakeUser.email) | ||
cy.get('.fa-save').click() | ||
|
||
cy.visit(`${gnBaseUrl}admin.console#/settings`) | ||
cy.get('[id="system/users/identicon"]').type('{selectAll}{del}') | ||
cy.get('#gn-btn-settings-save').click() | ||
|
||
describe('general display', () => { | ||
it('should display the correct placeholder and profile picture', () => { | ||
cy.visit('/') | ||
cy.get('gn-ui-avatar') | ||
.children('img') | ||
.should('have.attr', 'src') | ||
.should('eq', 'https://www.gravatar.com/avatar/?d=mp') | ||
cy.signOutGN() | ||
}) | ||
it('should display monsterid', () => { | ||
cy.loginGN('admin', 'admin', false) | ||
cy.visit(`${gnBaseUrl}admin.console#/settings`) | ||
cy.get('[id="system/users/identicon"]').type( | ||
'{selectAll}gravatar:monsterid' | ||
) | ||
cy.get('#gn-btn-settings-save').click() | ||
|
||
cy.visit('/') | ||
cy.get('gn-ui-avatar') | ||
.children('img') | ||
.should('have.attr', 'src') | ||
.should('eq', 'https://www.gravatar.com/avatar/?d=monsterid') | ||
}) | ||
}) | ||
describe('display avatar for user with hash', () => { | ||
it('should display the correct profile picture', () => { | ||
cy.loginGN(fakeUser.username, fakeUser.password) | ||
cy.get('gn-ui-avatar') | ||
.children('img') | ||
.should('have.attr', 'src') | ||
.should( | ||
'eq', | ||
'https://www.gravatar.com/avatar/09abd59eb5653a7183ba812b8261f48b?d=mp' | ||
'https://www.gravatar.com/avatar/09abd59eb5653a7183ba812b8261f48b?d=monsterid' | ||
) | ||
cy.signOutGN() | ||
|
||
cy.get('a[title="Admin console"]').click() | ||
cy.get('.fa-gear').click() | ||
cy.get('[id="system/users/identicon"]').type( | ||
'{selectAll}gravatar:monsteridc' | ||
) | ||
cy.get('#gn-btn-settings-save').click() | ||
cy.visit('/') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters