Cypress-IDs and prettier for tests (#1634)

* Add cy.getById method and run prettier

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2021-11-19 18:04:04 +01:00 committed by GitHub
parent 8a8bacc0aa
commit d725b65140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 758 additions and 1203 deletions

View file

@ -12,32 +12,32 @@ describe('Test word count with', () => {
it('empty note', () => {
cy.setCodemirrorContent('')
cy.wait(500)
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '0')
cy.getById('sidebar-btn-document-info').click()
cy.getById('document-info-modal').should('be.visible')
cy.getById('document-info-word-count').should('have.text', '0')
})
it('simple words', () => {
cy.setCodemirrorContent('five words should be enough')
cy.wait(500)
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '5')
cy.getById('sidebar-btn-document-info').click()
cy.getById('document-info-modal').should('be.visible')
cy.getById('document-info-word-count').should('have.text', '5')
})
it('excluded codeblocks', () => {
cy.setCodemirrorContent('```\nthis is should be ignored\n```\n\ntwo `words`')
cy.wait(500)
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '2')
cy.getById('sidebar-btn-document-info').click()
cy.getById('document-info-modal').should('be.visible')
cy.getById('document-info-word-count').should('have.text', '2')
})
it('excluded images', () => {
cy.setCodemirrorContent('![ignored alt text](https://dummyimage.com/48) not ignored text')
cy.wait(500)
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '3')
cy.getById('sidebar-btn-document-info').click()
cy.getById('document-info-modal').should('be.visible')
cy.getById('document-info-word-count').should('have.text', '3')
})
})