Added Cypress tests and few optimizations (#24592)

* added e2e test

* Cleanup

* Unused permission

* Minor changes

* Added case when there is no common team

* More tests

* nit
Этот коммит содержится в:
Harshil Sharma
2023-10-10 17:55:18 +05:30
коммит произвёл GitHub
родитель 06765b1f44
Коммит 52072ccf31
4 изменённых файлов: 201 добавлений и 13 удалений

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

@@ -212,5 +212,14 @@ declare namespace Cypress {
* });
*/
apiCreateArchivedChannel(name: string, displayName: string, type: string, teamId: string, messages?: string[], user?: UserProfile): Chainable<Channel>;
/**
* Command to convert a GM to a private channel
* @param {string} channelId - channel id of GM to be converted
* @param {string} teamId - id of team to move the converted private channel to
* @param {string} displayName - display name of converted channel
* @param {string} name - name of converted channel
*/
apiConvertGMToPrivateChannel(channelId: string, teamId: string, displayName: string, name: string): Chainable;
}
}

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

@@ -186,3 +186,19 @@ Cypress.Commands.add('apiCreateArchivedChannel', (name, displayName, type = 'O',
return cy.wrap(channel);
});
});
Cypress.Commands.add('apiConvertGMToPrivateChannel', (channelId, teamId, displayName, name) => {
const body = {
channel_id: channelId,
team_id: teamId,
display_name: displayName,
name,
};
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: `/api/v4/channels/${channelId}/convert_to_channel?team_id=${teamId}`,
method: 'POST',
body,
});
});