-
Notifications
You must be signed in to change notification settings - Fork 4
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
cypress를 이용한 e2e test 도입 #821
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
experimentalStudio: true, | ||
|
||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { mount } from 'cypress/react'; | ||
|
||
// Augment the Cypress namespace to include type definitions for | ||
// your custom command. | ||
// Alternatively, can be defined in cypress/support/component.d.ts | ||
// with a <reference path="./component" /> at the top of your spec. | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"plugin:cypress/recommended" | ||
] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맨 끝 개행 한번 해주실 수 있나여? EOL이여 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const visitUrl = 'http://localhost:3000/'; | ||
|
||
describe('guestFeatureTest', () => { | ||
it('visitSite', () => { | ||
cy.visit(visitUrl); | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
it('controlPostListFilteringOrSorting', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.get(':nth-child(1) > .sc-gVpkOZ > .sc-fXmShK').click(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 음 저희가 styeld-compoents 여서 클래스명만 가지고는 어떤 컴포넌트인지 이해하기 쉽지 않은데, 혹시 주석 추가해주실 수 있나요? (아니면 it의 테스트 이름을 한글로 적어주실 수 있을지....?) |
||
cy.get('.sc-gyMiQo > :nth-child(1)').click(); | ||
cy.get(':nth-child(2) > .sc-gVpkOZ > .sc-fXmShK').click(); | ||
cy.get('.sc-gyMiQo > :nth-child(1)').click(); | ||
//list 확인 필요 | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
it('lookRankingAndGoPopularPost', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.get('.sc-fWKGHs > .gHxHbZ > img').click(); | ||
cy.get('.cbweqh').click(); | ||
cy.get(':nth-child(1) > :nth-child(3) > a').click(); | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
it('lookNoticeListAndNoticeDetail', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.get('.sc-hmrlCG > .sc-iJSKBe > .sc-giQjdv > span').click(); | ||
//list 확인 필요 | ||
cy.get(':nth-child(1) > .sc-fGwJSW > .sc-hmftdN').click(); | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
it('showToastForGuest', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.get('.sc-fWKGHs > .sc-gSIKdN > .sc-iNyIUv > img').click(); | ||
cy.get('.sc-bdDrbm').should('exist').should('contain', '로그인 후 이용'); | ||
/* ==== End Cypress Studio ==== */ | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.get( | ||
'.sc-hmrlCG > .sc-iJSKBe > .sc-bYgGll > .sc-dILiZe > .sc-fKwBvW > .sc-dYlqv > .sc-hCcNSO > :nth-child(1) > .sc-fFCYnF > img' | ||
).click(); | ||
cy.get('.sc-bdDrbm').should('exist').should('contain', '로그인 후 이용'); | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
it('scrollTopScreen', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.scrollTo('bottom'); | ||
cy.scrollTo('bottom'); | ||
cy.scrollTo('bottom'); | ||
cy.get('.sc-eEFsNM').click(); | ||
cy.get('html, body').should($el => { | ||
expect($el.scrollTop()).to.equal(0); | ||
}); | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
|
||
/* ==== Test Created with Cypress Studio ==== */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 이 주석 필요한건가요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사람이 직접 작성한게 아니고 스튜디오를 사용해서 만들다보니까 특정 요소가 있는지 없는지, 정렬되었는지 넣는 건 어렵더라구요. 그래서 스튜디오로 작성한건 나중에 다시 한번 살펴보려고 넣었습니다. |
||
it('searchAKeyword', function () { | ||
/* ==== Generated with Cypress Studio ==== */ | ||
cy.visit('http://localhost:3000/'); | ||
cy.get('.sc-jePPIV').click(); | ||
cy.get('.sc-eIYifI').clear(); | ||
cy.get('.sc-eIYifI').type('a'); | ||
cy.get('.sc-otYyL > img').click(); | ||
//list | ||
/* ==== End Cypress Studio ==== */ | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다 주석 처리되어 있는데 아예 불필요한 파일인가요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제가 옛날에 삭제했을 때 아마도 작동이 안되었던 걸로 기억하네용 |
||
// 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> | ||
// } | ||
// } | ||
// } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"lib": ["es5", "dom"], | ||
"types": ["cypress", "node"] | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 필수적인 설정인지 궁금해요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 부분을 통해서 싸이프레스를 사용할 때 이벤트리스너를 붙일 수 있다고 합니다!
기본 설정으로 만들어진 부분인데, 추후 어떻게 사용할 지 몰라서 남겨두었습니다