[[oktatas:web:javascript:javascript_teszt|< JavaScript teszt]]
====== Cypress ======
* **Szerző:** Sallai András
* Copyright (c) 2024, Sallai András
* Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]]
* Web: https://szit.hu
===== Webhely =====
* https://www.cypress.io/ (2024)
===== A Cypress =====
Telepítés a projektbe:
npm install cypress --save-dev
===== Teszt készítése =====
npx cypress open
===== Csak futtatás =====
npx cypress run
===== Háromszög területszámítás tesztelése =====
describe('Háromszög számoló', () => {
beforeEach(function() {
cy.visit('http://localhost:3000')
})
it('Bemenet 30 és 35-re, 525', () => {
cy.get('#base').invoke('val', 30)
cy.get('#height').invoke('val', 35)
cy.get('#calcButton').click()
.then( () => {
cy.get('#area').should('have.value', '525')
})
})
})
Szerepel-e az oldalon:
it('Alap szerepel az oldalon', () => {
cy.contains('Alap')
})
it('Magasság szerepel az oldalon', () => {
cy.contains('Magasság')
})
it('Terület szerepel az oldalon', () => {
cy.contains('Terület')
})
it('Van button', () => {
cy.get('button')
})