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

Jorge de leon #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
69 changes: 69 additions & 0 deletions projects/calculator/cypress/e2e/porcentaje.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//prueba normal de porcentaje
describe('porcentajes1 ', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
cy.contains('AC').click()
cy.contains('1').click()
cy.contains('0').click()
cy.contains('%').click()
cy.contains('x').click()
cy.contains('5').click()
cy.contains('2').click()
cy.contains('3').click()
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '52.3')
})
})

//prueba con porcentaje negativo
describe('porcentajes-negativos ', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
cy.contains('AC').click()
cy.contains('1').click()
cy.contains('0').click()
cy.contains('%').click()
cy.contains('x').click()
cy.contains('2').click()
cy.contains('0').click()
cy.contains('-').click()
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '-2')
})
})

//funcion auxiliar para probar numeros aletorios
function porcentajesAux(num) {
let string = num.toString()

if (string.length > 2) {
cy.contains(string[0]).click()
cy.contains(string[1]).click()
cy.contains(string[2]).click()
}
if (string.length == 2) {
cy.contains(string[0]).click()
cy.contains(string[1]).click()
} else {
cy.contains(string[0]).click()
}

}

//prueba con un porcentaje aleatorio
describe('porcentajes-aleatorios ', () => {
it('passes', () => {
const num1 = Math.floor(Math.random() * 100) + 1;
const num2 = Math.floor(Math.random() * 250) + 1;
const reglaDeTres = (num1 * num2) / 100

cy.visit('http://localhost:3000/')
cy.contains('AC').click()
porcentajesAux(num1)
cy.contains('%').click()
cy.contains('x').click()
porcentajesAux(num2)
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '52.3')
})
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/calculator/cypress/videos/calc.cy.js.mp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
19,806 changes: 9,903 additions & 9,903 deletions projects/calculator/yarn.lock

Large diffs are not rendered by default.