MM-46494: Add filter options to browse channel modal (#24099)

Этот коммит содержится в:
Sinan Sonmez (Chaush)
2023-08-31 06:07:41 +03:00
коммит произвёл GitHub
родитель c9d49536f8
Коммит 53fc44e13a
20 изменённых файлов: 719 добавлений и 286 удалений

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

@@ -16,6 +16,7 @@ describe('Leave an archived channel', () => {
let testTeam;
let offTopicUrl;
const channelType = {
all: 'Channel Type: All',
public: 'Channel Type: Public',
archived: 'Channel Type: Archived',
};
@@ -98,19 +99,18 @@ describe('Leave an archived channel', () => {
cy.get('#showMoreChannels').click();
// # More channels modal opens
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// # Click on dropdown
cy.findByText(channelType.public).should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible');
// # Click archived channels
cy.findByText('Archived Channels').click();
// # Click on dropdown
cy.findByText(channelType.all).should('be.visible').click();
// # Modal should contain created channel
cy.get('#moreChannelsList').should('contain', channel.display_name);
});
// # Click archived channels
cy.findByText('Archived channels').click();
cy.get('body').typeWithForce('{esc}');
// # Modal should contain created channel
cy.get('#moreChannelsList').should('contain', channel.display_name);
});
cy.get('body').typeWithForce('{esc}');
});
it('MM-T1699 - Browse Channels for all channel types shows archived channels option', () => {
@@ -146,12 +146,12 @@ describe('Leave an archived channel', () => {
cy.get('#showMoreChannels').click();
// # More channels modal opens
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// # Public channel list opens by default
cy.findByText(channelType.public).should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible').then(() => {
// # All channel list opens by default
cy.findByText(channelType.all).should('be.visible').click();
// # Click on archived channels
cy.findByText('Archived Channels').click();
cy.findByText('Archived channels').click();
// # Channel list should contain newly created channels
cy.get('#moreChannelsList').should('contain', archivedPrivateChannel.name);
@@ -199,12 +199,12 @@ describe('Leave an archived channel', () => {
cy.get('#showMoreChannels').click();
// # More channels modal opens
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// # Public channels are shown by default
cy.findByText(channelType.public).should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible').then(() => {
// # All channels are shown by default
cy.findByText(channelType.all).should('be.visible').click();
// # Go to archived channels
cy.findByText('Archived Channels').click();
cy.findByText('Archived channels').click();
// # Channel list should contain both archived public channels
cy.get('#moreChannelsList').should('contain', archivedPublicChannel1.display_name);
@@ -253,12 +253,12 @@ describe('Leave an archived channel', () => {
cy.get('#showMoreChannels').click();
// # More channels modal opens
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// # Show public channels is visible by default
cy.findByText(channelType.public).should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible').then(() => {
// # Show all channels is visible by default
cy.findByText(channelType.all).should('be.visible').click();
// # Go to archived channels
cy.findByText('Archived Channels').click();
cy.findByText('Archived channels').click();
// # Channel list should contain only the private channel user is a member of
cy.get('#moreChannelsList').should('contain', archivedPrivateChannel1.name);
@@ -287,12 +287,12 @@ describe('Leave an archived channel', () => {
// # Click on browse channels
cy.get('#showMoreChannels').click();
// # More channels modal opens and lands on public channels
cy.get('#browseChannelsModal').should('be.visible').within(() => {
cy.findByText(channelType.public).should('be.visible').click();
// # More channels modal opens and lands on all channels
cy.get('#browseChannelsModal').should('be.visible').then(() => {
cy.findByText(channelType.all).should('be.visible').click();
// # Go to archived channels
cy.findByText('Archived Channels').click();
cy.findByText('Archived channels').click();
// # More channels list should contain the archived channel
cy.get('#moreChannelsList').should('contain', archivedChannel.display_name);
@@ -323,7 +323,8 @@ describe('Leave an archived channel', () => {
cy.get('#showMoreChannels').click();
// # Modal should not contain the created channel
cy.get('#channelsMoreDropdown').should('not.exist');
cy.findByText(channelType.all).should('be.visible').click();
cy.findByText('Archived channels').should('not.exist');
cy.get('#moreChannelsList').should('not.contain', channel.name);
});
cy.get('body').typeWithForce('{esc}');

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

@@ -15,6 +15,7 @@ import * as TIMEOUTS from '../../../fixtures/timeouts';
import {createPrivateChannel} from '../enterprise/elasticsearch_autocomplete/helpers';
const channelType = {
all: 'Channel Type: All',
public: 'Channel Type: Public',
archived: 'Channel Type: Archived',
};
@@ -69,8 +70,8 @@ describe('Channels', () => {
cy.uiBrowseOrCreateChannel('Browse channels').click();
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// * Dropdown should be visible, defaulting to "Public Channels"
cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).wait(TIMEOUTS.HALF_SEC);
// * Dropdown should be visible, defaulting to "All Channels"
cy.get('#menuWrapper').should('be.visible').and('contain', channelType.all).wait(TIMEOUTS.HALF_SEC);
cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC);
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 1).within(() => {
@@ -111,27 +112,27 @@ describe('Channels', () => {
// # Go to LHS and click 'Browse channels'
cy.uiBrowseOrCreateChannel('Browse channels').click();
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// # CLick dropdown to open selection
cy.get('#channelsMoreDropdown').should('be.visible').click().within((el) => {
// # Click on archived channels item
cy.findByText('Archived Channels').should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible');
// * Channel test should be visible as an archived channel in the list
cy.wrap(el).should('contain', channelType.archived);
});
// # CLick dropdown to open selection
cy.get('#menuWrapper').should('be.visible').click();
cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC);
cy.get('#moreChannelsList').children().should('have.length', 1).within(() => {
cy.findByText(testChannel.display_name).should('be.visible');
});
cy.get('#searchChannelsTextbox').clear();
// # Click on archived channels item
cy.findByText('Archived channels').should('be.visible').click();
// * Test channel should be visible as a archived channel in the list
cy.get('#moreChannelsList').should('be.visible').within(() => {
// # Click to view archived channel
cy.findByText(testChannel.display_name).scrollIntoView().should('be.visible').click();
});
// * Menu text should be updated to reflect the selection
cy.get('#menuWrapper').should('contain', channelType.archived);
cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC);
cy.get('#moreChannelsList').children().should('have.length', 1).within(() => {
cy.findByText(testChannel.display_name).should('be.visible');
});
cy.get('#searchChannelsTextbox').clear();
// * Test channel should be visible as a archived channel in the list
cy.get('#moreChannelsList').should('be.visible').within(() => {
// # Click to view archived channel
cy.findByText(testChannel.display_name).scrollIntoView().should('be.visible').click();
});
// * Assert that channel is archived and new messages can't be posted.
@@ -177,7 +178,7 @@ describe('Channels', () => {
});
});
it('MM-T1702 Search works when changing public/archived options in the dropdown', () => {
it('MM-T1702 Search works when changing public/all options in the dropdown', () => {
cy.apiAdminLogin();
cy.apiUpdateConfig({
TeamSettings: {
@@ -231,32 +232,34 @@ describe('Channels', () => {
// # Go to LHS and click 'Browse channels'
cy.uiBrowseOrCreateChannel('Browse channels').click();
// * Dropdown should be visible, defaulting to "Public Channels"
cy.get('#channelsMoreDropdown').should('be.visible').within((el) => {
cy.wrap(el).should('contain', channelType.public);
// * Dropdown should be visible, defaulting to "All channels"
cy.get('#menuWrapper').should('be.visible').within((el) => {
cy.wrap(el).should('contain', channelType.all);
});
// * Users should be able to type and search
cy.get('#searchChannelsTextbox').should('be.visible').type('iv').wait(TIMEOUTS.HALF_SEC);
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 1).within(() => {
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2);
cy.get('#moreChannelsList').should('be.visible').within(() => {
cy.findByText(newChannel.display_name).should('be.visible');
});
cy.get('#browseChannelsModal').should('be.visible').within(() => {
// * Users should be able to switch to "Archived Channels" list
cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).click().within((el) => {
// # Click on archived channels item
cy.findByText('Archived Channels').should('be.visible').click();
cy.get('#browseChannelsModal').should('be.visible');
// * Modal should show the archived channels list
cy.wrap(el).should('contain', channelType.archived);
}).wait(TIMEOUTS.HALF_SEC);
cy.get('#searchChannelsTextbox').clear();
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2);
cy.get('#moreChannelsList').within(() => {
cy.findByText(testArchivedChannel.display_name).should('be.visible');
cy.findByText(testPrivateArchivedChannel.display_name).should('be.visible');
});
// * Users should be able to switch to "Archived Channels" list
cy.get('#menuWrapper').should('be.visible').and('contain', channelType.all).click().wait(TIMEOUTS.HALF_SEC);
// # Click on archived channels item
cy.findByText('Archived channels').should('be.visible').click();
// * Modal menu should be updated accordingly
cy.get('#menuWrapper').should('contain', channelType.archived);
cy.get('#searchChannelsTextbox').clear();
cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2);
cy.get('#moreChannelsList').within(() => {
cy.findByText(testArchivedChannel.display_name).should('be.visible');
cy.findByText(testPrivateArchivedChannel.display_name).should('be.visible');
});
});
});
@@ -287,9 +290,10 @@ function verifyBrowseChannelsModal(isEnabled) {
// * Verify that the browse channels modal is open and with or without option to view archived channels
cy.get('#browseChannelsModal').should('be.visible').within(() => {
if (isEnabled) {
cy.get('#channelsMoreDropdown').should('be.visible').and('have.text', channelType.public);
cy.get('#menuWrapper').should('be.visible').and('have.text', channelType.all);
} else {
cy.get('#channelsMoreDropdown').should('not.exist');
cy.get('#menuWrapper').click();
cy.findByText('Archived channels').should('not.exist');
}
});
}

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

@@ -14,7 +14,7 @@ function verifyNoChannelToJoinMessage(isVisible) {
cy.findByText('No public channels').should(isVisible ? 'be.visible' : 'not.exist');
}
describe('more public channels', () => {
describe('browse public channels', () => {
let testUser;
let otherUser;
let testTeam;
@@ -41,7 +41,7 @@ describe('more public channels', () => {
});
});
it('MM-T1664 Channels do not disappear from More Channels modal', () => {
it('MM-T1664 Channels do not disappear from Browse Channels modal', () => {
// # Login as other user
cy.apiLogin(otherUser);
@@ -51,8 +51,14 @@ describe('more public channels', () => {
// # Go to LHS and click 'Browse channels'
cy.uiBrowseOrCreateChannel('Browse channels').click();
// * Assert that the moreChannelsModel is visible
cy.findByRole('dialog', {name: 'Browse Channels'}).should('be.visible').within(() => {
// * Assert that the browse channel modal is visible
cy.findByRole('dialog', {name: 'Browse Channels'}).should('be.visible').then(() => {
// # Click on dropdown
cy.findByText('Channel Type: All').should('be.visible').click();
// # Click archived channels
cy.findByText('Public channels').should('be.visible').click();
// # Click hide joined checkbox if not already checked
cy.findByText('Hide Joined').should('be.visible').then(($checkbox) => {
if (!$checkbox.prop('checked')) {
@@ -92,7 +98,13 @@ describe('more public channels', () => {
cy.uiBrowseOrCreateChannel('Browse channels').click();
// * Assert the moreChannelsModel is visible
cy.findByRole('dialog', {name: 'Browse Channels'}).should('be.visible').within(() => {
cy.findByRole('dialog', {name: 'Browse Channels'}).should('be.visible').then(() => {
// # Click on dropdown
cy.findByText('Channel Type: All').should('be.visible').click();
// # Click archived channels
cy.findByText('Public channels').should('be.visible').click();
// * Assert that the "No more channels to join" message is visible
verifyNoChannelToJoinMessage(true);
});

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

@@ -86,7 +86,7 @@ describe('Verify Accessibility Support in Modals & Dialogs', () => {
});
});
it('MM-T1467 Accessibility Support in More Channels Dialog screen', () => {
it('MM-T1467 Accessibility Support in Browse Channels Dialog screen', () => {
function getChannelAriaLabel(channel) {
return channel.display_name.toLowerCase() + ', ' + channel.purpose.toLowerCase();
}
@@ -117,8 +117,8 @@ describe('Verify Accessibility Support in Modals & Dialogs', () => {
// # Hide already joined channels
cy.findByText('Hide Joined').click();
// # Focus on the Create Channel button and TAB three time
cy.get('#createNewChannelButton').focus().tab().tab().tab();
// # Focus on the Create Channel button and TAB four time
cy.get('#createNewChannelButton').focus().tab().tab().tab().tab();
// * Verify channel name is highlighted and reader reads the channel name and channel description
cy.get('#moreChannelsList').within(() => {

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

@@ -232,9 +232,9 @@ context('ldap', () => {
cy.visit(`/${testTeam.name}`);
cy.uiBrowseOrCreateChannel('Browse channels').click();
// * Search private channel name and make sure it isn't there in public channel directory
// * Search private channel name and make sure it is still visible
cy.get('#searchChannelsTextbox').type(testChannel.display_name);
cy.get('#moreChannelsList').should('include.text', 'No results for');
cy.get('#moreChannelsList').should('include.text', testChannel.display_name);
});
it('MM-T2629 - Private to public - More....', () => {