Этот коммит содержится в:
Saturnino Abril
2023-06-14 07:56:23 +08:00
коммит произвёл GitHub
родитель bc66807acc
Коммит 16ad573979
13 изменённых файлов: 152 добавлений и 137 удалений

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

@@ -41,6 +41,7 @@ describe('Archived channels', () => {
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('be.visible'); cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('be.visible');
// # Archive the channel // # Archive the channel
cy.get('body').type('{esc}');
cy.uiArchiveChannel(); cy.uiArchiveChannel();
// # Click on post dot menu so we can check for reaction icon // # Click on post dot menu so we can check for reaction icon
@@ -50,7 +51,7 @@ describe('Archived channels', () => {
cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('not.exist'); cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_reaction_${postId}`).should('not.exist');
// # Remove focus so we can open RHS // # Remove focus so we can open RHS
cy.get('#channel_view').click(); cy.get('body').type('{esc}');
// # Open RHS for the post // # Open RHS for the post
cy.clickPostCommentIcon(postId); cy.clickPostCommentIcon(postId);
@@ -62,6 +63,7 @@ describe('Archived channels', () => {
cy.wait(TIMEOUTS.HALF_SEC).get(`#RHS_ROOT_reaction_${postId}`).should('not.exist'); cy.wait(TIMEOUTS.HALF_SEC).get(`#RHS_ROOT_reaction_${postId}`).should('not.exist');
// # Search for "Test archive reaction" // # Search for "Test archive reaction"
cy.get('body').type('{esc}');
cy.get('#searchBox').should('be.visible').type(messageText).type('{enter}'); cy.get('#searchBox').should('be.visible').type(messageText).type('{enter}');
// # Click on post dot menu so we can check for reaction icon // # Click on post dot menu so we can check for reaction icon

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

@@ -11,10 +11,10 @@
// Group: @channels @system_console @authentication // Group: @channels @system_console @authentication
import * as TIMEOUTS from '../../../fixtures/timeouts'; import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils'; import {getRandomId} from '../../../utils';
describe('Authentication', () => { describe('Authentication', () => {
const restrictCreationToDomains = 'mattermost.com, test.com';
let testUser; let testUser;
let testUserAlreadyInTeam; let testUserAlreadyInTeam;
let testTeam; let testTeam;
@@ -41,84 +41,83 @@ describe('Authentication', () => {
// # Set restricted domain // # Set restricted domain
cy.apiUpdateConfig({ cy.apiUpdateConfig({
TeamSettings: { TeamSettings: {
RestrictCreationToDomains: 'mattermost.com, test.com', RestrictCreationToDomains: restrictCreationToDomains,
}, },
}).then(() => {
cy.apiLogout();
// # Go to front page
cy.visit('/login');
// * Assert that create account button is visible
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
// # Go to sign up with email page
cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein2Cool4School${getRandomId()}@mattermost.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was created successfully and we are at the select team page
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
}); });
// # Log out and go to login page
cy.apiLogout();
cy.visit('/login');
// * Assert that create account button is visible
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
// # Go to sign up with email page
cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@mattermost.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`test${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was created successfully and we are at the select team page
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
}); });
it('MM-T1757 - Restrict Domains - Multiple - fail', () => { it('MM-T1757 - Restrict Domains - Multiple - fail', () => {
// # Set restricted domain // # Set restricted domain
cy.apiUpdateConfig({ cy.apiUpdateConfig({
TeamSettings: { TeamSettings: {
RestrictCreationToDomains: 'mattermost.com, test.com', RestrictCreationToDomains: restrictCreationToDomains,
}, },
}).then(() => {
cy.apiLogin(testUserAlreadyInTeam);
cy.visit('/');
// # Open Profile
cy.uiOpenProfileModal('Profile Settings');
// # Click "Edit" to the right of "Email"
cy.get('#emailEdit').should('be.visible').click();
// # Type new email
cy.get('#primaryEmail').should('be.visible').type('user-123123@example.com');
cy.get('#confirmEmail').should('be.visible').type('user-123123@example.com');
cy.get('#currentPassword').should('be.visible').type(testUser.password);
// # Save the settings
cy.uiSave().wait(TIMEOUTS.HALF_SEC);
// * Assert an error exist and is what is expected
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible');
}); });
cy.apiLogin(testUserAlreadyInTeam);
cy.visit('/');
// # Open Profile
cy.uiOpenProfileModal('Profile Settings');
// # Click "Edit" to the right of "Email"
cy.get('#emailEdit').should('be.visible').click();
// # Type new email
cy.get('#primaryEmail').should('be.visible').type('user-123123@example.com');
cy.get('#confirmEmail').should('be.visible').type('user-123123@example.com');
cy.get('#currentPassword').should('be.visible').type(testUser.password);
// # Save the settings
cy.uiSave().wait(TIMEOUTS.HALF_SEC);
// * Assert an error exist and is what is expected
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible');
}); });
it('MM-T1758 - Restrict Domains - Team invite closed team', () => { it('MM-T1758 - Restrict Domains - Team invite closed team', () => {
// # Set restricted domain // # Set restricted domain
cy.apiUpdateConfig({ cy.apiUpdateConfig({
TeamSettings: { TeamSettings: {
RestrictCreationToDomains: 'mattermost.com, test.com', RestrictCreationToDomains: restrictCreationToDomains,
}, },
}).then(() => {
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was not created successfully
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible');
}); });
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`test${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was not created successfully
cy.get('.AlertBanner__title').scrollIntoView().should('be.visible');
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible');
}); });
it('MM-T1763 - Security - Signup: Email verification not required, user immediately sees Town Square', () => { it('MM-T1763 - Security - Signup: Email verification not required, user immediately sees Town Square', () => {
@@ -128,9 +127,8 @@ describe('Authentication', () => {
RequireEmailVerification: false, RequireEmailVerification: false,
}, },
}).then(({config}) => { }).then(({config}) => {
// # Log out and go to front page
cy.apiLogout(); cy.apiLogout();
// # Go to front page
cy.visit('/login'); cy.visit('/login');
// * Assert that create account button is visible // * Assert that create account button is visible
@@ -139,7 +137,7 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
const username = `Hossein${getRandomId()}`; const username = `Test${getRandomId()}`;
const email = `${username.toLowerCase()}@example.com`; const email = `${username.toLowerCase()}@example.com`;
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(email); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(email);
@@ -169,17 +167,16 @@ describe('Authentication', () => {
GitLabSettings: { GitLabSettings: {
Enable: true, Enable: true,
}, },
}).then(() => {
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.findByText('Create your account with one of the following:').should('exist');
cy.findByText('GitLab', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
// * Email and Password option does not exist
cy.findByText('Email address').should('not.exist');
cy.findByText('Choose a Password').should('not.exist');
}); });
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.findByText('Create your account with one of the following:').should('exist');
cy.findByText('GitLab', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
// * Email and Password option does not exist
cy.findByText('Email address').should('not.exist');
cy.findByText('Choose a Password').should('not.exist');
}); });
}); });

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

@@ -56,7 +56,7 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_name').clear().type(`BestUsername${getRandomId()}`); cy.get('#input_name').clear().type(`BestUsername${getRandomId()}`);
@@ -109,7 +109,7 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_name').clear().type(`BestUsernameInTheWorld${getRandomId()}`); cy.get('#input_name').clear().type(`BestUsernameInTheWorld${getRandomId()}`);

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

@@ -145,7 +145,7 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type('Hossein_Is_The_Best_PROGRAMMER@BestInTheWorld.com'); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!'); cy.get('#input_password-input').type('Test123456!');
@@ -154,6 +154,7 @@ describe('Authentication', () => {
cy.findByText('Create Account').click(); cy.findByText('Create Account').click();
// * Assert the error is what is expected; // * Assert the error is what is expected;
cy.get('.Input___error').scrollIntoView().should('be.visible');
cy.findByText('Usernames have to begin with a lowercase letter and be 3-22 characters long. You can use lowercase letters, numbers, periods, dashes, and underscores.').should('be.visible'); cy.findByText('Usernames have to begin with a lowercase letter and be 3-22 characters long. You can use lowercase letters, numbers, periods, dashes, and underscores.').should('be.visible');
}); });
}); });
@@ -176,11 +177,11 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!'); cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`); cy.get('#input_name').clear().type(`Test${getRandomId()}`);
cy.findByText('Create Account').click(); cy.findByText('Create Account').click();
@@ -207,15 +208,16 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!'); cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`); cy.get('#input_name').clear().type(`Test${getRandomId()}`);
cy.findByText('Create Account').click(); cy.findByText('Create Account').click();
// * Make sure account was not created successfully and we are on the team joining page // * Make sure account was not created successfully and we are on the team joining page
cy.get('.AlertBanner__title').scrollIntoView().should('be.visible');
cy.findByText('User sign-up with email is disabled.').should('be.visible').and('exist'); cy.findByText('User sign-up with email is disabled.').should('be.visible').and('exist');
}); });
@@ -239,15 +241,16 @@ describe('Authentication', () => {
// # Go to sign up with email page // # Go to sign up with email page
cy.visit('/signup_user_complete'); cy.visit('/signup_user_complete');
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`); cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!'); cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`); cy.get('#input_name').clear().type(`Test${getRandomId()}`);
cy.findByText('Create Account').click(); cy.findByText('Create Account').click();
// * Make sure account was not created successfully // * Make sure account was not created successfully
cy.get('.AlertBanner__title').scrollIntoView().should('be.visible');
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible').and('exist'); cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible').and('exist');
}); });
@@ -261,6 +264,7 @@ describe('Authentication', () => {
}); });
cy.visit('/'); cy.visit('/');
cy.postMessage('hello');
// # Open team menu and click on "Invite People" // # Open team menu and click on "Invite People"
cy.uiOpenTeamMenu('Invite People'); cy.uiOpenTeamMenu('Invite People');
@@ -269,7 +273,7 @@ describe('Authentication', () => {
cy.findByText('Copy invite link').click(); cy.findByText('Copy invite link').click();
// # Input email, select member // # Input email, select member
cy.findByText('Enter a name or email address').type('HosseinTheBestProgrammer@Mattermost.com{downarrow}{downarrow}{enter}'); cy.findByLabelText('Add or Invite People').type(`test-${getRandomId()}@mattermost.com{downarrow}{downarrow}{enter}`, {force: true});
// # Click invite members button // # Click invite members button
cy.findByRole('button', {name: 'Invite'}).click({force: true}); cy.findByRole('button', {name: 'Invite'}).click({force: true});

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

@@ -32,7 +32,7 @@ describe('New Channel modal with Boards enabled', () => {
isPrivate: false, isPrivate: false,
purpose: '', purpose: '',
name: channelName, name: channelName,
createBoard: true, createBoard: 'Roadmap',
}).then(() => { }).then(() => {
// * Verify that new channel is in the sidebar and is active // * Verify that new channel is in the sidebar and is active
cy.url().should('include', `/${testTeam.name}/channels/test-channel`); cy.url().should('include', `/${testTeam.name}/channels/test-channel`);
@@ -42,7 +42,7 @@ describe('New Channel modal with Boards enabled', () => {
// * Verify the board is created - check the message sent // * Verify the board is created - check the message sent
cy.waitUntil(() => cy.getLastPost().then((el) => { cy.waitUntil(() => cy.getLastPost().then((el) => {
const postedMessageEl = el.find('.post-message__text > p')[0]; const postedMessageEl = el.find('.post-message__text > p')[0];
return Boolean(postedMessageEl && postedMessageEl.textContent.includes('created the board')); return Boolean(postedMessageEl && postedMessageEl.textContent.includes('linked the board'));
})); }));
}); });
}); });

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

