Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: 두번째 기본 인적 사항 테스트 코드 작성 #163

Closed
wants to merge 8 commits into from
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
61 changes: 24 additions & 37 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
/// <reference types="cypress" />
// ***********************************************
// 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<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
declare namespace Cypress {
interface Chainable {
goSecondPersonalInformation(): Chainable<void>;
}
}

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(); // 두번째 인적사항 페이지로 이동
});