finishes 13 and 14

This commit is contained in:
2026-02-03 20:18:08 +01:00
parent c693cde038
commit baa43de4e1
47 changed files with 3522 additions and 21 deletions

View File

@@ -0,0 +1,69 @@
describe('Scoring Display', () => {
beforeEach(() => {
cy.resetDatabase()
cy.login()
})
it('shows No Go result when fewer than 5 yes answers', () => {
cy.get('[data-cy="start-screening"]').click()
// Answer 4 yes, 6 no
for (let i = 1; i <= 4; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="yes"]').check({ force: true })
})
}
for (let i = 5; i <= 10; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="no"]').check({ force: true })
})
}
cy.get('[data-cy="submit-screening"]').click()
// Should fail
cy.get('[data-cy="result-failed"]').should('exist')
cy.get('[data-cy="screening-score"]').should('contain', '4')
cy.get('[data-cy="category-select"]').should('not.exist')
})
it('passes at boundary with exactly 5 yes answers', () => {
cy.get('[data-cy="start-screening"]').click()
// Answer 5 yes, 5 no
for (let i = 1; i <= 5; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="yes"]').check({ force: true })
})
}
for (let i = 6; i <= 10; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="no"]').check({ force: true })
})
}
cy.get('[data-cy="submit-screening"]').click()
// Should pass
cy.get('[data-cy="result-passed"]').should('exist')
cy.get('[data-cy="screening-score"]').should('contain', '5')
cy.get('[data-cy="category-select"]').should('exist')
})
it('displays the score correctly', () => {
cy.get('[data-cy="start-screening"]').click()
// Answer 7 yes, 3 no
for (let i = 1; i <= 7; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="yes"]').check({ force: true })
})
}
for (let i = 8; i <= 10; i++) {
cy.get(`[data-cy="screening-answer-${i}"]`).within(() => {
cy.get('[data-cy="no"]').check({ force: true })
})
}
cy.get('[data-cy="submit-screening"]').click()
cy.get('[data-cy="screening-score"]').should('contain', '7')
})
})