MM-57354: Fix elastic search e2e tests (#27670)

Этот коммит содержится в:
yasserfaraazkhan
2024-07-17 05:03:40 +05:30
коммит произвёл GitHub
родитель fb790a860b
Коммит d71e5e4f4e
9 изменённых файлов: 20 добавлений и 19 удалений

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

@@ -40,15 +40,14 @@ function enableElasticSearch() {
// # Enable elastic search via the API // # Enable elastic search via the API
cy.apiUpdateConfig({ cy.apiUpdateConfig({
ElasticsearchSettings: { ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true, EnableIndexing: true,
EnableSearching: true, EnableSearching: true,
Sniff: false,
}, },
} as Cypress.AdminConfig); } as Cypress.AdminConfig);
// # Navigate to the elastic search setting page // # Navigate to the elastic search setting page
cy.visit('/admin_console/environment/elasticsearch'); cy.visit('/admin_console/environment/elasticsearch');
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
// * Test the connection and verify that we are successful // * Test the connection and verify that we are successful
cy.contains('button', 'Test Connection').click(); cy.contains('button', 'Test Connection').click();

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

@@ -44,7 +44,7 @@ describe('Collapsed Reply Threads', () => {
// # Visit global threads // # Visit global threads
cy.visit(`/${testTeam.name}/threads`); cy.visit(`/${testTeam.name}/threads`);
// * should see followed threads in H2 title // * should see No followed threads yet in H3 title
cy.get('h2').should('have.text', 'Followed threads'); cy.get('h3.no-results__title').should('have.text', 'No followed threads yet');
}); });
}); });

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

