diff --git a/playwright.config.ts b/playwright.config.ts index 0b265131..a53f9b0a 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -24,7 +24,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { trace: 'on-first-retry', - headless: false, + headless: true, }, projects: [ diff --git a/src/@types/locker.d.ts b/src/@types/locker.d.ts index 26c4e64b..e147e1d7 100644 --- a/src/@types/locker.d.ts +++ b/src/@types/locker.d.ts @@ -29,15 +29,16 @@ declare namespace Locker { export interface FindByLocationResponseDto { locationName: string; lockerList: LockerLocationDto[]; - /* - LockerLocationDto may be: id: string; - lockerNumber: number; + } + + export interface LockerLocationDto { + id: string; + lockerNumber: string; lockerLocationName: string; updatedAt: string; expireAt: string; isActive: boolean; - isMine: boolean; - */ + isMine: boolean; } export interface FindByLocationResponse { diff --git a/tests/@types/board.d.ts b/tests/@types/board.d.ts new file mode 100644 index 00000000..beb23b4f --- /dev/null +++ b/tests/@types/board.d.ts @@ -0,0 +1,38 @@ +declare namespace Board { + export interface Dto { + name: string; + description: string; + createRoleList: User.Role[]; + category: string; + circleId: string; + } + + export interface Item { + key: string; + name: string; + notification: boolean; + } + + export interface Board { + category: string; + items: Item[]; + } + + export interface RootObject { + board: Board[]; + } + + export interface ResponseDto extends Dto { + id: string; + writable: boolean; + isDeleted: boolean; + circleName: string; + } + + interface RequestDto extends Dto {} + + export interface CreateRequestDto extends RequestDto {} + + // TODO: 게시판 관리 구현 시 서버와 조정 필요 + export interface UpdateRequestDto extends RequestDto {} +} diff --git a/tests/@types/circle.d.ts b/tests/@types/circle.d.ts new file mode 100644 index 00000000..98afdfd0 --- /dev/null +++ b/tests/@types/circle.d.ts @@ -0,0 +1,68 @@ +declare namespace Circle { + export type Status = 'AWAIT' | 'DROP' | 'LEAVE' | 'MEMBER' | 'REJECT'; + + export interface CreateRequestDto { + mainImage: string; + name: string; + description: string; + leaderId: string; + } + + export type UpdateRequestDto = Omit; + + export interface CircleUser { + id: string; + status: Status; + user: User.UserDto; + circle: FindByIdDto; + } + export type GetUserListResponseDto = CircleUser[]; + export type GetUserListResponse = Model.CircleUser[]; + + // + export interface FindByIdDto { + id: string; + mainImage: string | null; + name: string; + description: string; + isJoined: boolean; + joinedAt: string | null; + leaderId: string; + leaderName: string; + createdAt: string; + numMember: number; + } + + export interface UserApplyDto { + circle: Dto; + id: string; + status: 'AWAIT'; + userId: string; + userName: string; + } + + export interface Board { + id: string; + name: string; + postId: string | null; + postTitle: string | null; + postCreatedAt: string | null; + postNumComment: number | null; + postWriterName: string | null; + postWriterStudentId: string | null; + } + + export interface FindBoardsDto { + circle: FindByIdDto; + boardList: Board[]; + } + + export interface FindBoards { + circle: Model.Circle; + boards: Model.CircleBoard[]; + } + + // Client + // 기본, 신청완료, 대기중, 가입됨, 제한 + export type JoinStatus = 'NONE' | 'DONE' | 'AWAIT' | 'MEMBER' | 'BLOCK'; +} diff --git a/tests/@types/comment.d.ts b/tests/@types/comment.d.ts new file mode 100644 index 00000000..f83f9a0e --- /dev/null +++ b/tests/@types/comment.d.ts @@ -0,0 +1,31 @@ +declare namespace PostComment { + export interface GetResponseDto { + content: CreateResponseDto[]; + last: boolean; + } + + export interface FindAllResponse { + comments: Model.Comment[]; + last: boolean; + } + + export interface CreateRequestDto { + postId: string; + content: string; + } + + export interface CreateResponseDto { + postId: string; + id: string; + writerAdmissionYear: number; + writerName: string; + writerProfileImage: string | null; + content: string; + createdAt: string; + updatedAt: string; + numChildComment: number; + updatable: boolean; + deletable: boolean; + isDeleted: boolean; + } +} diff --git a/tests/@types/history.d.ts b/tests/@types/history.d.ts new file mode 100644 index 00000000..22579468 --- /dev/null +++ b/tests/@types/history.d.ts @@ -0,0 +1,26 @@ +declare namespace HistoryData { + export interface Post { + boardId: string; + id: string; + circleName: string | null; + boardName: string; + title: string; + numComment: number; + createdAt: string; + updatedAt: string; + } + + export interface Comment { + boardId: string; + postId: string; + parentCommentId: string | null; + circleName: string | null; + boardName: string; + postName: string; + id: string; + content: string; + tagUserName: string | null; + createdAt: string; + updatedAt: string; + } +} diff --git a/tests/@types/home.d.ts b/tests/@types/home.d.ts new file mode 100644 index 00000000..8b51fc3f --- /dev/null +++ b/tests/@types/home.d.ts @@ -0,0 +1,17 @@ +declare namespace Home { + export type GetHomePageResponseDto = { + board: { + id: string; + category: string; + name: string; + }; + posts: { + content: Post.Dto[]; + }; + }[]; + + export type GetHomePageResponse = { + board: Model.Board; + posts: Model.Post[]; + }[]; +} diff --git a/tests/@types/locker.d.ts b/tests/@types/locker.d.ts new file mode 100644 index 00000000..e147e1d7 --- /dev/null +++ b/tests/@types/locker.d.ts @@ -0,0 +1,48 @@ +declare namespace Locker { + export interface Dto { + id: string; + name: string; + description: string; + enableLockerCount: number; + totalLockerCount: number; + } + export interface LocationDto { + id: string; + lockerNumber: number; + lockerLocationName: string; + updatedAt: string; + expireAt: string; + isActive: boolean; + isMine: boolean; + } + + export interface FindAllLocationResponseDto { + lockerLocations: Dto[]; + myLocker: LocationDto; + } + + export interface FindAllLocationResponse { + lockers: Model.Locker[]; + myLocker?: Model.LockerLocation; + } + + export interface FindByLocationResponseDto { + locationName: string; + lockerList: LockerLocationDto[]; + } + + export interface LockerLocationDto { + id: string; + lockerNumber: string; + lockerLocationName: string; + updatedAt: string; + expireAt: string; + isActive: boolean; + isMine: boolean; + } + + export interface FindByLocationResponse { + locationName: string; + lockerList: Model.LockerLocation[]; + } +} diff --git a/tests/@types/post.d.ts b/tests/@types/post.d.ts new file mode 100644 index 00000000..98bab432 --- /dev/null +++ b/tests/@types/post.d.ts @@ -0,0 +1,54 @@ +declare namespace Post { + export interface Dto { + id: string; + title: string; + writerName: string; + writerAdmissionYear: number; + writerProfileImage: string | null; + content: string; + createdAt: Date; + updatedAt: Date; + numComment: number; + updatable: boolean; + deletable: boolean; + isDeleted: boolean; + } + + export interface FindAllResponseDto { + boardId: string; + boardName: string; + writable: boolean; + post: { + content: Post.Dto[]; + last: boolean; + }; + } + + export interface FindAllResponse { + boardId: string; + boardName: string; + writable: boolean; + post: { + content: Model.Post[]; + last: boolean; + }; + } + + export interface CreateRequestDto { + boardId: string; + title: string; + content: string; + } + + export interface UpdateRequestDto { + title: string; + content: string; + } + + export interface FindByIdResponseDto { + boardId: string; + boardName: string; + commentList: PostComment.GetResponseDto; + content: Dto; + } +} diff --git a/tests/@types/quill-image-uploader.d.ts b/tests/@types/quill-image-uploader.d.ts new file mode 100644 index 00000000..5f473145 --- /dev/null +++ b/tests/@types/quill-image-uploader.d.ts @@ -0,0 +1,4 @@ +declare module 'quill-image-uploader' { + const lib: unknown; + export default lib; +} diff --git a/tests/@types/replyComment.d.ts b/tests/@types/replyComment.d.ts new file mode 100644 index 00000000..c386ade8 --- /dev/null +++ b/tests/@types/replyComment.d.ts @@ -0,0 +1,28 @@ +declare namespace ReplyComment { + export interface GetResponseDto { + childComments: { + content: CreateResponseDto[]; + last: boolean; + }; + parentComment: PostComment.CreateResponseDto; + } + + export interface FindAllResponse { + parent: Model.Comment; + comments: Model.ReplyComment[]; + last: boolean; + } + + export interface CreateRequestDto { + parentCommentId: string; + content: string; + // 답글의 답글인 경우 + refChildComment?: string; + tagUserName?: string; + } + + export interface CreateResponseDto extends PostComment.CreateResponseDto { + refChildComment: string | null; + tagUserName: string | null; + } +} diff --git a/tests/@types/user.d.ts b/tests/@types/user.d.ts new file mode 100644 index 00000000..500edbaa --- /dev/null +++ b/tests/@types/user.d.ts @@ -0,0 +1,149 @@ +declare namespace User { + export interface UserDto { + admissionYear: number; + circleIdIfLeader: string[] | null; + circleNameIfLeader: string[] | null; + email: string; + id: string; + name: string; + profileImage: string; + role: Role; + state: 'ACTIVE' | 'INACTIVE'; + studentId: string; + } + + export type Role = + | 'ADMIN' + | 'PRESIDENT' + | 'VICE_PRESIDENT' + | 'COUNCIL' + | 'LEADER_1' + | 'LEADER_2' + | 'LEADER_3' + | 'LEADER_4' + | 'LEADER_CIRCLE' + | 'LEADER_ALUMNI' + | 'COMMON' + | 'PROFESSOR'; + + // findByName + export type FindByNameResponseDto = UserDto[]; + export type FindByNameResponse = Model.User[]; + + // updateRole + export interface UpdateRoleRequestDto { + role: UserDto['role']; + circleId?: string; + } + + // findAllAdmissions + export interface AdmissionUserDto { + admissionYear: number; + attachImage: string | null; + createdAt: string; + description: string; + id: string; + updatedAt: string; + userEmail: string; + userName: string; + } + export interface FindAllAdmissionsResponseDto { + content: AdmissionUserDto[]; + last: boolean; + } + export interface FindAllAdmissionsResponse { + users: Model.AdmissionUser[]; + last: boolean; + } + + // findByState + export interface FindByStateResponseDto { + content: UserDto[]; + last: boolean; + } + export interface FindByStateResponse { + users: Model.User[]; + last: boolean; + } + + // findPrivilegedUsers + export interface FindPrivilegedUsersResponseDto { + councilUsers: UserDto[]; + leaderGradeUsers: UserDto[]; + leaderCircleUsers: UserDto[]; + leaderAlumni: UserDto | null; + } + + export interface FindPrivilegedUsersResponse { + councilUsers: Model.User[]; + leaderGradeUsers: Model.User[]; + leaderCircleUsers: Model.User[]; + leaderAlumni: Model.User | null; + } + + // --- + + export interface SignInRequestDto { + email: string; + password: string; + auto?: boolean; + } + + export interface IsDuplicatedEmailResponseDto { + result: boolean; + } + + export interface CreateDto { + email: string; + password: string; + name: string; + admissionYear: number; + profileImage?: string | null; + studentId: string; + } + + export interface AdmissionCreateRequestDto { + email: string; + attachImage: File | null; + description: string; + } + + export interface UpdateDto { + admissionYear: number; + email: string; + name: string; + profileImage: string | null; + studentId: string; + } + + export interface PasswordUpdateRequestDto { + originPassword: string; + updatedPassword: string; + } + + // == + + export interface FindPostsResponse { + posts: Model.HistoryPost[]; + last: boolean; + } + + export interface FindPostsResponseDto { + post: { + content: HistoryData.Post[]; + last: boolean; + }; + } + + export interface FindCommentsResponse { + comments: Model.HistoryComment[]; + last: boolean; + } + + export interface FindCommentsResponseDto { + comment: { + content: HistoryData.Comment[]; + last: boolean; + }; + } +} diff --git a/tests/tester/lockerTester.ts b/tests/tester/lockerTester.ts index 29f19754..f28ffd51 100644 --- a/tests/tester/lockerTester.ts +++ b/tests/tester/lockerTester.ts @@ -1,14 +1,32 @@ -import test from '@playwright/test'; +import test, { expect } from '@playwright/test'; import { PAGE_URL } from '../../src/configs/path'; +import { lockerAllLocationsList, lockerLocationsList } from '../../src/mocks/data/locker'; export const lockerRouterTester = () => { const baseURL = 'http://localhost:3000'; - test('사물함 화면', async ({ page }) => { + test.beforeEach('사물함 화면', async ({ page }) => { await page.click( '#root > div > main > div > div.css-1nqe5pb-Wrapper.egppv972 > a.css-xetqcl-ClearLink.ec7tn3u2 > div.css-1fukgrq-Circle.egppv971', ); await page.waitForURL(baseURL + PAGE_URL.Locker); }); + test('사물함 Locaion을 클릭하면, Location 상세 페이지로 이동한다.', async ({ page }) => { + await page.click('#root > div > main > div > a'); + await page.waitForURL(`${baseURL}/locker/${lockerAllLocationsList.lockerLocations[0].id}`); + + await expect(page.getByText(lockerAllLocationsList.lockerLocations[0].name)).toBeVisible(); + + const lockerList = lockerLocationsList.lockerList; + + const mineLockerName = lockerList.find(locker => locker.isMine === true)?.lockerNumber; + if (mineLockerName) { + const mineLocker = page.getByText(mineLockerName); + await expect(mineLocker).toBeVisible(); + await mineLocker.click(); + await expect(page.getByText('연장하기')).toBeVisible(); + await expect(page.getByText('반환하기')).toBeVisible(); + } + }); }; diff --git a/yarn.lock b/yarn.lock index ca07ca3e..90b96d49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -367,10 +367,10 @@ resolved "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz" integrity sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww== -"@esbuild/darwin-arm64@0.19.11": +"@esbuild/win32-x64@0.19.11": version "0.19.11" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz" - integrity sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ== + resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz" + integrity sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw== "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -681,10 +681,10 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-darwin-arm64@4.9.4": +"@rollup/rollup-win32-x64-msvc@4.9.4": version "4.9.4" - resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.4.tgz" - integrity sha512-1fzh1lWExwSTWy8vJPnNbNM02WZDS8AW3McEOb7wW+nPChLKf3WG2aG7fhaUmfX5FKw9zhsF5+MBwArGyNM7NA== + resolved "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.4.tgz" + integrity sha512-LfdGXCV9rdEify1oxlN9eamvDSjv9md9ZVMAbNHA87xqIfFCxImxan9qZ8+Un54iK2nnqPlbnSi4R54ONtbWBw== "@svgr/babel-plugin-add-jsx-attribute@8.0.0": version "8.0.0" @@ -2288,16 +2288,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@~2.3.2, fsevents@~2.3.3: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -fsevents@2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"