@@ -10,12 +10,15 @@
// Stage: @prod // Stage: @prod
// Group: @channels @custom_status // Group: @channels @custom_status
import moment from 'moment-timezone';
describe('Custom Status - CTAs for New Users', () => { describe('Custom Status - CTAs for New Users', () => {
before(() => { before(() => {
cy.apiUpdateConfig({TeamSettings: {EnableCustomUserStatuses: true}}); cy.apiUpdateConfig({TeamSettings: {EnableCustomUserStatuses: true}});
// # Login as test user and visit channel // # Create a user from more than 7 days ago, log and visit channel
cy.apiInitSetup({loginAfter: true}).then(({team, channel}) => { const userCreateAt = moment().subtract(8, 'day').unix();
cy.apiInitSetup({loginAfter: true, userCreateAt}).then(({team, channel}) => {
cy.visit(`/${team.name}/channels/${channel.name}`); cy.visit(`/${team.name}/channels/${channel.name}`);
}); });
}); });

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

@@ -15,6 +15,7 @@ import * as TIMEOUTS from '../../../../fixtures/timeouts';
import {getRandomId} from '../../../../utils'; import {getRandomId} from '../../../../utils';
describe('Authentication', () => { describe('Authentication', () => {
const restrictCreationToDomains = 'mattermost.com, test.com';
let testTeam; let testTeam;
before(() => { before(() => {
@@ -34,34 +35,33 @@ describe('Authentication', () => {
// # Set restricted domain // # Set restricted domain
cy.apiUpdateConfig({ cy.apiUpdateConfig({
TeamSettings: { TeamSettings: {
RestrictCreationToDomains: 'mattermost.com, test.com', RestrictCreationToDomains: restrictCreationToDomains,
}, },
}).then(() => {
cy.visit(`/admin_console/user_management/teams/${testTeam.id}`);
cy.findByTestId('allowAllToggleSwitch', {timeout: TIMEOUTS.ONE_MIN}).click();
// # Click "Save"
cy.findByText('Save').scrollIntoView().click();
// # Wait until we are at the Mattermost Teams page
cy.findByText('Mattermost Teams', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`Hossein_Is_The_Best_PROGRAMMER${getRandomId()}@BestInTheWorld.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`HosseinIs2Cool${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was not created successfully
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible').and('exist');
}); });
cy.visit(`/admin_console/user_management/teams/${testTeam.id}`);
cy.findByTestId('allowAllToggleSwitch', {timeout: TIMEOUTS.ONE_MIN}).click();
// # Click "Save"
cy.findByText('Save').scrollIntoView().click();
// # Wait until we are at the Mattermost Teams page
cy.findByText('Mattermost Teams', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
cy.apiLogout().visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!');
cy.get('#input_name').clear().type(`Test${getRandomId()}`);
cy.findByText('Create Account').click();
// * Make sure account was not created successfully
cy.get('.AlertBanner__title').scrollIntoView().should('be.visible');
cy.findByText('The email you provided does not belong to an accepted domain. Please contact your administrator or sign up with a different email.').should('be.visible').and('exist');
}); });
it('MM-T1761 - Enable Open Server - Create link appears if email account creation is false and other signin methods are true', () => { it('MM-T1761 - Enable Open Server - Create link appears if email account creation is false and other signin methods are true', () => {
@@ -73,13 +73,12 @@ describe('Authentication', () => {
LdapSettings: { LdapSettings: {
Enable: true, Enable: true,
}, },
}).then(() => {
cy.apiLogout();
cy.visit('/');
// * Assert that create account button is visible
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
}); });
cy.apiLogout().visit('/');
// * Assert that create account button is visible
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
}); });
it('MM-T1766 - Authentication - Email - Creation with email = true', () => { it('MM-T1766 - Authentication - Email - Creation with email = true', () => {
@@ -89,16 +88,14 @@ describe('Authentication', () => {
EnableSignUpWithEmail: true, EnableSignUpWithEmail: true,
}, },
TeamSettings: { TeamSettings: {
RestrictCreationToDomains: 'mattermost.com, test.com', RestrictCreationToDomains: restrictCreationToDomains,
}, },
}).then(() => {
cy.apiLogout();
cy.visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
// * Email and Password option exist
cy.findByText('Email address').should('exist').and('be.visible');
cy.findByPlaceholderText('Choose a Password').should('exist').and('be.visible');
}); });
cy.apiLogout().visit(`/signup_user_complete/?id=${testTeam.invite_id}`);
// * Email and Password option exist
cy.findByText('Email address').should('exist').and('be.visible');
cy.findByPlaceholderText('Choose a Password').should('exist').and('be.visible');
}); });
}); });

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

@@ -438,6 +438,12 @@ Cypress.Commands.add('apiDisableTutorials', (userId) => {
name: 'drafts_tour_tip_showed', name: 'drafts_tour_tip_showed',
value: '{"drafts_tour_tip_showed":true}', value: '{"drafts_tour_tip_showed":true}',
}, },
{
user_id: userId,
category: 'app_bar',
name: 'channel_with_board_tip_showed',
value: '{"channel_with_board_tip_showed":true}',
},
]; ];
return cy.apiSaveUserPreference(preferences, userId); return cy.apiSaveUserPreference(preferences, userId);

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

@@ -16,6 +16,7 @@ interface SetupParam {
promoteNewUserAsAdmin?: boolean; promoteNewUserAsAdmin?: boolean;
hideAdminTrialModal?: boolean; hideAdminTrialModal?: boolean;
userPrefix?: string; userPrefix?: string;
userCreateAt?: number;
teamPrefix?: {name: string; displayName: string}; teamPrefix?: {name: string; displayName: string};
channelPrefix?: {name: string; displayName: string}; channelPrefix?: {name: string; displayName: string};
skipBoardsWelcomePage?: boolean; skipBoardsWelcomePage?: boolean;
@@ -26,6 +27,7 @@ function apiInitSetup(arg: SetupParam = {}): ChainableT<SetupResult> {
promoteNewUserAsAdmin = false, promoteNewUserAsAdmin = false,
hideAdminTrialModal = true, hideAdminTrialModal = true,
userPrefix, userPrefix,
userCreateAt,
teamPrefix = {name: 'team', displayName: 'Team'}, teamPrefix = {name: 'team', displayName: 'Team'},
channelPrefix = {name: 'channel', displayName: 'Channel'}, channelPrefix = {name: 'channel', displayName: 'Channel'},
skipBoardsWelcomePage = true, skipBoardsWelcomePage = true,
@@ -34,7 +36,7 @@ function apiInitSetup(arg: SetupParam = {}): ChainableT<SetupResult> {
return (cy.apiCreateTeam(teamPrefix.name, teamPrefix.displayName) as any).then(({team}) => { return (cy.apiCreateTeam(teamPrefix.name, teamPrefix.displayName) as any).then(({team}) => {
// # Add public channel // # Add public channel
return (cy.apiCreateChannel(team.id, channelPrefix.name, channelPrefix.displayName) as any).then(({channel}) => { return (cy.apiCreateChannel(team.id, channelPrefix.name, channelPrefix.displayName) as any).then(({channel}) => {
return (cy.apiCreateUser({prefix: userPrefix || (promoteNewUserAsAdmin ? 'admin' : 'user')}) as any).then(({user}) => { return (cy.apiCreateUser({prefix: userPrefix || (promoteNewUserAsAdmin ? 'admin' : 'user'), createAt: userCreateAt}) as any).then(({user}) => {
if (promoteNewUserAsAdmin) { if (promoteNewUserAsAdmin) {
(cy as any).apiPatchUserRoles(user.id, ['system_admin', 'system_user']); (cy as any).apiPatchUserRoles(user.id, ['system_admin', 'system_user']);

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

@@ -209,6 +209,7 @@ declare namespace Cypress {
apiCreateUser(options?: { apiCreateUser(options?: {
user?: Partial<UserProfile>; user?: Partial<UserProfile>;
prefix?: string; prefix?: string;
createAt?: number;
bypassTutorial?: boolean; bypassTutorial?: boolean;
showOnboarding?: boolean; showOnboarding?: boolean;
}): Chainable<{user: UserProfile}>; }): Chainable<{user: UserProfile}>;

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

@@ -216,7 +216,7 @@ Cypress.Commands.add('apiCreateAdmin', () => {
}); });
}); });
function generateRandomUser(prefix = 'user') { function generateRandomUser(prefix = 'user', createAt = 0) {
const randomId = getRandomId(); const randomId = getRandomId();
return { return {
@@ -226,18 +226,20 @@ function generateRandomUser(prefix = 'user') {
first_name: `First${randomId}`, first_name: `First${randomId}`,
last_name: `Last${randomId}`, last_name: `Last${randomId}`,
nickname: `Nickname${randomId}`, nickname: `Nickname${randomId}`,
create_at: createAt,
}; };
} }
Cypress.Commands.add('apiCreateUser', ({ Cypress.Commands.add('apiCreateUser', ({
prefix = 'user', prefix = 'user',
createAt = 0,
bypassTutorial = true, bypassTutorial = true,
hideActionsMenu = true, hideActionsMenu = true,
hideOnboarding = true, hideOnboarding = true,
bypassWhatsNewModal = true, bypassWhatsNewModal = true,
user = null, user = null,
} = {}) => { } = {}) => {
const newUser = user || generateRandomUser(prefix); const newUser = user || generateRandomUser(prefix, createAt);
const createUserOption = { const createUserOption = {
headers: {'X-Requested-With': 'XMLHttpRequest'}, headers: {'X-Requested-With': 'XMLHttpRequest'},

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

@@ -24,6 +24,7 @@ declare namespace Cypress {
* @param {string} options.purpose - Channel's purpose * @param {string} options.purpose - Channel's purpose
* @param {string} options.header - Channel's header * @param {string} options.header - Channel's header
* @param {boolean} options.isNewSidebar) - the new sidebar has a different ui flow, set this setting to true to use that. Defaults to false. * @param {boolean} options.isNewSidebar) - the new sidebar has a different ui flow, set this setting to true to use that. Defaults to false.
* @param {string} options.createBoard) - Board template to create
* *
* @example * @example
* cy.uiCreateChannel({prefix: 'private-channel-', isPrivate: true, purpose: 'my private channel', header: 'my private header', isNewSidebar: false}); * cy.uiCreateChannel({prefix: 'private-channel-', isPrivate: true, purpose: 'my private channel', header: 'my private header', isNewSidebar: false});

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

@@ -9,7 +9,7 @@ Cypress.Commands.add('uiCreateChannel', ({
isPrivate = false, isPrivate = false,
purpose = '', purpose = '',
name = '', name = '',
createBoard = false, createBoard = '',
}) => { }) => {
cy.uiBrowseOrCreateChannel('Create new channel').click(); cy.uiBrowseOrCreateChannel('Create new channel').click();
@@ -30,8 +30,8 @@ Cypress.Commands.add('uiCreateChannel', ({
cy.findByTestId('add-board-to-channel-check').then((el) => { cy.findByTestId('add-board-to-channel-check').then((el) => {
if (el && !el.hasClass('checked')) { if (el && !el.hasClass('checked')) {
el.click(); el.click();
cy.get('#input_select-board-template').should('be.visible').click(); cy.get('.templates-selector').find('input').click({force: true});
cy.get('.SelectTemplateMenu .MenuItem:contains(Roadmap) button').should('be.visible').click(); cy.findByText(createBoard).scrollIntoView().should('be.visible').click({force: true});
} }
}); });
} }