test: add new tests for multiple examples

Added tests for CSS modules, Custom Documents and the Default Editor example
This commit is contained in:
Dominik Biedebach
2022-05-11 11:44:14 +02:00
committed by Dominik
parent 790aaeb915
commit 3d0074b294
15 changed files with 538 additions and 20 deletions

View File

@@ -1,7 +1,48 @@
context('/src/Examples/CustomDocument/Vue/', () => {
before(() => {
beforeEach(() => {
cy.visit('/src/Examples/CustomDocument/Vue/')
})
// TODO: Write tests
it('should have a working tiptap instance', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should have a headline and a paragraph', () => {
cy.get('.ProseMirror h1').should('exist').should('have.text', 'Itll always have a heading …')
cy.get('.ProseMirror p').should('exist').should('have.text', '… if you pass a custom document. Thats the beauty of having full control over the schema.')
})
it('should have a tooltip for a paragraph on a new line', () => {
cy.get('.ProseMirror').type('{enter}')
cy.get('.ProseMirror p[data-placeholder]').should('exist').should('have.attr', 'data-placeholder', 'Can you add some further context?')
})
it('should have a headline after clearing the document', () => {
cy.get('.ProseMirror').type('{selectall}{backspace}')
cy.wait(100)
cy.get('.ProseMirror').focus()
cy.get('.ProseMirror h1[data-placeholder]')
.should('exist')
.should('have.attr', 'class', 'is-empty is-editor-empty')
.should('have.attr', 'data-placeholder', 'Whats the title?')
})
it('should have a headline after clearing the document & enter paragraph automatically after adding a headline', () => {
cy.get('.ProseMirror').type('{selectall}{backspace}Hello world{enter}')
cy.wait(100)
cy.get('.ProseMirror h1')
.should('exist')
.should('have.text', 'Hello world')
cy.get('.ProseMirror p[data-placeholder]')
.should('exist')
.should('have.attr', 'data-placeholder', 'Can you add some further context?')
cy.get('.ProseMirror').type('This is a paragraph for this test document')
cy.get('.ProseMirror p')
.should('exist')
.should('have.text', 'This is a paragraph for this test document')
})
})