From 63ac493bb00536b2db093a5859aec2179678f5a7 Mon Sep 17 00:00:00 2001 From: Hammad1007 Date: Fri, 22 Dec 2023 11:25:36 +0500 Subject: [PATCH] Update the test code --- dad-jokes/cypress/e2e/test1.spec.cy.js | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dad-jokes/cypress/e2e/test1.spec.cy.js b/dad-jokes/cypress/e2e/test1.spec.cy.js index 40fbe64..b794ff8 100644 --- a/dad-jokes/cypress/e2e/test1.spec.cy.js +++ b/dad-jokes/cypress/e2e/test1.spec.cy.js @@ -27,5 +27,34 @@ describe('Project: Dad Jokes', () => { cy.get('body').get('.container h3').should('have.text', "Don't Laugh Challenge") }) }) + + context('Get Another Joke button', () => { + it('Get Another Joke button is visible', () => { + cy.get('.btn').should('be.visible') + }) + + it('Color of the button is correct', () => { + cy.get('.btn').should('have.css', 'background-color', 'rgb(159, 104, 224)') + }) + + it('The button has the correct text displayed', () => { + cy.get('.btn').should('have.text', 'Get Another Joke') + }) + + it('The button is clickable', () => { + cy.get('.btn').should('be.visible').click() + }) + }) + + context('Joke', () => { + it('Joke is visible', () => { + cy.get('.container .joke#joke').should('be.visible') + }) + + it('Gets a new joke when the button is clicked', () => { + cy.get('.btn').should('be.visible').click() + cy.get('.container .joke#joke').should('be.visible') + }) + }) }) }) \ No newline at end of file