MM-61306: Cypress/E2E, fixed failed tests (#28959)

Этот коммит содержится в:
yasserfaraazkhan
2024-11-01 13:25:08 +05:30
коммит произвёл GitHub
родитель 857fd87a47
Коммит 77862dd581
36 изменённых файлов: 107 добавлений и 107 удалений

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

@@ -24,14 +24,16 @@ describe('Search', () => {
it('QuickInput clear X', () => {
// * X should not be visible on empty input
cy.uiGetSearchContainer().find('.input-clear-x').should('not.exist');
cy.uiGetSearchContainer().click();
// # Write something on the input
cy.uiGetSearchBox().find('input').clear().type('abc');
cy.uiGetSearchBox().first().clear().wait(TIMEOUTS.HALF_SEC).type('abc').wait(TIMEOUTS.HALF_SEC).type('{enter}');
cy.uiGetSearchContainer().click();
// * The input should contain what we wrote
cy.uiGetSearchBox().find('input').should('have.value', 'abc');
cy.uiGetSearchBox().should('have.value', 'abc');
cy.get('#searchBox .icon-close').click();
// * The X should be visible
// # Then click X to clear the input field
@@ -44,6 +46,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().find('.input-clear-x').should('not.exist');
// * The value of the input is empty
cy.uiGetSearchContainer().click();
cy.uiGetSearchBox().should('have.value', '');
});
@@ -52,13 +55,8 @@ describe('Search', () => {
// * Verify search input field exists and not search button, as inputs contains placeholder not buttons/icons
// and then type in a search text
cy.uiGetSearchBox().click().wait(TIMEOUTS.HALF_SEC).type(searchText + '{enter}');
// # Click on the pinned post button from the header
cy.uiGetChannelPinButton().click();
// * Verify the pinned post RHS is open
cy.uiGetRHS().should('contain', 'Pinned messages');
cy.uiGetSearchContainer().click();
cy.uiGetSearchBox().first().clear().wait(TIMEOUTS.HALF_SEC).type(searchText + '{enter}').wait(TIMEOUTS.HALF_SEC);
// # Now click on the saved post button from the header
cy.uiGetSavedPostButton().click();

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

@@ -30,10 +30,8 @@ describe('Search', () => {
cy.uiGetSearchBox().
type(`${term}{enter}`).
wait(TIMEOUTS.ONE_SEC);
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchBox().clear();
cy.get('#searchHints').should('be.visible');
cy.get('#search-items-container').should('be.visible');
cy.uiGetSearchContainer().type('{esc}');
// # Verify the Search side bar opens up
@@ -46,16 +44,14 @@ describe('Search', () => {
// # Verify that the cleared search text does not appear on the search box
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchBox().find('input').should('be.empty');
cy.uiGetSearchBox().should('be.empty');
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchContainer().type('{esc}');
// # Click the pin icon to open the pinned messages RHS
cy.uiGetChannelPinButton().click();
cy.uiGetRHS().should('contain', 'Pinned messages');
// # Verify that the Search term input box is still cleared and search term does not reappear when RHS opens
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchBox().find('input').and('be.empty');
cy.uiGetSearchBox().and('be.empty');
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchContainer().type('{esc}');
});
});

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

@@ -39,7 +39,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().click();
// # Search the world 'hello' that is generated by /test command
cy.uiGetSearchBox().find('input').type('hello{enter}').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('hello{enter}').wait(TIMEOUTS.HALF_SEC);
cy.get('#search-items-container span').should('contain.text', 'hello');
// # RHS should be visible with search results

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

@@ -40,15 +40,15 @@ describe('Search', () => {
cy.uiGetSearchContainer().click();
// * Search word in searchBox and validate searchWord
cy.uiGetSearchBox().find('input').type(searchWord + '{enter}');
cy.uiGetSearchBox().type(searchWord + '{enter}');
cy.uiGetSearchContainer().click();
cy.uiGetSearchBox().find('input').should('have.value', searchWord);
cy.uiGetSearchBox().should('have.value', searchWord);
// # Click on "x" displayed on searchbox
cy.uiGetSearchBox().find('.input-clear-x').wait(TIMEOUTS.ONE_SEC).click({force: true});
cy.uiGetSearchBox().find('#searchHints').should('be.visible');
cy.uiGetSearchBox().type('{esc}');
cy.uiGetSearchBox().parent().siblings('.input-clear-x').wait(TIMEOUTS.ONE_SEC).click({force: true});
cy.uiGetSearchBox().parents('[class*="SearchInputContainer"]').siblings('#searchHints').should('be.visible');
cy.uiGetSearchBox().first().focus().type('{esc}');
// # RHS should be visible with search results
cy.get('#search-items-container').should('be.visible');
@@ -77,16 +77,16 @@ describe('Search', () => {
cy.uiGetSearchContainer().click();
// # Search for posts from that user
cy.uiGetSearchBox().find('input').type(testSearch, {force: true}).wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type(testSearch, {force: true}).wait(TIMEOUTS.HALF_SEC);
// # Select user from suggestion list
cy.contains('.suggestion-list__item', `@${testUser.username}`).scrollIntoView().click({force: true});
// # Verify that search box has the updated query
cy.uiGetSearchBox().find('input').should('have.value', `FROM:${testUser.username} `);
cy.uiGetSearchBox().should('have.value', `FROM:${testUser.username} `);
// # Perform search
cy.uiGetSearchBox().find('input').type('{enter}').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('{enter}').wait(TIMEOUTS.HALF_SEC);
// * Assert that RHS should be visible with search results
cy.get('#search-items-container').should('be.visible');
@@ -116,7 +116,7 @@ describe('Search', () => {
assertSearchHintFilesOrMessages();
// # Search for search term in:
cy.uiGetSearchBox().find('input').type('in:');
cy.uiGetSearchBox().type('in:');
// # Select option from suggestion list
cy.get('.suggestion-list__item').first().click({force: true});
@@ -128,7 +128,7 @@ describe('Search', () => {
cy.get('.input-clear-x').first().click({force: true}).wait(TIMEOUTS.HALF_SEC);
// # Search for search term in:town-square{space}
cy.uiGetSearchBox().find('input').type('in:town-square ').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('in:town-square ').wait(TIMEOUTS.HALF_SEC);
// * Check the hint contents are now visible
assertSearchHint();
@@ -137,22 +137,22 @@ describe('Search', () => {
cy.uiGetSearchBox().get('.input-clear-x').first().click({force: true}).wait(TIMEOUTS.HALF_SEC);
// # Search for search term in:town-square{enter}
cy.uiGetSearchBox().find('input').type('in:town-square').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('in:town-square').wait(TIMEOUTS.HALF_SEC);
// * Assert that channel name displays appropriately
cy.get('.suggestion-list__item').first().should('contain.text', 'Town Square~town-square');
// # Press enter to register search term
cy.uiGetSearchBox().find('input').type('{enter}');
cy.uiGetSearchBox().type('{enter}');
// * Check the hint contents are now visible
assertSearchHint();
// * Assert that searchBox now includes a trailing space
cy.uiGetSearchBox().find('input').should('have.value', 'in:town-square ');
cy.uiGetSearchBox().should('have.value', 'in:town-square ');
// # Perform the search
cy.uiGetSearchBox().find('input').type('{enter}').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('{enter}').wait(TIMEOUTS.HALF_SEC);
// * Assert autocomplete list is gone
cy.get('.suggestion-list__item').should('not.exist');
@@ -167,7 +167,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().click();
// # Search for `Hell*`
cy.uiGetSearchBox().find('input').type('Hell*{enter}').wait(TIMEOUTS.HALF_SEC);
cy.uiGetSearchBox().type('Hell*{enter}').wait(TIMEOUTS.HALF_SEC);
// # RHS should be visible with search results
cy.get('#search-items-container').should('be.visible');

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

@@ -37,7 +37,7 @@ describe('Search', () => {
// # Search for "apple"
cy.uiGetSearchContainer().click();
cy.uiGetSearchBox().find('input').should('be.visible').type(apple).type('{enter}');
cy.uiGetSearchBox().should('be.visible').first().type(apple).type('{enter}');
// # Get last postId
cy.getLastPostId().as('lastPostId');
@@ -50,7 +50,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().click();
// * Type banana on search box but don't hit search
cy.uiGetSearchBox().find('input').clear({force: true}).type(banana, {force: true});
cy.uiGetSearchBox().first().clear({force: true}).type(banana, {force: true});
// * Search result should not change and remain as one result with highlight still on apple
cy.get('@lastPostId').then((postId) => {

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

@@ -54,7 +54,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().should('be.visible').click();
//# Type "in:" text in search input
cy.uiGetSearchBox().find('input').type('in:');
cy.uiGetSearchBox().type('in:');
const sortedUsernames = groupMembers.
map((member) => member.username).
@@ -64,11 +64,11 @@ describe('Search', () => {
cy.uiGetSearchBox().find('.suggestion-list__main').contains(sortedUsernames.join(',')).click();
//# Press enter to select
cy.uiGetSearchBox().find('input').type('{enter}');
cy.uiGetSearchBox().type('{enter}');
//# Search for the message
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchBox().find('input').clear().type(`${message}{enter}`);
cy.uiGetSearchBox().first().clear().type(`${message}{enter}`);
// * Should return exactly one result from the group channel and matches the message
cy.findAllByTestId('search-item-container').should('be.visible').and('have.length', 1).within(() => {
@@ -91,7 +91,7 @@ describe('Search', () => {
cy.uiGetSearchContainer().should('be.visible').click();
//# Type "in:" text in search input
cy.uiGetSearchBox().find('input').type('in:');
cy.uiGetSearchBox().type('in:');
const sortedUsernames = groupMembers.
map((member) => member.username).
@@ -101,7 +101,7 @@ describe('Search', () => {
cy.uiGetSearchBox().find('.suggestion-list__main').contains(sortedUsernames.join(',')).click();
//# Search for the message
cy.uiGetSearchBox().find('input').type('word-file{enter}');
cy.uiGetSearchBox().type('word-file{enter}');
// # Click the files tab
cy.get('.files-tab').should('be.visible').click();

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

@@ -62,16 +62,16 @@ describe('Search in DMs', () => {
cy.uiGetSearchContainer().should('be.visible').click();
// # Type `in:` in searchbox
cy.uiGetSearchBox().find('input').type('in:');
cy.uiGetSearchBox().type('in:');
// # Select user from suggestion list
cy.contains('.suggestion-list__item', `@${otherUser.username}`).scrollIntoView().click();
// # Validate searchbox contains the username
cy.uiGetSearchBox().find('input').should('have.value', 'in:@' + otherUser.username + ' ');
cy.uiGetSearchBox().should('have.value', 'in:@' + otherUser.username + ' ');
// # Press Enter in searchbox
cy.uiGetSearchBox().find('input').type('word-file').type('{enter}');
cy.uiGetSearchBox().type('word-file').type('{enter}');
// # Click the files tab
cy.get('.files-tab').should('be.visible').click();

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

@@ -60,16 +60,16 @@ describe('Search in DMs', () => {
// # Type `in:` in searchbox
cy.uiGetSearchContainer().should('be.visible').click();
cy.uiGetSearchBox().find('input').type('in:');
cy.uiGetSearchBox().type('in:');
// # Select user from suggestion list
cy.contains('.suggestion-list__item', `@${otherUser.username}`).scrollIntoView().click();
// # Validate searchbox contains the username
cy.uiGetSearchBox().find('input').should('have.value', 'in:@' + otherUser.username + ' ');
cy.uiGetSearchBox().should('have.value', 'in:@' + otherUser.username + ' ');
// # Press Enter in searchbox
cy.uiGetSearchBox().find('input').type(message).type('{enter}');
cy.uiGetSearchBox().type(message).type('{enter}');
// # Search message in each filtered result
cy.get('#search-items-container').find('.search-highlight').each(($el) => {