mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 21:44:21 -04:00
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:
parent
8a8bacc0aa
commit
d725b65140
53 changed files with 758 additions and 1203 deletions
|
@ -16,26 +16,20 @@ declare namespace Cypress {
|
|||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('fill', {
|
||||
prevSubject: 'element'
|
||||
}, (subject, value) => {
|
||||
return cy.wrap(subject)
|
||||
.invoke('val', value)
|
||||
.trigger('change', { force: true })
|
||||
})
|
||||
Cypress.Commands.add(
|
||||
'fill',
|
||||
{
|
||||
prevSubject: 'element'
|
||||
},
|
||||
(subject, value) => {
|
||||
return cy.wrap(subject).invoke('val', value).trigger('change', { force: true })
|
||||
}
|
||||
)
|
||||
|
||||
Cypress.Commands.add('setCodemirrorContent', (content: string) => {
|
||||
const line = content.split('\n')
|
||||
.find(value => value !== '')
|
||||
cy.get('.CodeMirror')
|
||||
.click()
|
||||
.get('textarea')
|
||||
.type('{ctrl}a')
|
||||
.type('{backspace}')
|
||||
.fill(content)
|
||||
const line = content.split('\n').find((value) => value !== '')
|
||||
cy.get('.CodeMirror').click().get('textarea').type('{ctrl}a').type('{backspace}').fill(content)
|
||||
if (line) {
|
||||
cy.get('.CodeMirror')
|
||||
.find('.CodeMirror-line')
|
||||
.should('contain.text', line)
|
||||
cy.get('.CodeMirror').find('.CodeMirror-line').should('contain.text', line)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue