Skip to content

Commit ffba707

Browse files
committed
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 <max@nextcloud.com>
1 parent 0f961fc commit ffba707

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cypress/e2e/images.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ const clickOnImageAction = (actionName) => {
7979
*/
8080
const checkImage = (documentId, imageName, imageId, index) => {
8181
const encodedName = fixedEncodeURIComponent(imageName)
82+
const src = `.attachments.${documentId}/${encodedName}`
8283

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

0 commit comments

Comments
 (0)