Files
2023-03-28 18:10:00 +02:00

32 lines
1.2 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../../../fixtures/timeouts';
export function enableGroupMention(groupName, groupID, userEmail) {
// # Visit Group Configurations page
cy.visit(`/admin_console/user_management/groups/${groupID}`);
// # Scroll users list into view and then make sure it has loaded before scrolling back to the top
cy.get('#group_users', {timeout: TIMEOUTS.ONE_MIN}).scrollIntoView();
if (userEmail) {
cy.findByText(userEmail).should('be.visible');
}
cy.get('#group_profile').scrollIntoView().wait(TIMEOUTS.TWO_SEC);
// # Click the allow reference button
cy.findByTestId('allowReferenceSwitch').then((el) => {
const button = el.find('button');
const classAttribute = button[0].getAttribute('class');
if (!classAttribute.includes('active')) {
button[0].click();
}
});
// # Give the group a custom name different from its DisplayName attribute
cy.get('#groupMention').find('input').clear().type(groupName);
// # Click save button
cy.uiSaveConfig();
}