From d740e01d5d68a3c0f49e3e58c9748b9ad7c9b885 Mon Sep 17 00:00:00 2001 From: Rohit <40559587+Rohit3523@users.noreply.github.com> Date: Wed, 23 Sep 2026 19:57:36 +0530 Subject: [PATCH 1/3] test: add attachment-send e2e flow for image library upload Covers the inline composer send path (server >= 8.4.0): pick an image via the ImagePicker mock, send it, and verify the image message server-side through channels.history instead of the rendered list. Claude-Session: https://claude.ai/code/session_016PggYDENG3fKroiAw2zWMZ --- .maestro/scripts/data-setup.js | 79 ++++++++++++++++++++++++ .maestro/tests/room/attachment-send.yaml | 55 +++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 .maestro/tests/room/attachment-send.yaml diff --git a/.maestro/scripts/data-setup.js b/.maestro/scripts/data-setup.js index 3f42e48f9db..6849440c3b4 100644 --- a/.maestro/scripts/data-setup.js +++ b/.maestro/scripts/data-setup.js @@ -266,6 +266,82 @@ const postWithRetry = (url, options) => retryRequest(() => http.post(url, option const getWithRetry = (url, options) => retryRequest(() => http.get(url, options)); +const getServerVersion = () => { + const result = getWithRetry(`${data.server}/api/info`, { + headers: { + 'Content-Type': 'application/json' + } + }); + + return json(result.body)?.version; +}; + +const normalizeVersion = version => + String(version || '') + .split('.') + .map(part => parseInt(part, 10) || 0); + +const isServerAtLeast = required => { + const current = normalizeVersion(getServerVersion()); + const wanted = normalizeVersion(required); + const length = Math.max(current.length, wanted.length); + + for (let i = 0; i < length; i++) { + const c = current[i] || 0; + const r = wanted[i] || 0; + if (c > r) { + return true; + } + if (c < r) { + return false; + } + } + + return true; +}; + +const isImageMessage = message => + Boolean( + message && + ((Array.isArray(message.files) && message.files.some(file => String(file?.type || '').startsWith('image/'))) || + (Array.isArray(message.attachments) && message.attachments.some(attachment => attachment?.image_url))) + ); + +const getRoomHistory = roomId => { + const result = getWithRetry(`${data.server}/api/v1/channels.history?roomId=${roomId}&count=20`, { + headers: { + 'Content-Type': 'application/json', + ...headers + } + }); + + return json(result.body)?.messages || []; +}; + +const waitFor = (predicate, { timeoutMs = 60000, intervalMs = 2000, label = 'condition' } = {}) => { + const deadline = Date.now() + timeoutMs; + + while (Date.now() < deadline) { + const result = predicate(); + if (result) { + return result; + } + sleep(intervalMs); + } + + console.log(JSON.stringify({ waitForTimeout: true, label })); + return null; +}; + +const waitForImageMessage = (roomId, username, password, timeoutMs = 60000) => { + login(username, password); + + return waitFor( + () => getRoomHistory(roomId).find(message => message?.u?.username === username && isImageMessage(message)) || null, + { timeoutMs, label: `image message in ${roomId}` } + ); +}; + output.utils = { createUser, createUserWithPasswordChange, @@ -275,6 +351,9 @@ output.utils = { createRandomRoom, sendMessage, getProfileInfo, + getServerVersion, + isServerAtLeast, + waitForImageMessage, post, reactAsNewUsers, login, diff --git a/.maestro/tests/room/attachment-send.yaml b/.maestro/tests/room/attachment-send.yaml new file mode 100644 index 00000000000..0914ebad84d --- /dev/null +++ b/.maestro/tests/room/attachment-send.yaml @@ -0,0 +1,55 @@ +appId: ${APP_ID} +name: Attachment Send +onFlowStart: + - runFlow: '../../helpers/setup.yaml' +onFlowComplete: + - evalScript: ${output.utils.deleteCreatedUsers()} +tags: + - test-9 + +--- +- assertTrue: ${output.utils.isServerAtLeast('8.4.0')} +- evalScript: ${output.user = output.utils.createUser()} +- evalScript: ${output.room = output.utils.createRandomRoom(output.user.username, output.user.password)} +- evalScript: ${output.loggedInUser = output.utils.login(output.user.username, output.user.password)} + +- runFlow: + file: '../../helpers/login-with-deeplink.yaml' + env: + USERNAME: ${output.user.username} + PASSWORD: ${output.user.password} +- runFlow: + file: '../../helpers/navigate-to-room.yaml' + env: + ROOM: ${output.room.name} + +- extendedWaitUntil: + visible: + id: 'message-composer-actions' + timeout: 60000 +- tapOn: + id: 'message-composer-actions' +- extendedWaitUntil: + visible: + id: 'action-sheet' + timeout: 60000 +- extendedWaitUntil: + visible: + text: 'Choose from library' + timeout: 60000 +- tapOn: + text: 'Choose from library' +- extendedWaitUntil: + visible: + id: 'message-composer-attachment-0' + timeout: 60000 + +- extendedWaitUntil: + visible: + id: 'message-composer-send' + timeout: 60000 +- tapOn: + id: 'message-composer-send' + +- evalScript: ${output.imageMessage = output.utils.waitForImageMessage(output.room._id, output.user.username, output.user.password)} +- assertTrue: ${output.imageMessage !== null} From 9009682ed59eddc534370f8c81494a21a8ea6246 Mon Sep 17 00:00:00 2001 From: Rohit <40559587+Rohit3523@users.noreply.github.com> Date: Wed, 23 Sep 2026 20:11:27 +0530 Subject: [PATCH 2/3] test: map attachment-send flow in sniffler test-map Claude-Session: https://claude.ai/code/session_016PggYDENG3fKroiAw2zWMZ --- .sniffler/test-map.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.sniffler/test-map.json b/.sniffler/test-map.json index 7c9e3c8bd7c..df0d8edbf8d 100644 --- a/.sniffler/test-map.json +++ b/.sniffler/test-map.json @@ -329,6 +329,16 @@ "app/sagas/room.js" ] }, + { + "test": ".maestro/tests/room/attachment-send.yaml", + "dependsOn": [ + "app/views/RoomView/**", + "app/containers/MessageComposer/**", + "app/lib/methods/helpers/ImagePicker/**", + "app/lib/methods/sendFileMessage/**", + "app/lib/hooks/useAltTextSupported.ts" + ] + }, { "test": ".maestro/tests/room/reaction-picker-small-screen.yaml", "dependsOn": ["app/containers/EmojiPicker/**", "app/containers/ReactionsList/**"] From e66faa962566b6b4e446508fa976b2bd472ba44e Mon Sep 17 00:00:00 2001 From: Rohit <40559587+Rohit3523@users.noreply.github.com> Date: Mon, 5 Oct 2026 02:33:53 +0530 Subject: [PATCH 3/3] test: address review feedback on attachment-send e2e helpers Treat prerelease server versions as below the stable release and keep polling channels.history after transient request failures. --- .maestro/scripts/data-setup.js | 36 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.maestro/scripts/data-setup.js b/.maestro/scripts/data-setup.js index 382345367f2..e05e8562a04 100644 --- a/.maestro/scripts/data-setup.js +++ b/.maestro/scripts/data-setup.js @@ -290,19 +290,22 @@ const getServerVersion = () => { return json(result.body)?.version; }; -const normalizeVersion = version => - String(version || '') - .split('.') - .map(part => parseInt(part, 10) || 0); +const parseVersion = version => { + const [core, ...prerelease] = String(version || '').split('-'); + return { + numbers: core.split('.').map(part => parseInt(part, 10) || 0), + isPrerelease: prerelease.length > 0 + }; +}; const isServerAtLeast = required => { - const current = normalizeVersion(getServerVersion()); - const wanted = normalizeVersion(required); - const length = Math.max(current.length, wanted.length); + const current = parseVersion(getServerVersion()); + const wanted = parseVersion(required); + const length = Math.max(current.numbers.length, wanted.numbers.length); for (let i = 0; i < length; i++) { - const c = current[i] || 0; - const r = wanted[i] || 0; + const c = current.numbers[i] || 0; + const r = wanted.numbers[i] || 0; if (c > r) { return true; } @@ -311,7 +314,8 @@ const isServerAtLeast = required => { } } - return true; + // Same core version: a prerelease (8.4.0-rc.1) precedes the stable release (8.4.0) + return !current.isPrerelease || wanted.isPrerelease; }; const isImageMessage = message => @@ -351,7 +355,17 @@ const waitForImageMessage = (roomId, username, password, timeoutMs = 60000) => { login(username, password); return waitFor( - () => getRoomHistory(roomId).find(message => message?.u?.username === username && isImageMessage(message)) || null, + () => { + try { + return getRoomHistory(roomId).find(message => message?.u?.username === username && isImageMessage(message)) || null; + } catch (err) { + if (String(err?.message).startsWith('Non-retryable error')) { + throw err; + } + console.log(`channels.history failed, polling again: ${err?.message}`); + return null; + } + }, { timeoutMs, label: `image message in ${roomId}` } ); };