Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloPak committed May 9, 2024
1 parent e60f1dc commit aa8f6ee
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 62 deletions.
88 changes: 43 additions & 45 deletions cypress/e2e/users/profile-picture-validations.cy.js
Expand Up @@ -6,56 +6,54 @@ 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) => {
cy.createTempUser([permissions.uiUserEdit.gui, permissions.uiUsersPermissionsView.gui])
.then((userProperties) => {
testUser = userProperties;
}).then(() => {
cy.loginAsAdmin({
path: TopMenu.usersPath,
waiter: UsersSearchPane.waitLoading,
});
})
.then(() => {
cy.loginAsAdmin({
path: TopMenu.usersPath,
waiter: UsersSearchPane.waitLoading,
});
});

after('Deleting created entities', () => {
cy.getAdminToken();
Users.deleteViaApi(testUser.userId);
});
});
});

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(
'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();
},
);
});
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();
},
);
});
34 changes: 18 additions & 16 deletions cypress/support/fragments/users/profilePicture.js
@@ -1,18 +1,14 @@
import { including } from '@interactors/html';
import {
Button,
not,
ProfilePictureCard
} from '../../../../interactors';
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 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());
},
Expand All @@ -28,15 +24,15 @@ export default {
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()
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 })
cy.get('#clickable-save').click({ force: true });

Check warning on line 35 in cypress/support/fragments/users/profilePicture.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Do not use force on click and type calls

Check warning on line 35 in cypress/support/fragments/users/profilePicture.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Do not use force on click and type calls
},

deleteProfilePicture() {
Expand All @@ -46,10 +42,16 @@ export default {
},

verifyPictureIsSet() {
cy.expect(ProfilePictureCard({ testId: 'profile-picture' }).has({ src: including(externalPictureUrl) }));
cy.expect(
ProfilePictureCard({ testId: 'profile-picture' }).has({ src: including(externalPictureUrl) }),
);
},

verifyPictureIsRemoved() {
cy.expect(ProfilePictureCard({ testId: 'profile-picture' }).has({ src: not(including(externalPictureUrl)) }));
}
};
cy.expect(
ProfilePictureCard({ testId: 'profile-picture' }).has({
src: not(including(externalPictureUrl)),
}),
);
},
};
2 changes: 1 addition & 1 deletion interactors/profilePictureCard.js
Expand Up @@ -6,4 +6,4 @@ export default HTML.extend('image')
alt: (el) => el.getAttribute('alt'),
testId: (el) => el.getAttribute('data-testid'),
src: (el) => el.getAttribute('src'),
})
});

0 comments on commit aa8f6ee

Please sign in to comment.