2021-01-24 14:50:51 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
2021-02-03 16:13:04 -05:00
|
|
|
getMarkdownRenderer(): Chainable<Element>
|
2021-01-24 14:50:51 -05:00
|
|
|
|
2021-02-03 16:13:04 -05:00
|
|
|
getMarkdownBody(): Chainable<Element>
|
2021-01-24 14:50:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cypress.Commands.add('getMarkdownRenderer', () => {
|
2021-06-18 17:26:36 -04:00
|
|
|
return cy
|
2021-06-19 10:00:23 -04:00
|
|
|
.get(`iframe[data-cy="documentIframe"][data-content-ready="true"]`)
|
2021-06-18 17:26:36 -04:00
|
|
|
.should('be.visible')
|
|
|
|
.its('0.contentDocument')
|
|
|
|
.should('exist')
|
|
|
|
.its('body')
|
|
|
|
.should('not.be.undefined')
|
|
|
|
.then(cy.wrap.bind(cy))
|
2021-01-24 14:50:51 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
Cypress.Commands.add('getMarkdownBody', () => {
|
2021-06-18 17:26:36 -04:00
|
|
|
return cy.getMarkdownRenderer().find('.markdown-body')
|
2021-01-24 14:50:51 -05:00
|
|
|
})
|