Skip to content

Commit 2473407

Browse files
[ADD] E2E test by cypress
14 things
1 parent 6bc709e commit 2473407

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed

cypress/e2e/spec.cy.ts

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
describe("라우트 이동 테스트", () => {
2+
it("Dev 서버 E2E 테스트: '/'", () => {
3+
cy.visit("/");
4+
expect(true).equal(true);
5+
});
6+
7+
it("'/' => '/coverletter' 이동", () => {
8+
cy.visit("/").get('a[href="/coverletter"]').click();
9+
cy.location("pathname").should("equal", "/coverletter");
10+
});
11+
12+
it("'/' => '/interview' 이동", () => {
13+
cy.visit("/").get('a[href="/interview"]').click();
14+
cy.location("pathname").should("equal", "/interview");
15+
});
16+
17+
it("'/' => '/job' 이동", () => {
18+
cy.visit("/").get('a[href="/job"]').click();
19+
cy.location("pathname").should("equal", "/job");
20+
});
21+
});
22+
23+
describe("서비스 이용 테스트: 비로그인 상태", () => {
24+
it("메인에서 /coverletter 이동 후, 비로그인 상태에서 서비스 이용", () => {
25+
cy.visit("/").get('a[href="/coverletter"]').click();
26+
cy.location("pathname").should("equal", "/coverletter");
27+
28+
cy.get('input[name="job"]').type("개발자");
29+
cy.get('textarea[name="coverletter"]').type("저는 개발을 좋아합니다.");
30+
31+
cy.get('button[type="submit"]')
32+
.click({ waitForAnimations: true })
33+
.get('div[data-testid="toast"]');
34+
});
35+
36+
it("메인에서 /interview 이동 후, 비로그인 상태에서 서비스 이용", () => {
37+
cy.visit("/").get('a[href="/interview"]').click();
38+
cy.location("pathname").should("equal", "/interview");
39+
40+
cy.get('input[name="job"]').type("개발자");
41+
cy.get('input[name="domain"]').type("IT");
42+
cy.get('input[name="project"]').type("To do list");
43+
cy.get('input[name="skill"]').type("Javascript");
44+
cy.get('textarea[name="description"]').type("To do list 웹 앱 개발");
45+
46+
cy.get('button[type="submit"]')
47+
.click({ waitForAnimations: true })
48+
.get('div[data-testid="toast"]');
49+
});
50+
51+
it("메인에서 /job 이동 후, 비로그인 상태에서 서비스 이용", () => {
52+
cy.visit("/").get('a[href="/job"]').click();
53+
cy.location("pathname").should("equal", "/job");
54+
55+
cy.get("input").type("섬세함");
56+
cy.get('button[aria-label="add personality button"]').click();
57+
58+
cy.get("input").type("열정");
59+
cy.get('button[aria-label="add personality button"]').click();
60+
61+
cy.get('button[aria-label="require recommendation button"]')
62+
.click({ waitForAnimations: true })
63+
.get('div[data-testid="toast"]');
64+
});
65+
});
66+
67+
describe("로그인 모달 테스트", () => {
68+
it("'/': 로그인 모달 팝업 후, 모달 끄기", () => {
69+
cy.visit("/");
70+
cy.get('button[data-testid="sign button"]').click();
71+
72+
cy.get('div[role="dialog"]');
73+
cy.get('button[data-testid="close button"]').click();
74+
75+
cy.get("main").not('div[role="dialog"]');
76+
});
77+
78+
it("로그인 모달 팝업 후, 메서드 토글: 접속하기 => 가입하기", () => {
79+
cy.visit("/");
80+
cy.get('button[data-testid="sign button"]').click();
81+
82+
cy.get('h3[data-testid="login heading"]');
83+
84+
cy.get('button[data-testid="toggle button"]').click();
85+
86+
cy.get('h3[data-testid="join heading"]');
87+
});
88+
89+
it("로그인 모달 팝업 후, 로그인 시도: 서버 점검 상태", () => {
90+
cy.visit("/");
91+
cy.get('button[data-testid="sign button"]').click();
92+
93+
cy.get('input[type="email"]').type("id@example.com");
94+
cy.get('input[type="password"]').type("1234");
95+
96+
cy.get('button[type="submit"]')
97+
.click({ waitForAnimations: true })
98+
.get('div[data-testid="toast"]');
99+
});
100+
101+
it("로그인 모달 팝업 후, 비밀번호 찾기 시도: 서버 점검 상태", () => {
102+
cy.visit("/");
103+
cy.get('button[data-testid="sign button"]').click();
104+
cy.get('button[aria-label="reset password button"]').click();
105+
106+
cy.get('form[aria-label="checking email form"]');
107+
cy.get('input[type="email"]').type("id@example.com");
108+
109+
cy.get('button[aria-label="checking the email button"]')
110+
.click({ waitForAnimations: true })
111+
.get('div[data-testid="toast"]');
112+
});
113+
114+
it("'/coverletter': 로그인 모달 팝업 후, 모달 끄기", () => {
115+
cy.visit("/coverletter");
116+
cy.get('button[data-testid="sign button"]').click();
117+
118+
cy.get('div[role="dialog"]');
119+
cy.get('button[data-testid="close button"]').click();
120+
121+
cy.get("main").not('div[role="dialog"]');
122+
});
123+
124+
it("'/interview': 로그인 모달 팝업 후, 모달 끄기", () => {
125+
cy.visit("/interview");
126+
cy.get('button[data-testid="sign button"]').click();
127+
128+
cy.get('div[role="dialog"]');
129+
cy.get('button[data-testid="close button"]').click();
130+
131+
cy.get("main").not('div[role="dialog"]');
132+
});
133+
134+
it("'/job': 로그인 모달 팝업 후, 모달 끄기", () => {
135+
cy.visit("/job");
136+
cy.get('button[data-testid="sign button"]').click();
137+
138+
cy.get('div[role="dialog"]');
139+
cy.get('button[data-testid="close button"]').click();
140+
141+
cy.get("main").not('div[role="dialog"]');
142+
});
143+
});

0 commit comments

Comments
 (0)