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

This commit is contained in:
yasserfaraazkhan 2024-07-17 05:03:40 +05:30 committed by GitHub
parent fb790a860b
commit d71e5e4f4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 20 additions and 19 deletions

View File

@ -40,15 +40,14 @@ function enableElasticSearch() {
// # Enable elastic search via the API
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true,
EnableSearching: true,
Sniff: false,
},
} as Cypress.AdminConfig);
// # Navigate to the elastic search setting page
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
cy.contains('button', 'Test Connection').click();

View File

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

View File

@ -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);
// # Get the root post
@ -183,7 +183,7 @@ describe('Collapsed Reply Threads', () => {
cy.reload(true);
// * 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
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');
// # 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
cy.get('#mark-all-threads-as-read-modal').should('not.exist');

View File

@ -140,7 +140,7 @@ describe('Collapsed Reply Threads', () => {
cy.uiGetPostThreadFooter(postForAvatar.id).find('.Avatars').find('button').first().click();
// * 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
cy.uiClickSidebarItem('threads');
@ -149,7 +149,7 @@ describe('Collapsed Reply Threads', () => {
cy.get('article.ThreadItem').find('.activity').find('.Avatars').find('button').first().click();
// * 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:', () => {
@ -200,8 +200,8 @@ describe('Collapsed Reply Threads', () => {
// # Wait for RHS to open and scroll to position
cy.wait(TIMEOUTS.ONE_SEC);
// * RHS should open and the editor's actions should not be visible.
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('not.be.visible');
// * RHS should open and the editor's actions should be visible.
cy.get('#rhsContainer').findByTestId('SendMessageButton').should('be.visible');
// # Close RHS
cy.uiCloseRHS();
@ -214,7 +214,7 @@ describe('Collapsed Reply Threads', () => {
cy.get('#rhsContainer').findByTestId('reply_textbox').clear().invoke('val', text).trigger('input');
// * 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');
});
});
});

View File

@ -73,7 +73,7 @@ describe('Collapsed Reply Threads', () => {
cy.wait(TIMEOUTS.ONE_SEC);
// * 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
cy.uiCloseRHS();

View File

@ -87,15 +87,14 @@ module.exports = {
// # Enable elastic search via the API
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true,
EnableSearching: true,
Sniff: false,
},
});
// # Navigate to the elastic search setting page
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
cy.contains('button', 'Test Connection').click();

View File

@ -22,15 +22,17 @@ describe('Elasticsearch system console', () => {
// # Enable Elasticsearch
cy.apiUpdateConfig({
ElasticsearchSettings: {
EnableAutocomplete: true,
EnableIndexing: true,
EnableSearching: true,
Sniff: false,
},
});
// # Visit the Elasticsearch settings page
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
cy.get('#testConfig').find('button').click();
@ -72,6 +74,7 @@ describe('Elasticsearch system console', () => {
errorMsg: 'Reindex did not succeed in time',
});
cy.get('[data-testid="jobTable"]').scrollIntoView();
cy.get('@firstRow').
find('.status-icon-success').
should('be.visible').

View File

@ -21,7 +21,7 @@ Cypress.Commands.add('uiClickCopyLink', (permalink, postId) => {
Cypress.Commands.add('uiClickPostDropdownMenu', (postId, menuItem, location = 'CENTER') => {
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});
});

View File

@ -137,7 +137,7 @@ Cypress.Commands.add('uiClickSidebarItem', (name) => {
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 {
cy.findAllByTestId('postView').should('be.visible');
}