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 committed Jun 20, 2022
commit ffba7078009733585c208b5d2549c3c20ca1e00a
6 changes: 3 additions & 3 deletions cypress/e2e/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ const clickOnImageAction = (actionName) => {
*/
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