Skip to content

Commit

Permalink
[MA-11]: Fix E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SaurabhSharma-884 committed Jan 2, 2025
1 parent 3f57af7 commit f268861
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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(`#switchChannel_${testChannel.id}`).should('be.visible');
cy.get('#suggestionList').find(`#quickSwitchInput_${testChannel.id}`).should('be.visible');

// # Reload the app (refresh the web page)
cy.reload().then(() => {
Expand All @@ -68,7 +68,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(`#switchChannel_${testChannel.id}`).should('be.visible');
cy.get('#suggestionList').find(`#quickSwitchInput_${testChannel.id}`).should('be.visible');
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Autocomplete with Database - Users', () => {

// # Open quick channel switcher
cy.typeCmdOrCtrl().type('k');
cy.findByRole('textbox', {name: 'quick switch input'}).should('be.visible');
cy.findByRole('combobox', {name: 'quick switch input'}).should('be.visible');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Channel Switcher', () => {
// # Start typing channel name in the "Switch Channels" modal message box
// # Use up/down arrow keys to highlight second channel
// # Press ENTER
cy.findByRole('textbox', {name: 'quick switch input'}).
cy.findByRole('combobox', {name: 'quick switch input'}).
type(`${channelDisplayNamePrefix} `).
type('{downarrow}{downarrow}{enter}');

Expand All @@ -60,7 +60,7 @@ describe('Channel Switcher', () => {
cy.typeCmdOrCtrl().type('K', {release: true});

// # Start typing channel name in the "Switch Channels" modal message box
cy.findByRole('textbox', {name: 'quick switch input'}).type(`${channelDisplayNamePrefix} `);
cy.findByRole('combobox', {name: 'quick switch input'}).type(`${channelDisplayNamePrefix} `);

cy.get(`[data-testid^=${channelNamePrefix}-c] > span`).click();

Expand All @@ -78,7 +78,7 @@ describe('Channel Switcher', () => {
cy.typeCmdOrCtrl().type('K', {release: true});

// # Type invalid channel name in the "Switch Channels" modal message box
cy.findByRole('textbox', {name: 'quick switch input'}).type('there-is-no-spoon');
cy.findByRole('combobox', {name: 'quick switch input'}).type('there-is-no-spoon');

// * Expect 'nothing found' message
cy.get('.no-results__title > span').should('be.visible');
Expand All @@ -91,10 +91,10 @@ describe('Channel Switcher', () => {
cy.typeCmdOrCtrl().type('K', {release: true});

// # Press ESC
cy.findByRole('textbox', {name: 'quick switch input'}).type('{esc}');
cy.findByRole('combobox', {name: 'quick switch input'}).type('{esc}');

// * Expect the dialog to be closed
cy.findByRole('textbox', {name: 'quick switch input'}).should('not.exist');
cy.findByRole('combobox', {name: 'quick switch input'}).should('not.exist');

// * Expect staying in the same channel
cy.url().should('contain', 'off-topic');
Expand All @@ -106,7 +106,7 @@ describe('Channel Switcher', () => {
cy.get('.modal').click({force: true});

// * Expect the dialog to be closed
cy.findByRole('textbox', {name: 'quick switch input'}).should('not.exist');
cy.findByRole('combobox', {name: 'quick switch input'}).should('not.exist');

// * Expect staying in the same channel
cy.url().should('contain', 'off-topic');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function searchForChannel(name: string) {
cy.typeCmdOrCtrl().type('k').wait(TIMEOUTS.ONE_SEC);

// # Clear out and type in the name
cy.findByRole('textbox', {name: 'quick switch input'}).
cy.findByRole('combobox', {name: 'quick switch input'}).
should('be.visible').
as('input').
clear().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Verify Guest User Identification in different screens', () => {
cy.uiOpenFindChannels();

// # Type the guest user name on Channel switcher input
cy.findByRole('textbox', {name: 'quick switch input'}).type(guestUser.username).wait(TIMEOUTS.HALF_SEC);
cy.findByRole('combobox', {name: 'quick switch input'}).type(guestUser.username).wait(TIMEOUTS.HALF_SEC);

// * Verify if Guest badge is displayed for the guest user in the Switch Channel Dialog
cy.get('#suggestionList').should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ context('ldap', () => {
cy.wait(TIMEOUTS.THREE_SEC);

// # Type channel display name on Channel switcher input
cy.findByRole('textbox', {name: 'quick switch input'}).type(publicChannel.display_name);
cy.findByRole('combobox', {name: 'quick switch input'}).type(publicChannel.display_name);
cy.wait(TIMEOUTS.HALF_SEC);

// * Should open up suggestion list for channels
Expand All @@ -433,7 +433,7 @@ context('ldap', () => {
cy.wait(TIMEOUTS.THREE_SEC);

// # Type channel display name on Channel switcher input
cy.findByRole('textbox', {name: 'quick switch input'}).type(publicChannel.display_name);
cy.findByRole('combobox', {name: 'quick switch input'}).type(publicChannel.display_name);
cy.wait(TIMEOUTS.HALF_SEC);

// * Should open up suggestion list for channels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Keyboard Shortcuts', () => {
cy.typeCmdOrCtrl().type('K', {release: true});

// # Start typing the name of other user
cy.findByRole('textbox', {name: 'quick switch input'}).type(this.otherUser.username);
cy.findByRole('combobox', {name: 'quick switch input'}).type(this.otherUser.username);

// # Select other user from the list
cy.findByTestId(this.otherUser.username).should('not.exist');
Expand Down Expand Up @@ -104,7 +104,7 @@ function verifyUserIsFoundAndDMOpensOnClick(user) {
cy.typeCmdOrCtrl().type('K', {release: true});

// # Start typing the name of other user
cy.findByRole('textbox', {name: 'quick switch input'}).type(user.username);
cy.findByRole('combobox', {name: 'quick switch input'}).type(user.username);

// # Select other user from the list
cy.findByTestId(user.username).should('be.visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Keyboard Shortcuts', () => {
cy.apiAddUserToTeam(testTeam.id, tempUser.id);

// # In the "Switch Channels" modal type the first chars of the test channel name
cy.findByRole('textbox', {name: 'quick switch input'}).should('be.focused').type(testChannel.name.substring(0, 3)).wait(TIMEOUTS.HALF_SEC);
cy.findByRole('combobox', {name: 'quick switch input'}).should('be.focused').type(testChannel.name.substring(0, 3)).wait(TIMEOUTS.HALF_SEC);

// # Verify that the list of users and channels suggestions is present
cy.get('#suggestionList').should('be.visible').within(() => {
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('Keyboard Shortcuts', () => {
cy.uiGetPostTextBox().cmdOrCtrlShortcut('K').then(() => {
// * Channel switcher hint should be visible and focused on
cy.get('#quickSwitchHint').should('be.visible');
cy.findByRole('textbox', {name: 'quick switch input'}).should('be.focused');
cy.findByRole('combobox', {name: 'quick switch input'}).should('be.focused');
});

// # Type CTRL/CMD+K to close 'Switch Channels' modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Messaging', () => {
cy.uiGetPostTextBox().cmdOrCtrlShortcut('K');

// # In the "Switch Channels" modal type the first 6 characters of the username
cy.findByRole('textbox', {name: 'quick switch input'}).should('be.focused').type(secondUser.username.substring(0, 6)).wait(TIMEOUTS.HALF_SEC);
cy.findByRole('combobox', {name: 'quick switch input'}).should('be.focused').type(secondUser.username.substring(0, 6)).wait(TIMEOUTS.HALF_SEC);

// # Verify that the list of users and channels suggestions is present
cy.get('#suggestionList').should('be.visible').within(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Messaging', () => {
cy.get('#quickSwitchHint').should('be.visible');

// # Type channel name and select it
cy.findByRole('textbox', {name: 'quick switch input'}).type(testChannelName).wait(TIMEOUTS.HALF_SEC).type('{enter}');
cy.findByRole('combobox', {name: 'quick switch input'}).type(testChannelName).wait(TIMEOUTS.HALF_SEC).type('{enter}');

// * Verify that it redirected into selected channel
cy.get('#channelHeaderTitle').should('be.visible').should('contain', testChannelName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Messaging - Opening a private channel using keyboard shortcuts', () =>
// # Type the first letter of a private channel in the "Switch Channels" modal message box
// # Use up/down arrow keys to highlight a private channel
// # Press ENTER
cy.findByRole('textbox', {name: 'quick switch input'}).type('Pr').type('{downarrow}').type('{enter}');
cy.findByRole('combobox', {name: 'quick switch input'}).type('Pr').type('{downarrow}').type('{enter}');

// * Private channel opens
cy.get('#channelHeaderTitle').should('be.visible').should('contain', 'Private').wait(TIMEOUTS.HALF_SEC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Settings > Sidebar > Channel Switcher', () => {
cy.get('#quickSwitchHint').should('be.visible').should('contain', 'Type to find a channel. Use UP/DOWN to browse, ENTER to select, ESC to dismiss.');

// # Type CTRL/CMD+shift+L
cy.findByRole('textbox', {name: 'quick switch input'}).cmdOrCtrlShortcut('{shift}L');
cy.findByRole('combobox', {name: 'quick switch input'}).cmdOrCtrlShortcut('{shift}L');

// * Suggestion list should not be visible
cy.get('#suggestionList').should('not.exist');
Expand All @@ -56,7 +56,7 @@ describe('Settings > Sidebar > Channel Switcher', () => {
cy.get('#quickSwitchHint').should('be.visible').should('contain', 'Type to find a channel. Use UP/DOWN to browse, ENTER to select, ESC to dismiss.');

// # Type CTRL/CMD+shift+m
cy.findByRole('textbox', {name: 'quick switch input'}).cmdOrCtrlShortcut('{shift}M');
cy.findByRole('combobox', {name: 'quick switch input'}).cmdOrCtrlShortcut('{shift}M');

// * Suggestion list should not be visible
cy.get('#suggestionList').should('not.exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ function verifyChannelSwitch(team, channel) {
cy.get('#quickSwitchHint').should('be.visible').should('contain', 'Type to find a channel. Use UP/DOWN to browse, ENTER to select, ESC to dismiss.');

// # Type channel display name on Channel switcher input
cy.findByRole('textbox', {name: 'quick switch input'}).type(channel.display_name);
cy.findByRole('combobox', {name: 'quick switch input'}).type(channel.display_name);
cy.wait(TIMEOUTS.HALF_SEC);

// * Suggestion list should be visible
cy.get('#suggestionList').should('be.visible');

// # Press enter
cy.findByRole('textbox', {name: 'quick switch input'}).type('{enter}');
cy.findByRole('combobox', {name: 'quick switch input'}).type('{enter}');

// * Verify that it redirected into "channel-switcher" as selected channel
cy.url().should('include', `/${team.name}/channels/${channel.name}`);
Expand Down

0 comments on commit f268861

Please sign in to comment.