@@ -68,7 +68,7 @@ describe('Collapsed Reply Threads', () => {
}); });
}); });
it('MM-T4379 Display: Click to open threads)', () => { it('MM-T4379 Display: Click to open threads', () => {
cy.uiWaitUntilMessagePostedIncludes(rootPost.data.message); cy.uiWaitUntilMessagePostedIncludes(rootPost.data.message);
// # Get the root post // # Get the root post
@@ -183,7 +183,7 @@ describe('Collapsed Reply Threads', () => {
cy.reload(true); cy.reload(true);
// * There should be a single thread item with no reply // * There should be a single thread item with no reply
cy.get('article.ThreadItem').should('have.lengthOf', 1); cy.get('article.ThreadItem').should('have.lengthOf', 0);
// * The reply post should not exist anymore // * The reply post should not exist anymore
cy.get(`#rhsPost_${replyPost1.id}`).should('not.exist'); cy.get(`#rhsPost_${replyPost1.id}`).should('not.exist');
@@ -361,7 +361,7 @@ describe('Collapsed Reply Threads', () => {
cy.get('#mark-all-threads-as-read-modal').should('exist'); cy.get('#mark-all-threads-as-read-modal').should('exist');
// # Click cancel button // # Click cancel button
cy.get('button.cancel').contains('Cancel').click(); cy.get('.btn-tertiary').contains('Cancel').click();
// * Verify mark_all_threads_as_read_modal is closed // * Verify mark_all_threads_as_read_modal is closed
cy.get('#mark-all-threads-as-read-modal').should('not.exist'); cy.get('#mark-all-threads-as-read-modal').should('not.exist');

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

@@ -140,7 +140,7 @@ describe('Collapsed Reply Threads', () => {
cy.uiGetPostThreadFooter(postForAvatar.id).find('.Avatars').find('button').first().click(); cy.uiGetPostThreadFooter(postForAvatar.id).find('.Avatars').find('button').first().click();
// * Profile popover should be visible and close on ESC // * Profile popover should be visible and close on ESC
cy.get('div.user-profile-popover').first().should('be.visible').find('#messageButton').type('{esc}'); cy.get('div.user-profile-popover').first().should('be.visible').find('button.btn-primary.btn-sm').type('{esc}');
// # Visit global threads // # Visit global threads
cy.uiClickSidebarItem('threads'); cy.uiClickSidebarItem('threads');
@@ -149,7 +149,7 @@ describe('Collapsed Reply Threads', () => {
cy.get('article.ThreadItem').find('.activity').find('.Avatars').find('button').first().click(); cy.get('article.ThreadItem').find('.activity').find('.Avatars').find('button').first().click();
// * Profile popover should be visible and close on ESC // * Profile popover should be visible and close on ESC
cy.get('div.user-profile-popover').first().should('be.visible').find('#messageButton').type('{esc}'); cy.get('div.user-profile-popover').first().should('be.visible').find('button.btn-primary.btn-sm');
}); });
it('MM-T4143 Emoji reaction - type +:+1:', () => { it('MM-T4143 Emoji reaction - type +:+1:', () => {
@@ -200,8 +200,8 @@ describe('Collapsed Reply Threads', () => {
// # Wait for RHS to open and scroll to position // # Wait for RHS to open and scroll to position
cy.wait(TIMEOUTS.ONE_SEC); cy.wait(TIMEOUTS.ONE_SEC);
// * RHS should open and the editor's actions should not be visible. // * RHS should open and the editor's actions should be visible.
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('not.be.visible'); cy.get('#rhsContainer').findByTestId('SendMessageButton').should('be.visible');
// # Close RHS // # Close RHS
cy.uiCloseRHS(); cy.uiCloseRHS();
@@ -214,7 +214,7 @@ describe('Collapsed Reply Threads', () => {
cy.get('#rhsContainer').findByTestId('reply_textbox').clear().invoke('val', text).trigger('input'); cy.get('#rhsContainer').findByTestId('reply_textbox').clear().invoke('val', text).trigger('input');
// * RHS should open and the editor should be visible and focused // * RHS should open and the editor should be visible and focused
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('be.visible'); cy.get('#rhsContainer').findByTestId('SendMessageButton').scrollIntoView().should('be.visible');
}); });
}); });
}); });

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

@@ -73,7 +73,7 @@ describe('Collapsed Reply Threads', () => {
cy.wait(TIMEOUTS.ONE_SEC); cy.wait(TIMEOUTS.ONE_SEC);
// * RHS should open and new messages line should be visible // * RHS should open and new messages line should be visible
cy.get('#rhsContainer').findByTestId('NotificationSeparator').should('be.visible'); cy.get('#rhsContainer').findByTestId('NotificationSeparator').scrollIntoView().should('be.visible');
// # Close RHS // # Close RHS
cy.uiCloseRHS(); cy.uiCloseRHS();

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

@@ -87,15 +87,14 @@ module.exports = {
// # Enable elastic search via the API // # Enable elastic search via the API
cy.apiUpdateConfig({ cy.apiUpdateConfig({
ElasticsearchSettings: { ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true, EnableIndexing: true,
EnableSearching: true, EnableSearching: true,
Sniff: false,
}, },
}); });
// # Navigate to the elastic search setting page // # Navigate to the elastic search setting page
cy.visit('/admin_console/environment/elasticsearch'); cy.visit('/admin_console/environment/elasticsearch');
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
// * Test the connection and verify that we are successful // * Test the connection and verify that we are successful
cy.contains('button', 'Test Connection').click(); cy.contains('button', 'Test Connection').click();

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

@@ -22,15 +22,17 @@ describe('Elasticsearch system console', () => {
// # Enable Elasticsearch // # Enable Elasticsearch
cy.apiUpdateConfig({ cy.apiUpdateConfig({
ElasticsearchSettings: { ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true, EnableIndexing: true,
EnableSearching: true, EnableSearching: true,
Sniff: false,
}, },
}); });
// # Visit the Elasticsearch settings page // # Visit the Elasticsearch settings page
cy.visit('/admin_console/environment/elasticsearch'); cy.visit('/admin_console/environment/elasticsearch');
cy.get('[data-testid="enableIndexing"] > .col-sm-8 > :nth-child(2)').click();
// # Enable Auto complete
cy.get('#enableAutocompletetrue').check().should('be.checked');
// * Verify that we can connect to Elasticsearch // * Verify that we can connect to Elasticsearch
cy.get('#testConfig').find('button').click(); cy.get('#testConfig').find('button').click();
@@ -72,6 +74,7 @@ describe('Elasticsearch system console', () => {
errorMsg: 'Reindex did not succeed in time', errorMsg: 'Reindex did not succeed in time',
}); });
cy.get('[data-testid="jobTable"]').scrollIntoView();
cy.get('@firstRow'). cy.get('@firstRow').
find('.status-icon-success'). find('.status-icon-success').
should('be.visible'). should('be.visible').

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

@@ -21,7 +21,7 @@ Cypress.Commands.add('uiClickCopyLink', (permalink, postId) => {
Cypress.Commands.add('uiClickPostDropdownMenu', (postId, menuItem, location = 'CENTER') => { Cypress.Commands.add('uiClickPostDropdownMenu', (postId, menuItem, location = 'CENTER') => {
cy.clickPostDotMenu(postId, location); cy.clickPostDotMenu(postId, location);
cy.findAllByTestId(`post-menu-${postId}`).eq(0).should('be.visible'); cy.findAllByTestId(`unread_post_${postId}`).eq(0).should('be.visible');
cy.findByText(menuItem).scrollIntoView().should('be.visible').click({force: true}); cy.findByText(menuItem).scrollIntoView().should('be.visible').click({force: true});
}); });

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

@@ -137,7 +137,7 @@ Cypress.Commands.add('uiClickSidebarItem', (name) => {
cy.uiCloseModal('A new way to view and follow threads'); cy.uiCloseModal('A new way to view and follow threads');
} }
}); });
cy.findByRole('heading', {name: 'Followed threads'}); cy.get('#tutorial-threads-mobile-header span.Button_label').contains('Followed threads');
} else { } else {
cy.findAllByTestId('postView').should('be.visible'); cy.findAllByTestId('postView').should('be.visible');
} }