Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3585 from folio-org/FAT-12685-FAT-12687-FAT-12692
Test cases covering Profile picture
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import TopMenu from '../../support/fragments/topMenu'; | ||
import Users from '../../support/fragments/users/users'; | ||
import permissions from '../../support/dictionary/permissions'; | ||
import UsersCard from '../../support/fragments/users/usersCard'; | ||
import UsersSearchPane from '../../support/fragments/users/usersSearchPane'; | ||
import UserEdit from '../../support/fragments/users/userEdit'; | ||
import ProfileCard from '../../support/fragments/users/profilePicture'; | ||
|
||
describe('profile-picture-validation', () => { | ||
let testUser = {}; | ||
|
||
before('Preconditions', () => { | ||
cy.getAdminToken(); | ||
cy.createTempUser([permissions.uiUserEdit.gui, permissions.uiUsersPermissionsView.gui]) | ||
.then((userProperties) => { | ||
testUser = userProperties; | ||
}) | ||
.then(() => { | ||
cy.loginAsAdmin({ | ||
path: TopMenu.usersPath, | ||
waiter: UsersSearchPane.waitLoading, | ||
}); | ||
}); | ||
}); | ||
|
||
after('Deleting created entities', () => { | ||
cy.getAdminToken(); | ||
Users.deleteViaApi(testUser.userId); | ||
}); | ||
|
||
it( | ||
'C446093 Update profile picture via local storage or external Url (volaris)', | ||
{ tags: ['smokeBroken', 'volaris'] }, | ||
() => { | ||
UsersSearchPane.searchByUsername(testUser.username); | ||
UsersCard.waitLoading(); | ||
UserEdit.openEdit(); | ||
ProfileCard.verifyProfileCardIsPresent(); | ||
ProfileCard.expandUpdateDropDown(); | ||
ProfileCard.verifyLocalUploadbuttonIsPresent(); | ||
ProfileCard.setPictureFromExternalUrl(); | ||
ProfileCard.verifyPictureIsSet(); | ||
}, | ||
); | ||
|
||
it( | ||
'C442795, C442796 Verify that profile picture and associated update options display appropriately with Users: Can view, edit, and delete profile pictures', | ||
{ tags: ['smokeBroken', 'volaris'] }, | ||
() => { | ||
UsersSearchPane.searchByUsername(testUser.username); | ||
UsersCard.waitLoading(); | ||
UserEdit.openEdit(); | ||
ProfileCard.verifyProfileCardIsPresent(); | ||
ProfileCard.expandUpdateDropDown(); | ||
ProfileCard.deleteProfilePicture(); | ||
ProfileCard.verifyPictureIsRemoved(); | ||
}, | ||
); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { including } from '@interactors/html'; | ||
import { Button, not, ProfilePictureCard } from '../../../../interactors'; | ||
|
||
const updateDropDownCss = 'div[id="updateProfilePictureDropdown"] > button'; | ||
const externalPictureUrl = | ||
'https://png.pngtree.com/png-vector/20191101/ourmid/pngtree-cartoon-color-simple-male-avatar-png-image_1934459.jpg'; | ||
const localFileButton = Button({ dataTestID: 'localFile' }); | ||
const externalUrlButton = Button({ dataTestID: 'externalURL' }); | ||
const deletePictureButton = Button({ dataTestID: 'delete' }); | ||
|
||
export default { | ||
verifyProfileCardIsPresent() { | ||
cy.expect(ProfilePictureCard({ testId: 'profile-picture' }).exists()); | ||
}, | ||
|
||
expandUpdateDropDown() { | ||
cy.do(cy.get(updateDropDownCss).click({ force: true })); | ||
}, | ||
|
||
verifyLocalUploadbuttonIsPresent() { | ||
cy.expect(localFileButton.exists()); | ||
}, | ||
|
||
setPictureFromExternalUrl() { | ||
cy.do(externalUrlButton.click({ force: true })); | ||
cy.do( | ||
cy.get('#external-image-url').clear(), | ||
cy.get('#external-image-url').type(externalPictureUrl), | ||
cy.get('#save-external-link-btn').click(), | ||
); | ||
this.saveAndClose(); | ||
}, | ||
|
||
saveAndClose() { | ||
cy.get('#clickable-save').click({ force: true }); | ||
}, | ||
|
||
deleteProfilePicture() { | ||
cy.do(deletePictureButton.click({ force: true })); | ||
cy.get('div[role="document"] span').contains('Yes').click(); | ||
this.saveAndClose(); | ||
}, | ||
|
||
verifyPictureIsSet() { | ||
cy.expect( | ||
ProfilePictureCard({ testId: 'profile-picture' }).has({ src: including(externalPictureUrl) }), | ||
); | ||
}, | ||
|
||
verifyPictureIsRemoved() { | ||
cy.expect( | ||
ProfilePictureCard({ testId: 'profile-picture' }).has({ | ||
src: not(including(externalPictureUrl)), | ||
}), | ||
); | ||
}, | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import HTML from './baseHTML'; | ||
|
||
export default HTML.extend('image') | ||
.selector('img') | ||
.filters({ | ||
alt: (el) => el.getAttribute('alt'), | ||
testId: (el) => el.getAttribute('data-testid'), | ||
src: (el) => el.getAttribute('src'), | ||
}); |