2020-08-05 16:18:28 +02:00
|
|
|
xcontext('Create Components', () => {
|
2020-06-11 12:56:16 +02:00
|
|
|
|
|
|
|
before(() => {
|
2020-08-05 16:18:28 +02:00
|
|
|
cy.server()
|
2020-06-11 12:56:16 +02:00
|
|
|
cy.visit('localhost:4001/_builder')
|
|
|
|
// https://on.cypress.io/type
|
2020-10-13 12:19:34 +02:00
|
|
|
cy.createApp('Table App', 'Table App Description')
|
2020-08-10 16:34:37 +02:00
|
|
|
cy.createTable('dog', 'name', 'age')
|
2020-10-09 20:10:28 +02:00
|
|
|
cy.addRow('bob', '15')
|
2020-06-11 12:56:16 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
// https://on.cypress.io/interacting-with-elements
|
|
|
|
it('should add a container', () => {
|
|
|
|
cy.contains('frontend').click()
|
|
|
|
cy.get('.switcher > :nth-child(2)').click()
|
|
|
|
|
|
|
|
cy.contains('Container').click()
|
|
|
|
})
|
|
|
|
it('should add a headline', () => {
|
|
|
|
cy.addHeadlineComponent('An Amazing headline!')
|
|
|
|
|
|
|
|
getIframeBody().contains('An Amazing headline!')
|
|
|
|
})
|
2020-06-22 12:29:34 +02:00
|
|
|
it('change the font size of the headline', () => {
|
|
|
|
cy.contains('Typography').click()
|
2020-08-05 16:18:28 +02:00
|
|
|
cy.get('[data-cy=font-size-prop-control]').click()
|
|
|
|
cy.contains("60px").click()
|
2020-06-11 12:56:16 +02:00
|
|
|
cy.contains('Design').click()
|
|
|
|
|
2020-06-22 12:29:34 +02:00
|
|
|
getIframeBody().contains('An Amazing headline!').should('have.css', 'font-size', '60px')
|
2020-06-11 12:56:16 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
const getIframeDocument = () => {
|
|
|
|
return cy
|
|
|
|
.get('iframe')
|
|
|
|
// Cypress yields jQuery element, which has the real
|
|
|
|
// DOM element under property "0".
|
|
|
|
// From the real DOM iframe element we can get
|
|
|
|
// the "document" element, it is stored in "contentDocument" property
|
|
|
|
// Cypress "its" command can access deep properties using dot notation
|
|
|
|
// https://on.cypress.io/its
|
|
|
|
.its('0.contentDocument').should('exist')
|
|
|
|
}
|
|
|
|
|
|
|
|
const getIframeBody = () => {
|
|
|
|
// get the document
|
|
|
|
return getIframeDocument()
|
|
|
|
// automatically retries until body is loaded
|
|
|
|
.its('body').should('not.be.undefined')
|
|
|
|
// wraps "body" DOM element to allow
|
|
|
|
// chaining more Cypress commands, like ".find(...)"
|
|
|
|
.then(cy.wrap)
|
|
|
|
}
|