Skip to content

Commit

Permalink
feat: add cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Nov 28, 2021
1 parent c71ba39 commit aa2e1b9
Show file tree
Hide file tree
Showing 10 changed files with 13,066 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
"prettier",
"plugin:cypress/recommended"
],
"rules": {
"no-shadow": "off",
Expand Down
8 changes: 8 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"baseUrl": "http://localhost:3000",
"env": {
"cypress-react-selector": {
"root": "#root"
}
}
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
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"
}
11 changes: 11 additions & 0 deletions cypress/integration/guest.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="Cypress" />

context("로그인 하지 않은 유저 메인 페이지", () => {
beforeEach(() => {
cy.visit("/");
});

it("홈페이지 접속이 가능하다.", () => {
cy.log("hi");
});
});
22 changes: 22 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js 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) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js 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";
import "cypress-react-selector";
// Alternatively you can use CommonJS syntax:
// require('./commands')
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@
"babel-loader": "8.2.3",
"babel-plugin-import": "1.13.3",
"babel-plugin-styled-components": "1.13.3",
"cypress": "9.1.0",
"cypress-react-selector": "2.3.13",
"eslint": "7.32.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-next": "11.1.2",
"eslint-config-prettier": "8.3.0",
"eslint-import-resolver-babel-module": "5.3.1",
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-cypress": "2.12.1",
"eslint-plugin-import": "2.25.2",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"isolatedModules": false,
"jsx": "preserve"
},
"include": [
Expand Down
Loading

0 comments on commit aa2e1b9

Please sign in to comment.