mirror of
https://github.com/hanzoai/team.git
synced 2026-11-01 07:55:31 +00:00
* MM-T1814: add 'Add a BOT to a team' Cypress E2E test Co-authored-by: Maria A Nunez <[email protected]> * MM-T1335: invite guests to public and private channels Extend invitePeople() helper to accept multiple channels and add a spec verifying both a public and a private channel are added to the guest invite list. Co-authored-by: Maria A Nunez <[email protected]> * MM-T1340: verify guest invite email and join flow (not_cloud) Add a non-cloud spec covering step 2 of MM-T1340: read the invitation email, open the join link, complete guest signup, and verify the guest is added to the team. Co-authored-by: Maria A Nunez <[email protected]> * MM-T1335: assert channel chips via icons and count Verified against a licensed E2E server: assert exactly two channel chips with public and private channel icons rather than an exact text match, which failed due to extra text in the chip label. Co-authored-by: Maria A Nunez <[email protected]> * MM-T1340: accept terms and use valid password in guest signup Verified against a licensed E2E server: the signup Create account button is gated on a 14+ char password and the terms/privacy checkbox. Use newTestPassword(), check the agreement, and assert the app loads. Co-authored-by: Maria A Nunez <[email protected]> --------- Co-authored-by: Hanzo Dev <[email protected]>
97 lines
4.4 KiB
TypeScript
97 lines
4.4 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
export function changeGuestFeatureSettings(featureFlag = true, emailInvitation = true, whitelistedDomains = '') {
|
|
// # Update Guest Accounts, Email Invitations, and Whitelisted Domains
|
|
cy.apiUpdateConfig({
|
|
GuestAccountsSettings: {
|
|
Enable: featureFlag,
|
|
RestrictCreationToDomains: whitelistedDomains,
|
|
},
|
|
ServiceSettings: {
|
|
EnableEmailInvitations: emailInvitation,
|
|
},
|
|
});
|
|
}
|
|
|
|
export function invitePeople(typeText: string, resultsCount: number, verifyText: string, channelName: string | string[] = 'Town Square', clickInvite = true) {
|
|
// # Open team menu and click 'Invite People'
|
|
cy.uiOpenTeamMenu('Invite people');
|
|
|
|
// # Click on the next icon to invite guest
|
|
cy.findByTestId('inviteGuestLink').click();
|
|
|
|
// # Search and add a user
|
|
cy.get('.users-emails-input__control').should('be.visible').within(() => {
|
|
cy.get('input').typeWithForce(typeText);
|
|
});
|
|
cy.get('.users-emails-input__menu').
|
|
children().should('have.length', resultsCount).eq(0).should('contain', verifyText).click();
|
|
|
|
// # Search and add one or more channels
|
|
const channelNames = Array.isArray(channelName) ? channelName : [channelName];
|
|
channelNames.forEach((name) => {
|
|
cy.get('.channels-input__control').should('be.visible').within(() => {
|
|
cy.get('input').typeWithForce(name);
|
|
});
|
|
cy.get('.channels-input__menu').
|
|
children().should('have.length', 1).
|
|
eq(0).should('contain', name).click();
|
|
});
|
|
|
|
if (clickInvite) {
|
|
// # Click Invite Guests Button
|
|
cy.findByTestId('inviteButton').scrollIntoView().click();
|
|
}
|
|
}
|
|
|
|
export function verifyInvitationError(user: string, team: Cypress.Team, errorText: string, verifyGuestBadge = false) {
|
|
// * Verify the content and error message in the Invitation Modal
|
|
cy.findByTestId('invitationModal').within(() => {
|
|
cy.get('h1').should('have.text', `Guests invited to ${team.display_name}`);
|
|
cy.get('div.invitation-modal-confirm--sent').should('not.exist');
|
|
cy.get('div.invitation-modal-confirm--not-sent').should('be.visible').within(() => {
|
|
cy.get('h2 > span').should('have.text', 'Invitations Not Sent');
|
|
cy.get('.people-header').should('have.text', 'People');
|
|
cy.get('.details-header').should('have.text', 'Details');
|
|
cy.get('.username-or-icon').should('contain', user);
|
|
cy.get('.reason').should('have.text', errorText);
|
|
if (verifyGuestBadge) {
|
|
cy.get('.username-or-icon .Tag').should('be.visible').and('have.text', 'GUEST');
|
|
}
|
|
});
|
|
cy.findByTestId('confirm-done').should('be.visible').and('not.be.disabled').click();
|
|
});
|
|
|
|
// * Verify if Invitation Modal was closed
|
|
cy.get('.InvitationModal').should('not.exist');
|
|
}
|
|
|
|
export function verifyInvitationSuccess(user: string, team: Cypress.Team, successText: string, verifyGuestBadge = false) {
|
|
// * Verify the content and success message in the Invitation Modal
|
|
cy.findByTestId('invitationModal').within(() => {
|
|
cy.get('h1').should('have.text', `Guests invited to ${team.display_name}`);
|
|
cy.get('div.invitation-modal-confirm--not-sent').should('not.exist');
|
|
cy.get('div.invitation-modal-confirm--sent').should('be.visible').within(() => {
|
|
cy.get('h2 > span').should('have.text', 'Successful Invites');
|
|
cy.get('.people-header').should('have.text', 'People');
|
|
cy.get('.details-header').should('have.text', 'Details');
|
|
cy.get('.username-or-icon').should('contain', user);
|
|
cy.get('.reason').should('have.text', successText);
|
|
if (verifyGuestBadge) {
|
|
cy.get('.username-or-icon .Tag').should('be.visible').and('have.text', 'GUEST');
|
|
}
|
|
});
|
|
cy.findByTestId('confirm-done').should('be.visible').and('not.be.disabled').click();
|
|
});
|
|
|
|
// * Verify if Invitation Modal was closed
|
|
cy.get('.InvitationModal').should('not.exist');
|
|
}
|
|
|
|
export function verifyGuest(userStatus = 'Guest') {
|
|
// * Verify if Guest User is displayed
|
|
cy.get('#systemUsersTable-cell-0_usernameColumn').parent().should('have.length', 1);
|
|
cy.get('#actionMenuButton-systemUsersTable-0').should('be.visible').and('have.text', userStatus);
|
|
}
|