Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit 3fe0f81

Browse files
authored
feat: 백엔드 관련 스크립트 추가 (#413)
1 parent bd15a50 commit 3fe0f81

File tree

18 files changed

+190
-43
lines changed

18 files changed

+190
-43
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ node_modules/
4848
/playwright-report/
4949
/blob-report/
5050
/playwright/.cache/
51+
52+
csereal-server/

Dockerfile.playwright

Lines changed: 0 additions & 18 deletions
This file was deleted.

apis/v2/mock-login.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Role } from '@/apis/types/role';
2+
import { BASE_URL } from '@/constants/env';
23

34
export const getMockLogin = (role: Role) =>
4-
fetch(`https://cse-dev-waffle.bacchus.io/api/v2/mock-login?role=${role}`, {
5+
fetch(`${BASE_URL}/v2/mock-login?role=${role}`, {
56
method: 'GET',
67
cache: 'no-store',
78
});

apis/v2/mock-logout.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { BASE_URL } from '@/constants/env';
2+
13
export const getMockLogout = () =>
2-
fetch(`https://cse-dev-waffle.bacchus.io/api/v2/mock-logout`, {
4+
fetch(`https://${BASE_URL}/api/v2/mock-logout`, {
35
method: 'GET',
46
cache: 'no-store',
57
});

constants/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const isBeta = process.env.NEXT_PUBLIC_PHASE === 'beta';
22
export const isProd = process.env.NEXT_PUBLIC_PHASE === 'prod';
3+
export const isDevlocal = process.env.NEXT_PUBLIC_PHASE === 'devlocal';
34

45
export const BASE_URL = {
56
local: 'https://cse-dev-waffle.bacchus.io/api',

docker-compose.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

e2e/fixtures/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { mergeTests } from '@playwright/test';
2+
3+
import { test as pagesTest } from './pages.fixture';
4+
import { test as roleTest } from './role.fixture';
5+
6+
export const test = mergeTests(roleTest, pagesTest);

e2e/fixtures/pages.fixture.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// TODO: eslint 문제 이 파일을 제외함으로서 예쁘게 해결하기
2+
/* eslint-disable react-hooks/rules-of-hooks */
3+
4+
import { Page } from '@playwright/test';
5+
6+
import { NoticeCreatePage } from '../pages/community/notice/create.page';
7+
import { NoticePage } from '../pages/community/notice/index.page';
8+
import { test as base } from './role.fixture';
9+
10+
type PagesFixtures = {
11+
noticePage: NoticePage;
12+
noticeCreatePage: NoticeCreatePage;
13+
};
14+
15+
export const test = base.extend<PagesFixtures>({
16+
noticePage: async ({ page }: { page: Page }, use: (page: NoticePage) => Promise<void>) => {
17+
await use(new NoticePage(page));
18+
},
19+
noticeCreatePage: async (
20+
{ page }: { page: Page },
21+
use: (page: NoticeCreatePage) => Promise<void>,
22+
) => {
23+
await use(new NoticeCreatePage(page));
24+
},
25+
});

e2e/fixtures/role.fixture.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// TODO: eslint 문제 이 파일을 제외함으로서 예쁘게 해결하기
2+
/* eslint-disable react-hooks/rules-of-hooks */
3+
4+
import { test as base } from '@playwright/test';
5+
6+
export type Role = 'STAFF' | 'RESERV' | 'COUNCIL';
7+
8+
type RoleFixtures = {
9+
loginAs: (role: Role) => Promise<void>;
10+
};
11+
12+
export const test = base.extend<RoleFixtures>({
13+
loginAs: async ({ page }, use) => {
14+
const login = async (role: Role) => {
15+
await page.waitForLoadState('networkidle');
16+
await page.getByRole('button', { name: role, exact: true }).click();
17+
};
18+
await use(login);
19+
},
20+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { type Locator, type Page } from '@playwright/test';
2+
3+
export class NoticeCreatePage {
4+
readonly page: Page;
5+
readonly titleInput: Locator;
6+
readonly contentEditor: Locator;
7+
readonly submitButton: Locator;
8+
9+
constructor(page: Page) {
10+
this.page = page;
11+
this.titleInput = page.getByPlaceholder('제목을 입력하세요.');
12+
this.contentEditor = page.locator('div.sun-editor-editable');
13+
this.submitButton = page.getByRole('button', { name: // });
14+
}
15+
16+
async goto() {
17+
await this.page.goto('/community/notice/create');
18+
}
19+
20+
async fillTitle(title: string) {
21+
await this.titleInput.fill(title);
22+
}
23+
24+
async fillContent(content: string) {
25+
await this.contentEditor.fill(content);
26+
}
27+
28+
async clickSubmitButton() {
29+
await this.submitButton.click();
30+
}
31+
}

0 commit comments

Comments
 (0)