-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(#191): playwright 설치하기 * feat(#191): playwright로 간단히 테스트해보기 * refactor(#191): mock 변경 사항 반영 및 불필요한 resolver 제거 및 resolver 함수명 통일하기 * refactor(#191): mock history 불필요한 함수 제거 및 DTO 적용하기 * refactor(#191): mock lotus 제목 검색 로직 추가하기 * refactor(#191): mocking 시에 페이지네이션 max 값도 계산하기 * refactor(#191): user에 대한 MockRepository 적용하기 * refactor(#191): 테스트를 위한 data-testid값을 부여 * fix(#191): lotus 삭제 시 오류 수정하기 * refactor(#191): app 레이어로 테스트 코드 이동 및 e2e 테스트 코드 작성완료
- Loading branch information
Showing
18 changed files
with
539 additions
and
400 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 |
---|---|---|
|
@@ -22,3 +22,7 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
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,35 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './src/app/test/e2e', | ||
fullyParallel: true, | ||
reporter: 'html', | ||
use: { | ||
baseURL: 'http://localhost:5173', | ||
trace: 'on-first-retry' | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] } | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] } | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] } | ||
} | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'pnpm dev', | ||
url: 'http://localhost:5173' | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,38 +1,37 @@ | ||
import { http } from 'msw'; | ||
import { mockGetGistDetail, mockGetUserGistList } from './gistResolvers'; | ||
import { getGistDetail, getUserGistList } from './gistResolvers'; | ||
import { getHistory, getHistoryList, getTagList, postCodeRun, postTag } from './historyResolvers'; | ||
import { | ||
mockGetHistory, | ||
mockGetHistoryList, | ||
mockGetTagList, | ||
mockGetUserLotusList, | ||
mockPostCodeRun, | ||
mockPostTag | ||
} from './historyResolvers'; | ||
import { deleteLotus, getLotusDetail, getPublicLotusList, patchLotus, postCreateLotus } from './lotusResolvers'; | ||
import { mockGetLogin, mockGetUserInfo, mockLogin, mockLogout, mockPatchUserInfo } from './userResolvers'; | ||
deleteLotus, | ||
getLotusDetail, | ||
getPublicLotusList, | ||
getUserLotusList, | ||
patchLotus, | ||
postCreateLotus | ||
} from './lotusResolvers'; | ||
import { getLogin, getUserInfo, patchUserInfo } from './userResolvers'; | ||
|
||
const apiUrl = (path: string) => `${import.meta.env.VITE_API_URL}${path}`; | ||
|
||
export const handlers = [ | ||
// user | ||
http.get(`/api/user`, mockGetUserInfo), | ||
http.patch(`/api/user`, mockPatchUserInfo), | ||
http.post(`/api/user/login`, mockLogin), | ||
http.get(`/api/user/login`, mockGetLogin), | ||
http.post(`/api/user/logout`, mockLogout), | ||
http.get(`/api/user/lotus`, mockGetUserLotusList), | ||
http.get(`/api/user/gist`, mockGetUserGistList), | ||
http.get(`/api/user/gist/:gistId`, mockGetGistDetail), | ||
http.get(apiUrl(`/api/user`), getUserInfo), | ||
http.patch(apiUrl(`/api/user`), patchUserInfo), | ||
http.get(apiUrl(`/api/user/login/callback`), getLogin), | ||
http.get(apiUrl(`/api/user/lotus`), getUserLotusList), | ||
http.get(apiUrl(`/api/user/gist`), getUserGistList), | ||
http.get(apiUrl(`/api/user/gist/:gistId`), getGistDetail), | ||
// lotus | ||
http.get(`/api/lotus`, getPublicLotusList), | ||
http.get(`/api/lotus/:lotusId`, getLotusDetail), | ||
http.post(`/api/lotus`, postCreateLotus), | ||
http.patch(`/api/lotus/:id`, patchLotus), | ||
http.delete(`/api/lotus/:id`, deleteLotus), | ||
http.get(apiUrl(`/api/lotus`), getPublicLotusList), | ||
http.get(apiUrl(`/api/lotus/:lotusId`), getLotusDetail), | ||
http.post(apiUrl(`/api/lotus`), postCreateLotus), | ||
http.patch(apiUrl(`/api/lotus/:id`), patchLotus), | ||
http.delete(apiUrl(`/api/lotus/:id`), deleteLotus), | ||
// history | ||
http.get(`/api/lotus/:lotusId/history`, mockGetHistoryList), | ||
http.post(`/api/lotus/:lotusId/history`, mockPostCodeRun), | ||
http.get(`/api/lotus/:lotusId/history/:historyId`, mockGetHistory), | ||
|
||
http.get(apiUrl(`/api/lotus/:lotusId/history`), getHistoryList), | ||
http.post(apiUrl(`/api/lotus/:lotusId/history`), postCodeRun), | ||
http.get(apiUrl(`/api/lotus/:lotusId/history/:historyId`), getHistory), | ||
// tag | ||
http.get(`/api/tag`, mockGetTagList), | ||
http.post(`/api/tag`, mockPostTag) | ||
http.get(apiUrl(`/api/tag`), getTagList), | ||
http.post(apiUrl(`/api/tag`), postTag) | ||
]; |
Oops, something went wrong.