-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/DonXavierdev/care_fe int…
…o issues/10387/Cypress-Medicine-Test
- Loading branch information
Showing
165 changed files
with
7,478 additions
and
3,059 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
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
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 was deleted.
Oops, something went wrong.
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
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
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,22 @@ | ||
import { UserAvatar } from "@/pageObject/Users/UserAvatar"; | ||
|
||
describe("User Profile Avatar Modification", () => { | ||
const userAvatar = new UserAvatar("teststaff4"); | ||
beforeEach(() => { | ||
cy.loginByApi("teststaff4"); | ||
cy.visit("/"); | ||
}); | ||
it("should modify an avatar", () => { | ||
userAvatar | ||
.navigateToProfile() | ||
.interceptUploadAvatarRequest() | ||
.clickChangeAvatarButton() | ||
.uploadAvatar() | ||
.clickSaveAvatarButton() | ||
.verifyUploadAvatarApiCall() | ||
.interceptDeleteAvatarRequest() | ||
.clickChangeAvatarButton() | ||
.clickDeleteAvatarButton() | ||
.verifyDeleteAvatarApiCall(); | ||
}); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,59 @@ | ||
export class UserAvatar { | ||
username: string; | ||
constructor(username: string) { | ||
this.username = username; | ||
} | ||
|
||
navigateToProfile() { | ||
cy.visit(`/users/${this.username}`); | ||
return this; | ||
} | ||
|
||
interceptUploadAvatarRequest() { | ||
cy.intercept("POST", `/api/v1/users/${this.username}/profile_picture/`).as( | ||
"uploadAvatar", | ||
); | ||
return this; | ||
} | ||
|
||
clickChangeAvatarButton() { | ||
cy.verifyAndClickElement('[data-cy="change-avatar"]', "Change Avatar"); | ||
return this; | ||
} | ||
|
||
uploadAvatar() { | ||
cy.get('input[title="changeFile"]').selectFile( | ||
"cypress/fixtures/avatar.jpg", | ||
{ force: true }, | ||
); | ||
return this; | ||
} | ||
|
||
clickSaveAvatarButton() { | ||
cy.verifyAndClickElement('[data-cy="save-cover-image"]', "Save"); | ||
return this; | ||
} | ||
|
||
verifyUploadAvatarApiCall() { | ||
cy.wait("@uploadAvatar").its("response.statusCode").should("eq", 200); | ||
return this; | ||
} | ||
|
||
interceptDeleteAvatarRequest() { | ||
cy.intercept( | ||
"DELETE", | ||
`/api/v1/users/${this.username}/profile_picture/`, | ||
).as("deleteAvatar"); | ||
return this; | ||
} | ||
|
||
clickDeleteAvatarButton() { | ||
cy.verifyAndClickElement('[data-cy="delete-avatar"]', "Delete"); | ||
return this; | ||
} | ||
|
||
verifyDeleteAvatarApiCall() { | ||
cy.wait("@deleteAvatar").its("response.statusCode").should("eq", 204); | ||
return this; | ||
} | ||
} |
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,27 @@ | ||
export const viewPort = { | ||
// Most common desktop resolution (Full HD) | ||
desktop1080p: { | ||
width: 1920, | ||
height: 1080, | ||
}, | ||
// Common laptop resolution (HD+) | ||
laptopStandard: { | ||
width: 1366, | ||
height: 768, | ||
}, | ||
// MacBook Pro 13" and similar laptops | ||
laptopRetina: { | ||
width: 1440, | ||
height: 900, | ||
}, | ||
// Common desktop resolution (2K) | ||
desktop2k: { | ||
width: 2560, | ||
height: 1440, | ||
}, | ||
// Common laptop resolution (HD) | ||
laptopSmall: { | ||
width: 1280, | ||
height: 720, | ||
}, | ||
} as const; |
Oops, something went wrong.