Skip to content

Commit

Permalink
test: fix wrapper test
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Sep 30, 2023
1 parent f8e6326 commit 967a6fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
4 changes: 3 additions & 1 deletion examples/vue3/cypress/e2e/controls.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/// <reference types="cypress" />

describe('Controls', () => {
const getIframeBody = () => cy.get('iframe[data-test-id="preview-iframe"]').iframe()
const getIframeBody = () => cy.get('iframe[data-test-id="preview-iframe"]')
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap)

beforeEach(() => {
cy.visit('/')
Expand Down
4 changes: 3 additions & 1 deletion examples/vue3/cypress/e2e/wrapper.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/// <reference types="cypress" />

describe('Wrapper', () => {
const getIframeBody = () => cy.get('iframe[data-test-id="preview-iframe"]').iframe()
const getIframeBody = () => cy.get('iframe[data-test-id="preview-iframe"]')
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap)

it('should display the wrapper', () => {
cy.visit('/story/src-components-meow-story-vue?variantId=src-components-meow-story-vue-0')
Expand Down
13 changes: 0 additions & 13 deletions examples/vue3/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,3 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

Cypress.Commands.add('iframe', { prevSubject: 'element' }, $iframe => {
return new Cypress.Promise(resolve => {
const doc = $iframe.prop('contentDocument')
if (doc && doc.readyState === 'complete' && doc.body.innerText) {
resolve($iframe.contents().find('body'))
} else {
$iframe.on('load', () => {
resolve($iframe.contents().find('body'))
})
}
})
})

0 comments on commit 967a6fb

Please sign in to comment.