[MM-61577]: Ensure all interactive functionality is operable with the keyboard in emoji picker (#29629)

Этот коммит содержится в:
Saurabh Sharma
2025-02-03 12:26:49 +05:30
коммит произвёл GitHub
родитель 316cde2569
Коммит e8e40c79f6
14 изменённых файлов: 64 добавлений и 36 удалений

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

@@ -128,11 +128,11 @@ describe('Custom emojis', () => {
cy.findByText('Custom').should('exist').and('is.visible');
// * Verify that first custom emoji exists and is visible to user
cy.findAllByAltText('custom emoji image').should('exist').eq(0).and('is.visible');
cy.findAllByAltText('custom emoji').should('exist').eq(0).and('is.visible');
// * Verify second custom emoji exists and is visible to user,
// if both custom emojis are visible we can conclude that they are not overlapping
cy.findAllByAltText('custom emoji image').should('exist').eq(1).and('is.visible');
cy.findAllByAltText('custom emoji').should('exist').eq(1).and('is.visible');
});
});
});

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

@@ -69,10 +69,10 @@ describe('Recent Emoji', () => {
cy.findByText(/Recently Used/i).should('exist').and('be.visible');
// * Assert first emoji should equal with second recent emoji
cy.findAllByTestId('emojiItem').eq(0).find('img').should('have.attr', 'aria-label', 'grin emoji');
cy.findAllByTestId('emojiItem').eq(0).should('have.attr', 'aria-label', 'grin emoji');
// * Assert second emoji should equal with first recent emoji
cy.findAllByTestId('emojiItem').eq(1).find('img').should('have.attr', 'aria-label', 'joy emoji');
cy.findAllByTestId('emojiItem').eq(1).should('have.attr', 'aria-label', 'joy emoji');
});
it('MM-T4463 Recently used custom emoji, when is deleted should be removed from recent emoji category and quick reactions', () => {
@@ -130,7 +130,7 @@ describe('Recent Emoji', () => {
cy.findAllByTestId('emojiItem').eq(0).find('img').should('have.attr', 'class', 'emoji-category--custom');
// * Verify second most recent one is the system emoji in emoji picker
cy.findAllByTestId('emojiItem').eq(1).find('img').should('have.attr', 'aria-label', 'lemon emoji');
cy.findAllByTestId('emojiItem').eq(1).should('have.attr', 'aria-label', 'lemon emoji');
// # Go to custom emoji page
cy.findByText('Custom Emoji').should('be.visible').click();
@@ -172,6 +172,6 @@ describe('Recent Emoji', () => {
cy.findByText('Recently Used').should('exist').and('be.visible');
// * Verify most recent one is the system emoji in emoji picker and not the custom emoji
cy.findAllByTestId('emojiItem').eq(0).find('img').should('have.attr', 'aria-label', 'lemon emoji');
cy.findAllByTestId('emojiItem').eq(0).should('have.attr', 'aria-label', 'lemon emoji');
});
});

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

@@ -56,7 +56,7 @@ describe('Recent Emoji', () => {
cy.findByText('Recently Used').should('exist').and('be.visible');
// * Verify most recent one is the thumbsup emoji with default skin
cy.findAllByTestId('emojiItem').eq(0).find('img').should('have.attr', 'aria-label', '+1 emoji');
cy.findAllByTestId('emojiItem').eq(0).should('have.attr', 'aria-label', '+1 emoji');
// # Open skin picker again to change the skin
cy.findByAltText('emoji skin tone picker').should('exist').parent().click().wait(TIMEOUTS.ONE_SEC);
@@ -65,7 +65,7 @@ describe('Recent Emoji', () => {
cy.findByTestId('skin-pick-1F3FF').should('exist').click();
// * Verify most recent one is the same thumbsup emoji but now with a dark skin tone
cy.findAllByTestId('emojiItem').eq(0).find('img').should('have.attr', 'aria-label', '+1 dark skin tone emoji');
cy.findAllByTestId('emojiItem').eq(0).should('have.attr', 'aria-label', '+1 dark skin tone emoji');
});
// # Close emoji picker

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

@@ -32,8 +32,13 @@ describe('Emoji sorting', () => {
// # Assert first recently used emoji has the data-test-id value of 'cat' which was the last one we sent
cy.findAllByTestId('emojiItem').
findByRole('button', {name: 'cat emoji'}).
should('exist');
each(($btn) => {
// Check if the button has the specific aria-label
if ($btn.attr('aria-label') === 'cat emoji') {
// If the aria-label matches, check if the button exists
cy.wrap($btn).should('exist');
}
});
const emojiList = [];

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

@@ -99,13 +99,13 @@ describe('MM-T154 Use keyboard navigation in emoji picker', () => {
cy.uiGetPostTextBox().type('{enter}');
// * Compare selected emoji with last post
cy.getLastPost().find('.emoticon').should('have.attr', 'alt', selectedEmoji);
cy.getLastPost().find('.emoticon').should('have.attr', 'aria-label', selectedEmoji);
});
});
});
const testSelectedIndex = (done) => {
cy.get('div.emoji-picker__item.selected').then((selectedEmoji) => {
cy.get('button.emoji-picker__item.selected').then((selectedEmoji) => {
done(selectedEmoji.index());
});
};