Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ function createChannel(channelType, teamId, userToAdd = null) {
});
}

export function createPrivateChannel(teamId, userToAdd = null) {
// # Create a private channel as sysadmin
return createChannel('P', teamId, userToAdd);
}

module.exports = {
withTimestamp,
createEmail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Channel} from '@mattermost/types/lib/channels';
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';

import {createPrivateChannel} from '../elasticsearch_autocomplete/helpers';
import * as TIMEOUTS from '../../../fixtures/timeouts';

describe('Guest Account - Guest User Experience', () => {
let guestUser;
let privateChannel;
let testTeam;
let guestUser: UserProfile;
let privateChannel: Channel;
let testTeam: Team;
Comment thread
furqanmlk marked this conversation as resolved.

before(() => {
// * Check if server has license for Guest Accounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {UserProfile} from '@mattermost/types/lib/users';

import * as TIMEOUTS from '../../../fixtures/timeouts';

function demoteGuestUser(guestUser) {
Expand All @@ -26,7 +28,7 @@ function demoteGuestUser(guestUser) {
}

describe('Guest Account - Guest User Experience', () => {
let guestUser;
let guestUser: UserProfile;

before(() => {
// * Check if server has license for Guest Accounts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {UserProfile} from '@mattermost/types/lib/users';

// ***************************************************************
// - [#] indicates a test step (e.g. #. Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
Expand All @@ -15,12 +17,12 @@
*/

describe('Guest Accounts', () => {
let guestUser;
let guestUser: UserProfile;

before(() => {
cy.apiRequireLicenseForFeature('GuestAccounts');

cy.apiCreateGuestUser().then(({guest}) => {
cy.apiCreateGuestUser().then((guest) => {
Comment thread
furqanmlk marked this conversation as resolved.
guestUser = guest;
});
});
Expand All @@ -35,7 +37,7 @@ describe('Guest Accounts', () => {
// # Click "Save".
cy.get('#saveSetting').then((btn) => {
if (btn.is(':enabled')) {
btn.on('click');
btn.on('click', () => {});
Comment thread
davidtaing marked this conversation as resolved.

cy.waitUntil(() => cy.get('#saveSetting').then((el) => {
return el[0].innerText === 'Save';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Channel} from '@mattermost/types/lib/channels';
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';

import authenticator from 'authenticator';

Expand All @@ -25,10 +28,10 @@ import {
} from '../../../utils';

describe('Guest Accounts', () => {
let sysadmin;
let testTeam;
let testChannel;
let adminMFASecret;
let sysadmin: UserProfile;
let testTeam: Team;
let testChannel: Channel;
let adminMFASecret: string;
const username = 'g' + getRandomId(); // username has to start with a letter.

before(() => {
Expand All @@ -41,8 +44,8 @@ describe('Guest Accounts', () => {
});

// # Log in as a team admin.
cy.apiAdminLogin().then((res) => {
sysadmin = res.user;
cy.apiAdminLogin().then((adminUser) => {
sysadmin = adminUser;
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
// Stage: @prod
// Group: @enterprise @guest_account @not_cloud

import {Channel} from '@mattermost/types/lib/channels';
import {UserProfile} from '@mattermost/types/lib/users';

import * as TIMEOUTS from '../../../fixtures/timeouts';

describe('Verify Guest User Identification in different screens', () => {
let guest;
let testChannel;
let guest: UserProfile;
let testChannel: Channel;

before(() => {
cy.shouldNotRunOnCloudEdition();
Expand All @@ -35,7 +38,7 @@ describe('Verify Guest User Identification in different screens', () => {
cy.apiInitSetup().then(({team, channel, user}) => {
testChannel = channel;

cy.apiCreateGuestUser().then(({guest: guestUser}) => {
cy.apiCreateGuestUser().then((guestUser) => {
guest = guestUser;
cy.apiAddUserToTeam(team.id, guest.id).then(() => {
cy.apiAddUserToChannel(channel.id, guest.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Channel} from '@mattermost/types/lib/channels';
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';
import dayjs from 'dayjs';

import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getAdminAccount} from '../../../support/env';

describe('Verify Guest User Identification in different screens', () => {
const admin = getAdminAccount();
let regularUser;
let guest;
let testTeam;
let testChannel;
let regularUser: UserProfile;
let guest: UserProfile;
let testTeam: Team;
let testChannel: Channel;

before(() => {
// * Check if server has license for Guest Accounts
Expand All @@ -42,7 +47,7 @@ describe('Verify Guest User Identification in different screens', () => {
testTeam = team;
testChannel = channel;

cy.apiCreateGuestUser().then(({guest: guestUser}) => {
cy.apiCreateGuestUser().then((guestUser) => {
guest = guestUser;
cy.apiAddUserToTeam(testTeam.id, guest.id).then(() => {
cy.apiAddUserToChannel(testChannel.id, guest.id);
Expand Down Expand Up @@ -87,7 +92,7 @@ describe('Verify Guest User Identification in different screens', () => {
cy.visit(`/${testTeam.name}/channels/${testChannel.name}`);

// # Get yesterdays date in UTC
const yesterdaysDate = Cypress.dayjs().subtract(1, 'days').valueOf();
const yesterdaysDate = dayjs().subtract(1, 'days').valueOf();

// # Post a day old message
cy.postMessageAs({sender: guest, message: 'Hello from yesterday', channelId: testChannel.id, createAt: yesterdaysDate}).
Expand All @@ -113,7 +118,8 @@ describe('Verify Guest User Identification in different screens', () => {

// # Open RHS comment menu
cy.get('@yesterdaysPost').then((postId) => {
cy.clickPostCommentIcon(postId);
// need to check the JS version in order to see how this works originally.
Comment thread
furqanmlk marked this conversation as resolved.
cy.clickPostCommentIcon(postId.toString());

// * Verify Guest Badge in RHS
cy.get(`#rhsPost_${postId}`).within(($el) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Team} from '@mattermost/types/lib/teams';

import {getRandomId} from '../../../utils';
import * as TIMEOUTS from '../../../fixtures/timeouts';

Expand All @@ -24,7 +26,7 @@ import {
} from './helpers';

describe('Guest Account - Guest User Invitation Flow', () => {
let testTeam;
let testTeam: Team;

before(() => {
// * Check if server has license for Guest Accounts
Expand Down Expand Up @@ -59,7 +61,7 @@ describe('Guest Account - Guest User Invitation Flow', () => {
});

it('MM-T1337 Invite Guests - Existing Team Guest', () => {
cy.apiCreateGuestUser().then(({guest}) => {
cy.apiCreateGuestUser().then((guest) => {
cy.apiAddUserToTeam(testTeam.id, guest.id).then(() => {
// # Search and add an existing guest by first name, who is part of the team but not channel
invitePeople(guest.first_name, 1, guest.username, 'Off-Topic');
Expand Down Expand Up @@ -88,7 +90,7 @@ describe('Guest Account - Guest User Invitation Flow', () => {

it('MM-T1339 Invite Guests - Existing Guest not on the team', () => {
// # Search and add an existing guest by email, who is not part of the team
cy.apiCreateGuestUser().then(({guest}) => {
cy.apiCreateGuestUser().then((guest) => {
invitePeople(guest.email, 1, guest.username);

verifyInvitationSuccess(guest.username, testTeam, 'This guest has been added to the team and channel.', true);
Expand Down Expand Up @@ -121,7 +123,7 @@ describe('Guest Account - Guest User Invitation Flow', () => {
verifyInvitationError(email, testTeam, expectedError);

// # From System Console try to update email of guest user
cy.apiCreateGuestUser().then(({guest}) => {
cy.apiCreateGuestUser().then((guest) => {
// # Navigate to System Console Users listing page
cy.visit('/admin_console/user_management/users');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';

import {getRandomId} from '../../../utils';

import {
Expand All @@ -22,8 +25,8 @@ import {
} from './helpers';

describe('Guest Account - Guest User Invitation Flow', () => {
let testTeam;
let newUser;
let testTeam: Team;
let newUser: UserProfile;

before(() => {
// * Check if server has license for Guest Accounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Channel} from '@mattermost/types/lib/channels';
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';

import * as TIMEOUTS from '../../../fixtures/timeouts';

describe('Guest Account - Guest User Badge and Popover', () => {
let regularUser;
let guest;
let testTeam;
let testChannel;
let regularUser: UserProfile;
let guest: UserProfile;
let testTeam: Team;
let testChannel: Channel;

before(() => {
// * Check if server has license for Guest Accounts
Expand All @@ -40,10 +44,10 @@ describe('Guest Account - Guest User Badge and Popover', () => {
testTeam = team;
testChannel = channel;

cy.apiCreateGuestUser().then(({guest: guestUser}) => {
cy.apiCreateGuestUser().then((guestUser) => {
guest = guestUser;
cy.log(`Guest Id: ${guest.id}`);
cy.log(`Gurest Username ${guest.username}`);
cy.log(`Guest Username ${guest.username}`);
Comment thread
furqanmlk marked this conversation as resolved.
cy.apiAddUserToTeam(testTeam.id, guest.id).then(() => {
cy.apiAddUserToChannel(testChannel.id, guest.id);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/**
* Note: This test requires Enterprise license to be uploaded
*/
import {Team} from '@mattermost/types/lib/teams';
import {UserProfile} from '@mattermost/types/lib/users';

import * as TIMEOUTS from '../../../fixtures/timeouts';

function removeUserFromAllChannels(verifyAlert, user) {
Expand All @@ -38,22 +41,19 @@ function removeUserFromAllChannels(verifyAlert, user) {
}

describe('Guest Account - Guest User Removal Experience', () => {
let team1;
let team2;
let guest;
let team1: Team;
let team2: Team;
let guest: UserProfile;

before(() => {
// * Check if server has license for Guest Accounts
cy.apiRequireLicenseForFeature('GuestAccounts');

cy.apiInitSetup().then(({team}) => {
team1 = team;

cy.apiInitSetup().then(({team: team1}) => {
// # Create new team and visit its URL
cy.apiCreateTeam('test-team2', 'Test Team2').then(({team: teamTwo}) => {
cy.apiCreateTeam('test-team2', 'Test Team2').then(({team: team2}) => {
cy.apiCreateUser().then(({user}) => {
guest = user;
team2 = teamTwo;
Comment on lines -49 to -56
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failed due to this change.

cy.apiAddUserToTeam(team1.id, guest.id);
cy.apiAddUserToTeam(team2.id, guest.id).then(() => {
cy.apiLogin(guest);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {Team} from '@mattermost/types/lib/teams';

export function changeGuestFeatureSettings(featureFlag = true, emailInvitation = true, whitelistedDomains = '') {
// # Update Guest Accounts, Email Invitations, and Whitelisted Domains
cy.apiUpdateConfig({
Expand All @@ -14,7 +16,7 @@ export function changeGuestFeatureSettings(featureFlag = true, emailInvitation =
});
}

export function invitePeople(typeText, resultsCount, verifyText, channelName = 'Town Square', clickInvite = true) {
export function invitePeople(typeText: string, resultsCount: number, verifyText: string, channelName = 'Town Square', clickInvite = true) {
// # Open team menu and click 'Invite People'
cy.uiOpenTeamMenu('Invite People');

Expand Down Expand Up @@ -42,7 +44,7 @@ export function invitePeople(typeText, resultsCount, verifyText, channelName = '
}
}

export function verifyInvitationError(user, team, errorText, verifyGuestBadge = false) {
export function verifyInvitationError(user: string, team: 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}`);
Expand All @@ -64,7 +66,7 @@ export function verifyInvitationError(user, team, errorText, verifyGuestBadge =
cy.get('.InvitationModal').should('not.exist');
}

export function verifyInvitationSuccess(user, team, successText, verifyGuestBadge = false) {
export function verifyInvitationSuccess(user: string, team: 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}`);
Expand Down
Loading