2021-01-24 19:50:51 +00: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 10:50:39 +00:00
|
|
|
getIframeBody(): Chainable<Element>
|
|
|
|
getReveal(): Chainable<Element>
|
2021-02-03 21:13:04 +00:00
|
|
|
getMarkdownBody(): Chainable<Element>
|
2021-01-24 19:50:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 10:50:39 +00:00
|
|
|
Cypress.Commands.add('getIframeBody', () => {
|
2021-06-18 21:26:36 +00:00
|
|
|
return cy
|
2021-06-19 14:00:23 +00:00
|
|
|
.get(`iframe[data-cy="documentIframe"][data-content-ready="true"]`)
|
2021-06-18 21:26:36 +00:00
|
|
|
.should('be.visible')
|
|
|
|
.its('0.contentDocument')
|
|
|
|
.should('exist')
|
|
|
|
.its('body')
|
|
|
|
.should('not.be.undefined')
|
|
|
|
.then(cy.wrap.bind(cy))
|
2021-01-24 19:50:51 +00:00
|
|
|
})
|
|
|
|
|
2021-10-04 10:50:39 +00:00
|
|
|
Cypress.Commands.add('getReveal', () => {
|
|
|
|
return cy.getIframeBody().find('.reveal')
|
|
|
|
})
|
|
|
|
|
2021-01-24 19:50:51 +00:00
|
|
|
Cypress.Commands.add('getMarkdownBody', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
return cy.getIframeBody().find('.markdown-body')
|
2021-01-24 19:50:51 +00:00
|
|
|
})
|