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-10-04 06:50:39 -04:00
|
|
|
getIframeBody(): Chainable<Element>
|
|
|
|
getReveal(): Chainable<Element>
|
2021-02-03 16:13:04 -05:00
|
|
|
getMarkdownBody(): Chainable<Element>
|
2021-01-24 14:50:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 06:50:39 -04:00
|
|
|
Cypress.Commands.add('getIframeBody', () => {
|
2021-06-18 17:26:36 -04:00
|
|
|
return cy
|
2021-10-17 15:20:23 -04:00
|
|
|
.get(`iframe[data-cypress-id="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
|
|
|
})
|
|
|
|
|
2021-10-04 06:50:39 -04:00
|
|
|
Cypress.Commands.add('getReveal', () => {
|
|
|
|
return cy.getIframeBody().find('.reveal')
|
|
|
|
})
|
|
|
|
|
2021-01-24 14:50:51 -05:00
|
|
|
Cypress.Commands.add('getMarkdownBody', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
return cy.getIframeBody().find('.markdown-body')
|
2021-01-24 14:50:51 -05:00
|
|
|
})
|