diff --git a/frontend/cypress/e2e/application.second-personal-information.cy.ts b/frontend/cypress/e2e/application.second-personal-information.cy.ts new file mode 100644 index 00000000..54ba8674 --- /dev/null +++ b/frontend/cypress/e2e/application.second-personal-information.cy.ts @@ -0,0 +1,69 @@ +describe("2번째 인적사항 e2e 테스트", () => { + beforeEach(() => cy.viewport(1200, 900)); + + it("전공 입력 후 다음 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get("input.my-2.border.rounded-lg.p-4.w-full") + .eq(0) + .type("컴퓨터정보통신공학과"); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + }); + + it("전공, 복수전공 입력 후 다음 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get("input.my-2.border.rounded-lg.p-4.w-full") + .eq(0) + .type("컴퓨터정보통신공학과"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(1).type("물리학과"); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + }); + + it("전공, 부전공 입력 후 다음 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get("input.my-2.border.rounded-lg.p-4.w-full") + .eq(0) + .type("컴퓨터정보통신공학과"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(2).type("물리학과"); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + }); + + it("전공, 복수전공, 부전공 입력 후 다음 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get("input.my-2.border.rounded-lg.p-4.w-full") + .eq(0) + .type("컴퓨터정보통신공학과"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(1).type("건축학과"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(2).type("물리학과"); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + }); + + it("아무것도 입력하지 않고 다음 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + cy.on("window:alert", (text) => { + console.log("Alert message:", text); + }); + }); + + it("전공을 입력하지 않고 복수전공, 부전공을 입력 후 버튼 클릭", () => { + cy.goSecondPersonalInformation(); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(1).type("건축학과"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(2).type("물리학과"); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); + cy.on("window:alert", (text) => { + console.log("Alert message:", text); + }); + }); +}); diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 698b01a4..ea399b9c 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -1,37 +1,24 @@ -/// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -// -// declare global { -// namespace Cypress { -// interface Chainable { -// login(email: string, password: string): Chainable -// drag(subject: string, options?: Partial): Chainable -// dismiss(subject: string, options?: Partial): Chainable -// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable -// } -// } -// } \ No newline at end of file +declare namespace Cypress { + interface Chainable { + goSecondPersonalInformation(): Chainable; + } +} + +Cypress.Commands.add("goSecondPersonalInformation", () => { + cy.visit("http://localhost:3000/application"); + cy.get('[for=":R7dmlllkq:"]').click(); + cy.get('[for=":Rblmlllkq:"]').click(); + cy.get('[for=":r1:"]').click(); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); // 첫번째 인적사항 페이지로 이동 + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(0).type("심민보"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(1).type("01000000000"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(2).type("111111"); + cy.get("input.my-2.border.rounded-lg.p-4.w-full").eq(3).type("재학"); + cy.get('[for=":rb:"]').click(); + cy.get('[for=":re:"]').click(); + cy.get( + ".flex-1.rounded-md.flex.justify-center.items-center.p-4.bg-dark.text-white" + ).click(); // 두번째 인적사항 페이지로 이동 +});