test(examples): add tests for more example pages

This commit is contained in:
Dominik Biedebach
2022-05-11 17:46:30 +02:00
committed by Dominik
parent 0532770170
commit b7f95d638d
15 changed files with 701 additions and 10 deletions

View File

@@ -0,0 +1,27 @@
context('/src/Examples/Images/React/', () => {
beforeEach(() => {
cy.visit('/src/Examples/Images/React/')
})
// TODO: Write tests
it('finds image elements inside editor', () => {
cy.get('.ProseMirror img').should('have.length', 2)
})
it('allows removing images', () => {
cy.get('.ProseMirror img').should('have.length', 2)
cy.get('.ProseMirror img').first().trigger('mousedown', { which: 1 })
cy.get('.ProseMirror').type('{backspace}')
cy.get('.ProseMirror img').should('have.length', 1)
})
it('allows images to be added via URL', () => {
cy.window().then(win => {
cy.stub(win, 'prompt').returns('https://unsplash.it/250/250')
cy.get('button').contains('add image from URL').click()
cy.wait(1000)
cy.get('.ProseMirror img').should('have.length', 3)
})
})
})