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

Pruebas de porcentaje Francisco Mestizo #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
45 changes: 45 additions & 0 deletions projects/calculator/cypress/e2e/calc.cy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

describe('template spec', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
Expand All @@ -7,4 +8,48 @@ describe('template spec', () => {
cy.contains('6').click()
cy.get('.component-display').first().should('have.text', '6')
})
})

describe('Prueba de porcentaje 1', () => {
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('0').click()
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '5')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hay que generar una prueba donde de resultado falso.
Y que tal una prueba donde hagas hagas lo siguiente:

Numero random del 1 al 50 se guarda en una variable para el primer operando
Numero random del 1 al 100 se guarda la variable para el operador porcentual
Por medio de regla de tres sacas el resultado y lo guardas en una variable
Utilizas la calculadora para obtener los porcentajes
Al final comparas el resultado de la regla de 3 contra lo obtenido en el display

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Profe, hice un nuevo commit con los casos que pidio, no se si ya con eso es suficiente o si hay alguna forma de meterlo al PR (O si en automatico con el commit entra a este PR)

})
})

describe('Prueba de porcentaje 2', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
cy.contains('AC').click()
cy.contains('2').click()
cy.contains('%').click()
cy.contains('x').click()
cy.contains('1').click()
cy.contains('2').click()
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '0.24')
})
})

describe('Prueba de porcentaje 3', () => {
it('passes', () => {
cy.visit('http://localhost:3000/')
cy.contains('AC').click()
cy.contains('2').click()
cy.contains('0').click()
cy.contains('%').click()
cy.contains('x').click()
cy.contains('5').click()
cy.contains('0').click()
cy.contains('=').click()
cy.get('.component-display').first().should('have.text', '10')
})
})
Loading