From 1b2366b933d4caa4836c403c242d2198dd7fb089 Mon Sep 17 00:00:00 2001 From: ExostFlash Date: Thu, 10 Jul 2025 14:49:32 +0200 Subject: [PATCH] Fix smart & add todolist --- cypress/e2e/smart.cy.js | 5 ++--- cypress/e2e/todolist.cy.js | 16 ++++++++++++++++ package-lock.json | 10 ++++++++++ package.json | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/todolist.cy.js diff --git a/cypress/e2e/smart.cy.js b/cypress/e2e/smart.cy.js index 7241fc4..1c9a081 100644 --- a/cypress/e2e/smart.cy.js +++ b/cypress/e2e/smart.cy.js @@ -11,8 +11,7 @@ describe('template spec', () => { it('Le tag disparaît à la sortie du survol du bouton See more', () => { cy.contains('See more').trigger('mouseover') cy.get('div.absolute').should('not.have.attr', 'style') - cy.get('body').trigger('mousemove', 0, 0) - cy.wait(300) - cy.get('div.absolute').should('not.be.visible') + cy.get('body').trigger('mousemove', 0, 0).click(0, 0) + cy.get('div.absolute', { timeout: 20000 }).should('not.be.visible') }) }) \ No newline at end of file diff --git a/cypress/e2e/todolist.cy.js b/cypress/e2e/todolist.cy.js new file mode 100644 index 0000000..c7c8656 --- /dev/null +++ b/cypress/e2e/todolist.cy.js @@ -0,0 +1,16 @@ +describe('template spec', () => { + beforeEach(() => { + cy.visit('./../todolist.html') + }) + + it("Ajoute 4 todos puis supprime la 2ème, il doit en rester 3", () => { + const todos = ["Test 1", "Test 2", "Test 3", "Test 4"]; + todos.forEach(todo => { + cy.get('input[placeholder="What needs to be done?"]').type(todo) + cy.get('button[type="submit"]').click() + }) + cy.contains('Test 2').parent().find('button').click() + cy.get('.flex.items-center.justify-between').should('have.length', 3) + cy.contains('Nombre de tâche(s) : 3').should('exist') + }) +}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7616b2b..b39bfd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "cypress": "^14.5.1", + "cypress-real-events": "^1.14.0", "mocha": "^11.7.1" } }, @@ -788,6 +789,15 @@ "node": "^18.0.0 || ^20.0.0 || >=22.0.0" } }, + "node_modules/cypress-real-events": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/cypress-real-events/-/cypress-real-events-1.14.0.tgz", + "integrity": "sha512-XmI8y3OZLh6cjRroPalzzS++iv+pGCaD9G9kfIbtspgv7GVsDt30dkZvSXfgZb4rAN+3pOkMVB7e0j4oXydW7Q==", + "license": "MIT", + "peerDependencies": { + "cypress": "^4.x || ^5.x || ^6.x || ^7.x || ^8.x || ^9.x || ^10.x || ^11.x || ^12.x || ^13.x || ^14.x" + } + }, "node_modules/dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", diff --git a/package.json b/package.json index 41e3038..e5d2a29 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "cypress": "^14.5.1", + "cypress-real-events": "^1.14.0", "mocha": "^11.7.1" } }