From d0eabc9dc3e0b139c049d50f9909ab1e836559ea Mon Sep 17 00:00:00 2001 From: Hammad1007 Date: Tue, 26 Dec 2023 14:37:16 +0500 Subject: [PATCH] Update test code --- notes-app/cypress/e2e/test1.spec.cy.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/notes-app/cypress/e2e/test1.spec.cy.js b/notes-app/cypress/e2e/test1.spec.cy.js index b494575..2b8ff76 100644 --- a/notes-app/cypress/e2e/test1.spec.cy.js +++ b/notes-app/cypress/e2e/test1.spec.cy.js @@ -1,4 +1,5 @@ describe('Project: Notes-App', () => { + beforeEach(() => { cy.visit('http://127.0.0.1:5500/notes-app') }) @@ -11,18 +12,18 @@ describe('Project: Notes-App', () => { cy.get('body').should('be.visible') }) - context('Background-color', () => { - - it('Background color is visible', () => { - cy.get('body').should('be.visible') - }) + context('Body', () => { - it('Background color is correct', () => { - cy.get('body').should('have.css', 'background-color', 'rgb(123, 218, 243)') + context('Background-color', () => { + it('Background color is visible', () => { + cy.get('body').should('be.visible') + }) + + it('Background color is correct', () => { + cy.get('body').should('have.css', 'background-color', 'rgb(123, 218, 243)') + }) }) - }) - - context('Body', () => { + context('Add Note Button', () => { it('The button is visible', () => { cy.get('body').get('.add').should('be.visible') @@ -85,8 +86,9 @@ describe('Project: Notes-App', () => { cy.get('.edit').should('be.visible').click() }) - it('The button when clicked saves the text and does not allow me to edit it and when clicked again allows me to edit the text', () => { + it('The toggle button to edit and save the text', () => { cy.get('.note').should('be.visible').type('Hello world, how are you?') + cy.get('.edit').should('be.visible').click() cy.get('.note textarea').should('not.be.visible')