Commit 4776c093 authored by Prapti's avatar Prapti Committed by Saturnino Abril
Browse files

Fix Cypress tests for admin-console search in User Management > Channel (#5998)

parent 4a33dd03
......@@ -34,7 +34,9 @@ describe('Search channels', () => {
it('loads with no search text', () => {
// * Check that text input loads empty.
cy.findByPlaceholderText('Search').should('be.visible').and('have.text', '');
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').should('be.visible').and('have.text', '');
});
});
it('returns results', () => {
......@@ -43,7 +45,9 @@ describe('Search channels', () => {
cy.apiCreateChannel(testTeamId, 'channel-search', displayName);
// # Search for the channel.
cy.findByPlaceholderText('Search').type(displayName + '{enter}');
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').type(displayName + '{enter}');
});
// * Check that channel is in search results.
cy.findAllByTestId('channel-display-name').contains(displayName);
......@@ -57,7 +61,9 @@ describe('Search channels', () => {
}
// # Search using the common channel name prefix.
cy.findByPlaceholderText('Search').type(displayName + '{enter}');
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').type(displayName + '{enter}');
});
// * Check that the first page of results is full.
cy.findAllByTestId('channel-display-name').should('have.length', PAGE_SIZE);
......@@ -77,7 +83,9 @@ describe('Search channels', () => {
cy.apiCreateChannel(testTeamId, 'channel-search', displayName);
// # Search for the channel.
cy.findByPlaceholderText('Search').as('searchInput').type(displayName + '{enter}');
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').as('searchInput').type(displayName + '{enter}');
});
// * Check that the list of channels is in search results mode.
cy.findAllByTestId('channel-display-name').should('have.length', 1);
......@@ -98,7 +106,9 @@ describe('Search channels', () => {
cy.apiCreateChannel(testTeamId, 'channel-search', displayName);
// # Search for the channel.
cy.findByPlaceholderText('Search').as('searchInput').type(displayName + '{enter}');
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').as('searchInput').type(displayName + '{enter}');
});
// * Check that the list of teams is in search results mode.
cy.findAllByTestId('channel-display-name').should('have.length', 1);
......
......@@ -10,7 +10,9 @@ import {checkBoxes} from './constants';
export const visitChannelConfigPage = (channel) => {
cy.apiAdminLogin();
cy.visit('/admin_console/user_management/channels');
cy.findByPlaceholderText('Search').type(`${channel.name}{enter}`);
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').type(`${channel.name}{enter}`);
});
cy.findByText('Edit').click();
cy.wait(TIMEOUTS.ONE_SEC);
};
......@@ -34,12 +36,16 @@ export const saveConfigForChannel = (channelName = false, clickConfirmationButto
cy.get('#confirmModalButton').click();
}
// # Make sure the save is complete by looking for the search input which is only visible on the teams index page
cy.findByPlaceholderText('Search').should('be.visible');
// # Make sure the save is complete by looking for the search input which is only visible on the team's index page
cy.get('.DataGrid_searchBar').should('be.visible').within(() => {
cy.findByPlaceholderText('Search').should('be.visible');
});
if (channelName) {
// # Search for the channel.
cy.findByPlaceholderText('Search').type(`${channelName}{enter}`);
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').type(`${channelName}{enter}`);
});
cy.findByText('Edit').click();
}
}
......
......@@ -49,7 +49,9 @@ describe('Channel Moderation', () => {
cy.visit('/admin_console/user_management/channels');
// # Search for the channel.
cy.findByPlaceholderText('Search').type(`${testChannel.name}{enter}`);
cy.get('.DataGrid_searchBar').within(() => {
cy.findByPlaceholderText('Search').type(`${testChannel.name}{enter}`);
});
cy.findByText('Edit').click();
// # Wait until the groups retrieved and show up
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment