From 483468df6620cfe3122813a9aeef9c17bb8be15d Mon Sep 17 00:00:00 2001 From: Dominik Biedebach Date: Fri, 13 May 2022 14:34:53 +0200 Subject: [PATCH] test: fix broken tests & change inactive time for cypress --- .../CollaborativeEditing/React/index.spec.js | 12 +++++------- .../Examples/CollaborativeEditing/Vue/index.spec.js | 13 +++++-------- demos/src/Examples/Images/React/index.spec.js | 2 +- demos/src/Examples/Images/Vue/index.spec.js | 1 + .../CollaborationAnnotation/Vue/index.spec.js | 4 ++++ tests/cypress.json | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/demos/src/Examples/CollaborativeEditing/React/index.spec.js b/demos/src/Examples/CollaborativeEditing/React/index.spec.js index 675caa42..ced25843 100644 --- a/demos/src/Examples/CollaborativeEditing/React/index.spec.js +++ b/demos/src/Examples/CollaborativeEditing/React/index.spec.js @@ -4,19 +4,17 @@ context('/src/Examples/CollaborativeEditing/React/', () => { }) it('should show the current room with participants', () => { - cy.get('.editor__status').then(status => { - status.should('contain', 'rooms.') - status.should('contain', 'users online') - }) + cy.wait(3000) + cy.get('.editor__status') + .should('contain', 'rooms.') + .should('contain', 'users online') }) it('should allow user to change name', () => { cy.window().then(win => { - cy.wait(5000) - cy.stub(win, 'prompt').returns('John Doe') cy.get('.editor__name > button').click() - cy.wait(1000) + cy.wait(3000) cy.get('.editor__name').should('contain', 'John Doe') }) diff --git a/demos/src/Examples/CollaborativeEditing/Vue/index.spec.js b/demos/src/Examples/CollaborativeEditing/Vue/index.spec.js index 420753ea..a9318665 100644 --- a/demos/src/Examples/CollaborativeEditing/Vue/index.spec.js +++ b/demos/src/Examples/CollaborativeEditing/Vue/index.spec.js @@ -4,21 +4,18 @@ context('/src/Examples/CollaborativeEditing/Vue/', () => { }) it('should show the current room with participants', () => { - cy.get('.editor__status').then(status => { - status.should('contain', 'rooms.') - status.should('contain', 'users online') - }) + cy.wait(3000) + cy.get('.editor__status') + .should('contain', 'rooms.') + .should('contain', 'users online') }) it('should allow user to change name', () => { cy.window().then(win => { - cy.wait(5000) - cy.stub(win, 'prompt').returns('John Doe') cy.get('.editor__name > button').click() - cy.wait(1000) + cy.wait(3000) cy.get('.editor__name').should('contain', 'John Doe') }) - }) }) diff --git a/demos/src/Examples/Images/React/index.spec.js b/demos/src/Examples/Images/React/index.spec.js index 5c48da81..97567193 100644 --- a/demos/src/Examples/Images/React/index.spec.js +++ b/demos/src/Examples/Images/React/index.spec.js @@ -3,7 +3,6 @@ context('/src/Examples/Images/React/', () => { cy.visit('/src/Examples/Images/React/') }) - // TODO: Write tests it('finds image elements inside editor', () => { cy.get('.ProseMirror img').should('have.length', 2) }) @@ -19,6 +18,7 @@ context('/src/Examples/Images/React/', () => { cy.window().then(win => { cy.stub(win, 'prompt').returns('https://unsplash.it/250/250') + cy.wait(1000) cy.get('button').contains('add image from URL').click() cy.wait(1000) cy.get('.ProseMirror img').should('have.length', 3) diff --git a/demos/src/Examples/Images/Vue/index.spec.js b/demos/src/Examples/Images/Vue/index.spec.js index e35f0873..6e8e554c 100644 --- a/demos/src/Examples/Images/Vue/index.spec.js +++ b/demos/src/Examples/Images/Vue/index.spec.js @@ -19,6 +19,7 @@ context('/src/Examples/Images/Vue/', () => { cy.window().then(win => { cy.stub(win, 'prompt').returns('https://unsplash.it/250/250') + cy.wait(1000) cy.get('button').contains('add image from URL').click() cy.wait(1000) cy.get('.ProseMirror img').should('have.length', 3) diff --git a/demos/src/Experiments/CollaborationAnnotation/Vue/index.spec.js b/demos/src/Experiments/CollaborationAnnotation/Vue/index.spec.js index af788f11..52e530f4 100644 --- a/demos/src/Experiments/CollaborationAnnotation/Vue/index.spec.js +++ b/demos/src/Experiments/CollaborationAnnotation/Vue/index.spec.js @@ -39,8 +39,10 @@ context('/src/Experiments/CollaborationAnnotation/Vue/', () => { cy.get('.editor-1 .ProseMirror').type('{selectall}{backspace}Hello world{selectall}') cy.get('button').contains('comment').eq(0).click() + cy.wait(1000) cy.get('.comment').should('exist').contains('This is a test comment') cy.get('button').contains('update').click() + cy.wait(1000) cy.get('.comment').should('exist').contains('This is the new comment') }) }) @@ -51,9 +53,11 @@ context('/src/Experiments/CollaborationAnnotation/Vue/', () => { cy.get('.editor-1 .ProseMirror').type('{selectall}{backspace}Hello world{selectall}') cy.get('button').contains('comment').eq(0).click() + cy.wait(1000) cy.get('.comment').should('exist').contains('This is a test comment') cy.get('button').contains('remove').click() cy.get('.ProseMirror .annotation').should('not.exist') + cy.wait(1000) cy.get('.comment').should('not.exist') }) }) diff --git a/tests/cypress.json b/tests/cypress.json index 5162454f..1eeb7a07 100644 --- a/tests/cypress.json +++ b/tests/cypress.json @@ -2,5 +2,5 @@ "baseUrl": "http://localhost:3000", "integrationFolder": "../", "testFiles": "{demos,tests}/**/*.spec.{js,ts}", - "defaultCommandTimeout": 50000 + "defaultCommandTimeout": 5000 }