Skip to content

Commit

Permalink
fix: add missing cypress commands
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody committed Apr 30, 2024
1 parent f0c2c0f commit bd076a5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,28 @@ Cypress.Commands.add('waitForCollabora', (wrapped = false) => {
cy.get('@loleafletframe').find('#main-document-content').should('be.visible')
})

Cypress.Commands.add('waitForPostMessage', (messageId, values = undefined) => {
cy.get('@postMessage', { timeout: 20000 }).should(spy => {
const calls = spy.getCalls()
const findMatchingCall = calls.find(call => call.args[0].indexOf('"MessageId":"' + messageId + '"') !== -1)
if (!findMatchingCall) {
return expect(findMatchingCall).to.not.be.undefined
}
if (!values) {
const object = JSON.parse(findMatchingCall.args[0])
values.forEach(value => {
expect(object.Values).to.have.property(value, values[value])
})
}
})
})

Cypress.Commands.add('inputCollaboraGuestName', (guestName = 'cloud') => {
cy.get('[data-cy="guestNameModal"]').should('be.visible')
cy.get('[data-cy="guestNameInput"]').type(guestName)
cy.get('[data-cy="guestNameSubmit"]').click()
})

Cypress.Commands.add('uploadSystemTemplate', () => {
cy.login(new User('admin', 'admin'))
cy.visit('/settings/admin/richdocuments')
Expand Down

0 comments on commit bd076a5

Please sign in to comment.