[MM-51302] Fix scroll to the bottom of editor after pasting long text (#22491)

Automatic Merge
Этот коммит содержится в:
Konstantinos Pittas
2023-04-05 19:04:28 +03:00
коммит произвёл GitHub
родитель 62e6f29638
Коммит 9c4455d103
3 изменённых файлов: 58 добавлений и 1 удалений

Просмотреть файл

@@ -10,6 +10,8 @@
// Stage: @prod
// Group: @channels @collapsed_reply_threads
import * as TIMEOUTS from '../../../fixtures/timeouts';
describe('Collapsed Reply Threads', () => {
let testTeam;
let testUser;
@@ -174,4 +176,45 @@ describe('Collapsed Reply Threads', () => {
cy.uiCloseRHS();
});
});
it('MM-T5413 should auto-scroll to bottom upon pasting long text in reply', () => {
// # Post a root post as current user
cy.postMessageAs({
sender: testUser,
message: 'Another interesting post,',
channelId: testChannel.id,
}).then(({id: rootId}) => {
// # Post multiple replies as other user so that the new messages line is pushed up
Cypress._.times(20, (i) => {
cy.postMessageAs({
sender: otherUser,
message: 'Reply ' + i,
channelId: testChannel.id,
rootId,
});
});
// # Click root post
cy.get(`#post_${rootId}`).click();
// # Wait for RHS to open and scroll to position
cy.wait(TIMEOUTS.ONE_SEC);
// * RHS should open and the editor's actions should not be visible.
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('not.be.visible');
// # Close RHS
cy.uiCloseRHS();
// # Click root post
cy.get(`#post_${rootId}`).click();
// # Paste a multiline string in the RHS textbox.
const text = 'word '.repeat(2000);
cy.get('#rhsContainer').findByTestId('reply_textbox').clear().invoke('val', text).trigger('input');
// * RHS should open and the editor should be visible and focused
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('be.visible');
});
});
});