Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
text: fix cypress selector to find the right image
`get().filter()` might not take into account elements
that did not exist in the dom yet when the `get` part was fired.

`.filter()` would then wait for the elements that already existed
during `.get()` to contain the newly created image.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and backportbot-nextcloud[bot] committed Jun 26, 2022
commit 7b889d83e35db1f39423d8fa6efbcf41841dd8c1
6 changes: 3 additions & 3 deletions cypress/integration/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ const clickOnImageAction = (actionIndex, callback) => {
*/
const checkImage = (documentId, imageName, imageId, index) => {
const encodedName = fixedEncodeURIComponent(imageName)
const src = `.attachments.${documentId}/${encodedName}`

cy.log('Check the image is visible and well formed', { documentId, imageName, imageId, index, encodedName })
cy.log('Check the image is visible and well formed', documentId, imageName, imageId, index, encodedName)
return new Cypress.Promise((resolve, reject) => {
cy.get('#editor [data-component="image-view"]')
.filter('[data-src=".attachments.' + documentId + '/' + encodedName + '"]')
cy.get(`#editor [data-component="image-view"][data-src="${src}"]`)
.find('.image__view') // wait for load finish
.within(($el) => {
// keep track that we have created this image in the attachment dir
Expand Down