Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
MM-21319 : Migrate "/integration/enterprise/ldap_group" e2e tests to…
Browse files Browse the repository at this point in the history
… TypeScript (#11308)

Automatic Merge
  • Loading branch information
cyberbuff authored Oct 15, 2022
1 parent b3e92e4 commit 0a85176
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ describe('LDAP Group Sync', () => {
if (el.text().includes('Edit')) {
cy.get('#developers_edit').then((buttonEl) => {
// # Get the Group ID and remove all the teams and channels currently attached to it then click the button
const groupId = buttonEl[0].href.match(/\/(?:.(?!\/))+$/)[0].substring(1);
const anchorElement = buttonEl[0] as HTMLAnchorElement;
const groupId = anchorElement.href.match(/\/(?:.(?!\/))+$/)[0].substring(1);
getTeamsAssociatedToGroupAndUnlink(groupId);
getChannelsAssociatedToGroupAndUnlink(groupId);
cy.get('#developers_edit').click();
Expand All @@ -82,7 +83,8 @@ describe('LDAP Group Sync', () => {

// # Get the Group ID and remove all the teams and channels currently attached to it then click the button
cy.get('#developers_configure').then((buttonEl) => {
const groupId = buttonEl[0].href.match(/\/(?:.(?!\/))+$/)[0].substring(1);
const anchorElement = buttonEl[0] as HTMLAnchorElement;
const groupId = anchorElement.href.match(/\/(?:.(?!\/))+$/)[0].substring(1);
getTeamsAssociatedToGroupAndUnlink(groupId);
getChannelsAssociatedToGroupAndUnlink(groupId);
cy.get('#developers_configure').click();
Expand Down Expand Up @@ -110,7 +112,8 @@ describe('LDAP Group Sync', () => {

cy.get('#team_and_channel_membership_table').then((el) => {
// * Ensure that the text in the roles column is Member as default text for each row
const name = el[0].rows[1].cells[0].innerText;
const table = el[0] as HTMLTableElement;
const name = table.rows[1].cells[0].innerText;
cy.findByTestId(`${name}_current_role`).scrollIntoView().should('contain.text', 'Member');

// # Change the option to the admin roles (Channel Admin/Team Admin) for each row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ describe('Group Synced Team - Bot invitation flow', () => {

// # Logout sysadmin and login as an LDAP Group synced user
cy.apiLogout();
cy.apiLogin({username: 'test.one', password: 'Password1'});

const user = {
username: 'test.one',
password: 'Password1',
} as Cypress.UserProfile;
cy.apiLogin(user);

// # Visit the group constrained team
cy.visit(`/${groupConstrainedTeam.name}`);
Expand Down
7 changes: 7 additions & 0 deletions e2e/cypress/tests/support/api/preference.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ declare namespace Cypress {
*/
apiSaveCRTPreference(userId: string, value: string): Chainable<Response>;

/**
* Saves tutorial step of a user
* @param {string} userId - User ID
* @param {string} value - value of tutorial step, e.g. '999' (default, completed tutorial)
*/
apiSaveTutorialStep(userId: string, value: string): Chainable<Response>;

/**
* Save cloud trial banner preference.
* See https://api.mattermost.com/#tag/preferences/paths/~1users~1{user_id}~1preferences/put
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/tests/support/api/team.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ declare namespace Cypress {
* // do something with teams
* });
*/
apiGetAllTeams(queryParams: Record<string, any>): Chainable<Team[]>;
apiGetAllTeams(queryParams?: Record<string, any>): Chainable<{teams: Team[]}>;

/**
* Get a list of teams that a user is on.
Expand Down

0 comments on commit 0a85176

Please sign in to comment.