Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ignore


# Created by https://www.toptal.com/developers/gitignore/api/vscode,node,intellij
# Edit at https://www.toptal.com/developers/gitignore?templates=vscode,node,intellij
Expand Down
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
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": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
85 changes: 85 additions & 0 deletions cypress/integration/calculator.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
it("숫자를 클릭할 수 있어야 한다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("1").click();
cy.get(".digit").contains("2").click();
cy.get(".digit").contains("3").click();

cy.get("#total").should("have.text", "123");
});

it("2개의 숫자에 대해 덧셈이 가능하다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("2").click();
cy.get(".operation").contains("+").click();
cy.get(".digit").contains("9").click();

cy.get(".operation").contains("=").click();
cy.get("#total").should("have.text", "11");
});

it("2개의 숫자에 대해 뺄셈이 가능하다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("2").click();
cy.get(".operation").contains("-").click();
cy.get(".digit").contains("9").click();

cy.get(".operation").contains("=").click();
cy.get("#total").should("have.text", "-7");
});

it("2개의 숫자에 대해 곱셈이 가능하다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("2").click();
cy.get(".operation").contains("X").click();
cy.get(".digit").contains("9").click();

cy.get(".operation").contains("=").click();
cy.get("#total").should("have.text", "18");
});

it("2개의 숫자에 대해 나눗셈이 가능하다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("8").click();
cy.get(".operation").contains("/").click();
cy.get(".digit").contains("2").click();

cy.get(".operation").contains("=").click();
cy.get("#total").should("have.text", "4");
});

it("AC(All Clear)버튼을 누르면 0으로 초기화 한다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("1").click();
cy.get(".digit").contains("2").click();
cy.get(".modifier").click();

cy.get("#total").should("have.text", "0");
});

it("숫자는 한번에 최대 3자리 수까지 입력 가능하다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("9").click();
cy.get(".digit").contains("9").click();
cy.get(".digit").contains("9").click();
cy.get(".digit").contains("9").click();

cy.get("#total").should("have.text", "999");
});

it("계산 결과를 표현할 때 소수점 이하는 버림한다.", () => {
cy.visit("index.html");

cy.get(".digit").contains("5").click();
cy.get(".operation").contains("/").click();
cy.get(".digit").contains("3").click();
cy.get(".operation").contains("=").click();

cy.get("#total").should("have.text", "1");
});
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'

// Alternatively you can use CommonJS syntax:
// require('./commands')
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ <h1 id="total">0</h1>
</div>
</div>
</div>
<script type="module" src="./src/js/index.js"></script>
</body>
</html>
Loading