Skip to content

Commit

Permalink
fix(tests): Pass correct file ID to Cypress command
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>
  • Loading branch information
elzody committed Aug 6, 2024
1 parent 1170877 commit ab0283d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions cypress/e2e/templates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe.skip('Create new office files from templates', function() {

describe('Create templates with fields', () => {
let randUser
let templateId

before(() => {
cy.createRandomUser().then(user => {
Expand All @@ -121,14 +120,7 @@ describe('Create templates with fields', () => {
cy.get('button[data-cy-files-new-node-dialog-submit=""]').click()

// Upload the fixtures into the templates folder
cy.uploadFile(
randUser,
'templates/document_template_with_fields.odt',
'application/vnd.oasis.opendocument.text',
'/Templates/document.odt'
).then(fileId => {
templateId = fileId
})
cy.uploadFile(randUser, 'templates/document_template_with_fields.odt', 'application/vnd.oasis.opendocument.text', '/Templates/document.odt')
})
})

Expand Down Expand Up @@ -168,10 +160,17 @@ describe('Create templates with fields', () => {
req.continue()
}).as('reqFillFields')

// Submit the template fields
cy.get('@templateFillerButtons').find('button[aria-label="Submit button"]').click()
cy.wait('@reqFillFields')

// Wait for the response and collect the file ID of the created file
cy.wait('@reqFillFields').then(({ response }) => {
cy.wrap(response.body.ocs.data.fileid).as('createdFileId')
})

// Test if the fields currently match the values we passed to the template
cy.checkTemplateFields(['Nextcloud', 'richdocuments'], templateId)
cy.get('@createdFileId').then(createdFileId => {
cy.checkTemplateFields(['Nextcloud', 'richdocuments'], createdFileId)
})
})
})

0 comments on commit ab0283d

Please sign in to comment.