mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-27 05:11:32 +00:00
1fef30bebc
Some tests fail because the iframe hasn't loaded the inner hedgedoc renderer yet but cypress tries to travel through the dom and verify the render results. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
28 lines
678 B
TypeScript
28 lines
678 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
declare namespace Cypress {
|
|
interface Chainable {
|
|
getMarkdownRenderer(): Chainable<Element>
|
|
|
|
getMarkdownBody(): Chainable<Element>
|
|
}
|
|
}
|
|
|
|
Cypress.Commands.add('getMarkdownRenderer', () => {
|
|
return cy
|
|
.get(`iframe[data-cy="documentIframe"][data-content-ready="true"]`)
|
|
.should('be.visible')
|
|
.its('0.contentDocument')
|
|
.should('exist')
|
|
.its('body')
|
|
.should('not.be.undefined')
|
|
.then(cy.wrap.bind(cy))
|
|
})
|
|
|
|
Cypress.Commands.add('getMarkdownBody', () => {
|
|
return cy.getMarkdownRenderer().find('.markdown-body')
|
|
})
|