diff --git a/e2e-tests/cypress/tests/integration/channels/archived_channel/archive_channel_operations_spec.ts b/e2e-tests/cypress/tests/integration/channels/archived_channel/archive_channel_operations_spec.ts index fa68c4d202..b950a7e3b8 100644 --- a/e2e-tests/cypress/tests/integration/channels/archived_channel/archive_channel_operations_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/archived_channel/archive_channel_operations_spec.ts @@ -56,7 +56,7 @@ describe('Leave an archived channel', () => { // * The archived channel appears in channel switcher search results cy.get('#suggestionList').should('be.visible'); - cy.get('#suggestionList').find(`#quickSwitchInput_${testChannel.id}`).should('be.visible'); + cy.get('#suggestionList').find(`#suggestionList_item_${testChannel.id}`).should('be.visible'); // # Reload the app (refresh the web page) cy.reload().then(() => { @@ -67,7 +67,7 @@ describe('Leave an archived channel', () => { cy.get('#quickSwitchInput').type(testChannel.display_name).then(() => { // * The archived channel appears in channel switcher search results cy.get('#suggestionList').should('be.visible'); - cy.get('#suggestionList').find(`#quickSwitchInput_${testChannel.id}`).should('be.visible'); + cy.get('#suggestionList').find(`#suggestionList_item_${testChannel.id}`).should('be.visible'); }); }); }); diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/accessibility/accessibility_input_fields_spec.ts b/e2e-tests/cypress/tests/integration/channels/enterprise/accessibility/accessibility_input_fields_spec.ts index 99649337fa..26c502fbdd 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/accessibility/accessibility_input_fields_spec.ts +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/accessibility/accessibility_input_fields_spec.ts @@ -86,10 +86,10 @@ describe('Verify Accessibility Support in different input fields', () => { cy.get('#searchHints').should('be.visible'); // # Ensure User list is cached once in UI - cy.uiGetSearchBox().type('from:').wait(TIMEOUTS.FIVE_SEC); + cy.uiGetSearchBox().type('from:').wait(TIMEOUTS.ONE_SEC); // # Trigger the user autocomplete again - cy.uiGetSearchBox().first().clear().type('from:').wait(TIMEOUTS.FIVE_SEC).type('{downarrow}{downarrow}'); + cy.uiGetSearchBox().first().clear().type('from:').wait(TIMEOUTS.ONE_SEC).type('{downarrow}{downarrow}'); // * Verify Accessibility Support in search autocomplete verifySearchAutocomplete(2); @@ -103,10 +103,10 @@ describe('Verify Accessibility Support in different input fields', () => { verifySearchAutocomplete(3); // # Type the in: filter and ensure channel list is cached once - cy.uiGetSearchBox().first().clear().type('in:').wait(TIMEOUTS.FIVE_SEC); + cy.uiGetSearchBox().first().clear().type('in:').wait(TIMEOUTS.ONE_SEC); // # Trigger the channel autocomplete again - cy.uiGetSearchBox().first().clear().type('in:').wait(TIMEOUTS.FIVE_SEC).type('{downarrow}{downarrow}'); + cy.uiGetSearchBox().first().clear().type('in:').wait(TIMEOUTS.ONE_SEC).type('{downarrow}{downarrow}'); // * Verify Accessibility Support in search autocomplete verifySearchAutocomplete(2, 'channel'); @@ -125,7 +125,7 @@ describe('Verify Accessibility Support in different input fields', () => { cy.uiGetPostTextBox().should('have.attr', 'placeholder', `Write to ${testChannel.display_name}`).clear().focus(); // # Ensure User list is cached once in UI - cy.uiGetPostTextBox().type('@').wait(TIMEOUTS.FIVE_SEC); + cy.uiGetPostTextBox().type('@').wait(TIMEOUTS.ONE_SEC); // # Select the first user in the list cy.get('#suggestionList').find('.suggestion-list__item').eq(0).within((el) => { @@ -135,7 +135,7 @@ describe('Verify Accessibility Support in different input fields', () => { }); // # Trigger the user autocomplete again - cy.uiGetPostTextBox().clear().type('@').wait(TIMEOUTS.FIVE_SEC).type('{uparrow}{uparrow}{downarrow}'); + cy.uiGetPostTextBox().clear().type('@').wait(TIMEOUTS.ONE_SEC).type('{uparrow}{uparrow}{downarrow}'); // * Verify Accessibility Support in message autocomplete verifyMessageAutocomplete(1); @@ -147,19 +147,19 @@ describe('Verify Accessibility Support in different input fields', () => { verifyMessageAutocomplete(0); // # Trigger the channel autocomplete filter and ensure channel list is cached once - cy.uiGetPostTextBox().clear().type('~').wait(TIMEOUTS.FIVE_SEC); + cy.uiGetPostTextBox().clear().type('~').wait(TIMEOUTS.ONE_SEC); // # Trigger the channel autocomplete again cy.uiGetPostTextBox().clear().type('~').wait(TIMEOUTS.FIVE_SEC).type('{downarrow}{downarrow}'); // * Verify Accessibility Support in message autocomplete - verifyMessageAutocomplete(2, 'channel'); + verifyMessageAutocomplete(2); // # Press Up arrow and verify if focus changes cy.focused().type('{downarrow}{uparrow}{uparrow}'); // * Verify Accessibility Support in message autocomplete - verifyMessageAutocomplete(1, 'channel'); + verifyMessageAutocomplete(1); }); }); }); @@ -307,20 +307,11 @@ function verifySearchAutocomplete(index, type = 'user') { }); } -function verifyMessageAutocomplete(index, type = 'user') { - cy.get('#suggestionList').find('.suggestion-list__item').eq(index).should('be.visible').and('have.class', 'suggestion--selected').within((el) => { - if (type === 'user') { - cy.get('.suggestion-list__ellipsis').invoke('text').then((fullText) => { - cy.get('.suggestion-list__main').invoke('text').then((username) => { - const usernameFullNameNickName = getUserMentionAriaLabel(`${username} ${fullText.split(username)[1]}`); - cy.wrap(el).parents('.textarea-wrapper').find('.sr-only').should('have.attr', 'aria-live', 'polite').and('have.text', usernameFullNameNickName); - }); - }); - } else if (type === 'channel') { - cy.wrap(el).invoke('text').then((text) => { - const channel = text.split('~')[0].toLowerCase().trim(); - cy.wrap(el).parents('.textarea-wrapper').find('.sr-only').should('have.attr', 'aria-live', 'polite').and('have.text', channel); - }); - } +function verifyMessageAutocomplete(index) { + cy.get('#suggestionList').find('.suggestion-list__item').eq(index).should('be.visible').and('have.class', 'suggestion--selected'); + cy.get('#suggestionList').find('.suggestion-list__item').eq(index).invoke('attr', 'id').then((selectedId) => { + cy.wrap(selectedId).should('not.equal', ''); + + cy.uiGetPostTextBox().should('have.attr', 'aria-activedescendant', selectedId); }); } diff --git a/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap b/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap index dfc6237122..090cacac25 100644 --- a/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap +++ b/webapp/channels/src/components/__snapshots__/textbox.test.tsx.snap @@ -110,7 +110,6 @@ exports[`components/TextBox should match snapshot with additional, optional prop "priorityProfiles": undefined, "requestStarted": false, "searchAssociatedGroupsForReference": [Function], - "textboxId": "someid", "triggerCharacter": "@", "useChannelMentions": true, }, @@ -258,7 +257,6 @@ exports[`components/TextBox should match snapshot with required props 1`] = ` "priorityProfiles": undefined, "requestStarted": false, "searchAssociatedGroupsForReference": [Function], - "textboxId": "someid", "triggerCharacter": "@", "useChannelMentions": true, }, @@ -406,7 +404,6 @@ exports[`components/TextBox should throw error when new property is too long 1`] "priorityProfiles": undefined, "requestStarted": false, "searchAssociatedGroupsForReference": [Function], - "textboxId": "someid", "triggerCharacter": "@", "useChannelMentions": true, }, @@ -554,7 +551,6 @@ exports[`components/TextBox should throw error when value is too long 1`] = ` "priorityProfiles": undefined, "requestStarted": false, "searchAssociatedGroupsForReference": [Function], - "textboxId": "someid", "triggerCharacter": "@", "useChannelMentions": true, }, diff --git a/webapp/channels/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap b/webapp/channels/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap index 6715a2b019..12d8bfdc2f 100644 --- a/webapp/channels/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap +++ b/webapp/channels/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap @@ -23,11 +23,6 @@ exports[`components/search_bar/SearchBar should match snapshot with search 1`] =