wisemapping-frontend/packages/mindplot/cypress/support/commands.js
Matias Arriola 5c2a96682d Merged in bugfix/topic-background (pull request #14)
Fix topic background

* Fix Textpeer getNativePosition implementation (broken with jQuery removal)

* Remove time-bound waits from cypress tests


Approved-by: Paulo Veiga
2021-12-21 18:05:03 +00:00

22 lines
663 B
JavaScript

import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
// make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set
// otherwise it calls a noop
if (Cypress.env('imageSnaphots')) {
addMatchImageSnapshotCommand();
} else {
Cypress.Commands.add(
'matchImageSnapshot',
{
prevSubject: ['optional', 'element', 'window', 'document'],
},
() => Promise.resolve(),
);
}
// https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/
Cypress.Commands.add('getIframeBody', () => cy
.get('iframe')
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap));