Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -0,0 +1,185 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @system_console @authentication
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Authentication', () => {
|
||||
let testUser;
|
||||
let testUserAlreadyInTeam;
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
// # Do email test if setup properly
|
||||
cy.shouldHaveEmailEnabled();
|
||||
|
||||
cy.apiInitSetup().then(({user, team}) => {
|
||||
testUserAlreadyInTeam = user;
|
||||
testTeam = team;
|
||||
cy.apiCreateUser().then(({user: newUser}) => {
|
||||
testUser = newUser;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// # Log in as a admin.
|
||||
cy.apiAdminLogin();
|
||||
});
|
||||
|
||||
it('MM-T1756 - Restrict Domains - Multiple - success', () => {
|
||||
// # Set restricted domain
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
RestrictCreationToDomains: 'mattermost.com, test.com',
|
||||
},
|
||||
}).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');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1757 - Restrict Domains - Multiple - fail', () => {
|
||||
// # Set restricted domain
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
RestrictCreationToDomains: 'mattermost.com, test.com',
|
||||
},
|
||||
}).then(() => {
|
||||
cy.apiLogin(testUserAlreadyInTeam);
|
||||
cy.visit('/');
|
||||
|
||||
// # Open Profile
|
||||
cy.uiOpenProfileModal();
|
||||
|
||||
// # 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', () => {
|
||||
// # Set restricted domain
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
RestrictCreationToDomains: 'mattermost.com, test.com',
|
||||
},
|
||||
}).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');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1763 - Security - Signup: Email verification not required, user immediately sees Town Square', () => {
|
||||
// # Disable email verification
|
||||
cy.apiUpdateConfig({
|
||||
EmailSettings: {
|
||||
RequireEmailVerification: false,
|
||||
},
|
||||
}).then(({config}) => {
|
||||
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');
|
||||
|
||||
const username = `Hossein${getRandomId()}`;
|
||||
const email = `${username.toLowerCase()}@example.com`;
|
||||
|
||||
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(email);
|
||||
|
||||
cy.get('#input_password-input').type('Test123456!');
|
||||
|
||||
cy.get('#input_name').clear().type(username);
|
||||
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
// * Make sure account was created successfully and we are on the team joining page
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
|
||||
cy.getRecentEmail({username, email}).then(({subject}) => {
|
||||
// * Verify the subject
|
||||
expect(subject).to.include(`[${config.TeamSettings.SiteName}] You joined`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1765 - Authentication - Email - Creation with email = false', () => {
|
||||
// # Disable user sign up and enable GitLab
|
||||
cy.apiUpdateConfig({
|
||||
EmailSettings: {
|
||||
EnableSignUpWithEmail: false,
|
||||
},
|
||||
GitLabSettings: {
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,176 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @system_console @authentication @mfa
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
describe('Authentication', () => {
|
||||
beforeEach(() => {
|
||||
// # Log in as admin.
|
||||
cy.apiAdminLogin();
|
||||
});
|
||||
|
||||
it('MM-T1771 - Minimum password length error field shows below 5 and above 64', () => {
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "5"', {timeout: TIMEOUTS.ONE_MIN}).clear().type('88');
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
// * Ensure error appears when saving a password outside of the limits
|
||||
cy.findByText('Minimum password length must be a whole number greater than or equal to 5 and less than or equal to 64.', {timeout: TIMEOUTS.ONE_MIN}).
|
||||
should('exist').
|
||||
and('be.visible');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "5"').clear().type('3');
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
// * Ensure error appears when saving a password outside of the limits
|
||||
cy.findByText('Minimum password length must be a whole number greater than or equal to 5 and less than or equal to 64.', {timeout: TIMEOUTS.ONE_MIN}).
|
||||
should('exist').
|
||||
and('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1772 - Change minimum password length, verify help text and error message', () => {
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "5"', {timeout: TIMEOUTS.ONE_MIN}).clear().type('7');
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
cy.findByText('Must be 7-64 characters long.').should('be.visible');
|
||||
|
||||
cy.apiLogout();
|
||||
|
||||
// # Go to sign up with email page
|
||||
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_name').clear().type(`BestUsername${getRandomId()}`);
|
||||
|
||||
cy.get('#input_password-input').clear().type('less');
|
||||
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
// * Assert the error is what is expected;
|
||||
cy.findByText('Must be 7-64 characters long.').should('be.visible');
|
||||
|
||||
cy.get('#input_password-input').clear().type('greaterthan7');
|
||||
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
// * Assert that we are not shown an MFA screen and instead a Teams You Can join page
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1773 - Minimum password length field resets to default after saving invalid value', () => {
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "5"', {timeout: TIMEOUTS.ONE_MIN}).clear().type('10');
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
cy.reload();
|
||||
|
||||
// * Ensure the limit 10 appears
|
||||
cy.findByPlaceholderText('E.g.: "5"').invoke('val').should('equal', '10');
|
||||
cy.findByPlaceholderText('E.g.: "5"').clear();
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
// * Ensure the limit 10 appears
|
||||
cy.findByPlaceholderText('E.g.: "5"').invoke('val').should('equal', '5');
|
||||
});
|
||||
|
||||
it('MM-T1774 - Select all Password Requirements, verify help text and error on bad password', () => {
|
||||
cy.apiUpdateConfig({
|
||||
PasswordSettings: {
|
||||
Lowercase: true,
|
||||
Number: true,
|
||||
Uppercase: true,
|
||||
Symbol: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiLogout();
|
||||
|
||||
// # Go to sign up with email page
|
||||
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_name').clear().type(`BestUsernameInTheWorld${getRandomId()}`);
|
||||
|
||||
['NOLOWERCASE123!', 'noupppercase123!', 'NoNumber!', 'NoSymbol123'].forEach((option) => {
|
||||
cy.get('#input_password-input').clear().type(option);
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
// * Assert the error is what is expected;
|
||||
cy.findByText('Must be 5-64 characters long and include both lowercase and uppercase letters, numbers, and special characters.').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1777 - Multi-factor Authentication option hidden in Profile when disabled', () => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnableMultifactorAuthentication: false,
|
||||
},
|
||||
});
|
||||
|
||||
cy.visit('/');
|
||||
|
||||
// # Go to Profile
|
||||
cy.uiOpenProfileModal('Security');
|
||||
|
||||
// * Assert that Multi-factor Authentication text does not exist
|
||||
cy.findByText('Multi-factor Authentication').should('not.exist');
|
||||
});
|
||||
|
||||
it('MM-T1779 - Multi-factor Authentication option appears in Profile when enabled', () => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnableMultifactorAuthentication: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.visit('/');
|
||||
|
||||
// # Go to Profile
|
||||
cy.uiOpenProfileModal('Security');
|
||||
|
||||
// * Assert that Multi-factor Authentication text does exist
|
||||
cy.findByText('Multi-factor Authentication').should('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1780 - Multi-factor Authentication false: User can log in without being prompted for MFA', () => {
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {
|
||||
EnableMultifactorAuthentication: true,
|
||||
EnforceMultifactorAuthentication: false,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiCreateUser().then(({user: newUser}) => {
|
||||
cy.apiLogout();
|
||||
|
||||
// # Login as a new user and visit default page
|
||||
cy.apiLogin(newUser);
|
||||
cy.visit('/');
|
||||
|
||||
// * Assert that we are not shown a MFA screen and instead a Teams You Can join page
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @system_console @authentication
|
||||
|
||||
describe('Authentication', () => {
|
||||
beforeEach(() => {
|
||||
// # Log in as a admin.
|
||||
cy.apiAdminLogin();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.apiAdminLogin({failOnStatusCode: false});
|
||||
cy.apiUpdateConfig({});
|
||||
});
|
||||
|
||||
const testCases = [
|
||||
{
|
||||
title: 'MM-T1767 - Email signin false Username signin true',
|
||||
signinWithEmail: false,
|
||||
signinWithUsername: true,
|
||||
},
|
||||
{
|
||||
title: 'MM-T1768 - Email signin true Username signin true',
|
||||
signinWithEmail: true,
|
||||
signinWithUsername: true,
|
||||
},
|
||||
{
|
||||
title: 'MM-T1769 - Email signin true Username signin false',
|
||||
signinWithEmail: true,
|
||||
signinWithUsername: false,
|
||||
},
|
||||
];
|
||||
|
||||
testCases.forEach(({title, signinWithEmail, signinWithUsername}) => {
|
||||
it(title, () => {
|
||||
cy.apiUpdateConfig({
|
||||
EmailSettings: {
|
||||
EnableSignInWithEmail: signinWithEmail,
|
||||
EnableSignInWithUsername: signinWithUsername,
|
||||
},
|
||||
LdapSettings: {
|
||||
Enable: false,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiLogout();
|
||||
|
||||
// # Go to front page
|
||||
cy.visit('/login');
|
||||
|
||||
// # Remove autofocus from login input
|
||||
cy.focused().blur();
|
||||
|
||||
let expectedPlaceholderText;
|
||||
if (signinWithEmail && signinWithUsername) {
|
||||
expectedPlaceholderText = 'Email or Username';
|
||||
} else if (signinWithEmail) {
|
||||
expectedPlaceholderText = 'Email';
|
||||
} else {
|
||||
expectedPlaceholderText = 'Username';
|
||||
}
|
||||
|
||||
// * Make sure the username field has expected placeholder text
|
||||
cy.findByPlaceholderText(expectedPlaceholderText).should('exist').and('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,280 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @system_console @authentication
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {reUrl, getRandomId} from '../../../utils';
|
||||
|
||||
describe('Authentication', () => {
|
||||
let testUser;
|
||||
|
||||
before(() => {
|
||||
// # Do email test if setup properly
|
||||
cy.shouldHaveEmailEnabled();
|
||||
|
||||
cy.apiCreateUser().then(({user: newUser}) => {
|
||||
testUser = newUser;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.apiAdminLogin();
|
||||
});
|
||||
|
||||
it('MM-T1764 - Security - Signup: Email verification required (after having created account when verification was not required)', () => {
|
||||
// # Update Configs
|
||||
cy.apiUpdateConfig({
|
||||
EmailSettings: {
|
||||
RequireEmailVerification: false,
|
||||
},
|
||||
});
|
||||
|
||||
// # Login as test user and make sure it goes to team selection
|
||||
cy.apiLogin(testUser);
|
||||
cy.visit('/');
|
||||
cy.url().should('include', '/select_team');
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Update Configs
|
||||
cy.apiUpdateConfig({
|
||||
EmailSettings: {
|
||||
RequireEmailVerification: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.apiLogout();
|
||||
|
||||
// # Login as test user and make sure it goes to team selection
|
||||
cy.visit('/login');
|
||||
|
||||
// # Remove autofocus from login input
|
||||
cy.get('.login-body-card-content').should('be.visible').focus();
|
||||
|
||||
// # Clear email/username field and type username
|
||||
cy.apiGetClientLicense().then(({isLicensed}) => {
|
||||
cy.findByPlaceholderText(isLicensed ? 'Email, Username or AD/LDAP Username' : 'Email or Username', {timeout: TIMEOUTS.ONE_MIN}).clear().type(testUser.username);
|
||||
});
|
||||
|
||||
// # Clear password field and type password
|
||||
cy.findByPlaceholderText('Password').clear().type(testUser.password);
|
||||
|
||||
// # Hit enter to login
|
||||
cy.get('#saveSetting').should('not.be.disabled').click();
|
||||
|
||||
cy.wait(TIMEOUTS.THREE_SEC);
|
||||
|
||||
// * Assert that email verification has been sent and then resend to make sure it gets resent
|
||||
cy.findByText('Resend Email').should('be.visible').and('exist').click();
|
||||
cy.findByText('Verification email sent').should('be.visible').and('exist');
|
||||
cy.findByText('You’re almost done!').should('be.visible').and('exist');
|
||||
cy.findByText('Please verify your email address. Check your inbox for an email.').should('be.visible').and('exist');
|
||||
|
||||
cy.getRecentEmail(testUser).then(({body}) => {
|
||||
const permalink = body[6].match(reUrl)[0];
|
||||
|
||||
// # Visit permalink (e.g. click on email link), view in browser to proceed
|
||||
cy.visit(permalink);
|
||||
|
||||
// # Clear password field and type password
|
||||
cy.get('#input_password-input').clear().type(testUser.password);
|
||||
|
||||
// # Hit enter to login
|
||||
cy.get('#saveSetting').should('not.be.disabled').click();
|
||||
|
||||
// * Should show the join team stuff
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1770 - Default password settings', () => {
|
||||
cy.apiGetClientLicense().then(({isCloudLicensed}) => {
|
||||
const newConfig = {
|
||||
PasswordSettings: {
|
||||
MinimumLength: null,
|
||||
Lowercase: null,
|
||||
Number: null,
|
||||
Uppercase: null,
|
||||
Symbol: null,
|
||||
},
|
||||
ServiceSettings: {},
|
||||
};
|
||||
|
||||
if (!isCloudLicensed) {
|
||||
newConfig.ServiceSettings = {
|
||||
MaximumLoginAttempts: null,
|
||||
};
|
||||
}
|
||||
|
||||
cy.apiUpdateConfig(newConfig);
|
||||
|
||||
// * Ensure password has a minimum length of 8 and no password requirements are checked
|
||||
cy.apiGetConfig().then(({config: {PasswordSettings}}) => {
|
||||
expect(PasswordSettings.MinimumLength).equal(8);
|
||||
expect(PasswordSettings.Lowercase).equal(false);
|
||||
expect(PasswordSettings.Number).equal(false);
|
||||
expect(PasswordSettings.Uppercase).equal(false);
|
||||
expect(PasswordSettings.Symbol).equal(false);
|
||||
});
|
||||
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
cy.get('.admin-console__header').should('be.visible').and('have.text', 'Password');
|
||||
|
||||
cy.findByTestId('passwordMinimumLengthinput').should('be.visible').and('have.value', '8');
|
||||
cy.findByLabelText('At least one lowercase letter').get('input').should('not.be.checked');
|
||||
cy.findByLabelText('At least one uppercase letter').get('input').should('not.be.checked');
|
||||
cy.findByLabelText('At least one number').get('input').should('not.be.checked');
|
||||
cy.findByLabelText('At least one symbol (e.g. "~!@#$%^&*()")').get('input').should('not.be.checked');
|
||||
|
||||
if (!isCloudLicensed) {
|
||||
cy.findByTestId('maximumLoginAttemptsinput').should('be.visible').and('have.value', '10');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1783 - Username validation shows errors for various username requirements', () => {
|
||||
// # Go to sign up with email page
|
||||
cy.visit('/signup_user_complete');
|
||||
|
||||
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type('Hossein_Is_The_Best_PROGRAMMER@BestInTheWorld.com');
|
||||
|
||||
cy.get('#input_password-input').type('Test123456!');
|
||||
|
||||
['1user', 'te', 'user#1', 'user!1'].forEach((option) => {
|
||||
cy.get('#input_name').clear().type(option);
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
// * Assert the error is what is expected;
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1752 - Enable account creation - true', () => {
|
||||
// # Enable open server
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
EnableUserCreation: true,
|
||||
},
|
||||
});
|
||||
|
||||
// # Logout and go to front 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(`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 created successfully and we are on the team joining page
|
||||
cy.findByText('Teams you can join:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
});
|
||||
|
||||
it('MM-T1753 - Enable account creation - false', () => {
|
||||
// # Disable user account creation
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
EnableUserCreation: false,
|
||||
},
|
||||
});
|
||||
|
||||
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(`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 and we are on the team joining page
|
||||
cy.findByText('User sign-up with email is disabled.').should('be.visible').and('exist');
|
||||
});
|
||||
|
||||
it('MM-T1754 - Restrict Domains - Account creation link on signin page', () => {
|
||||
// # Enable user account creation and set restricted domain
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
RestrictCreationToDomains: 'test.com',
|
||||
EnableUserCreation: true,
|
||||
},
|
||||
});
|
||||
|
||||
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(`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');
|
||||
});
|
||||
|
||||
it('MM-T1755 - Restrict Domains - Email invite', () => {
|
||||
// # Enable user account creation and set restricted domain
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
RestrictCreationToDomains: 'test.com',
|
||||
EnableUserCreation: true,
|
||||
},
|
||||
});
|
||||
|
||||
cy.visit('/');
|
||||
|
||||
// # Open team menu and click on "Invite People"
|
||||
cy.uiOpenTeamMenu('Invite People');
|
||||
|
||||
// # Click invite members if needed
|
||||
cy.findByText('Copy invite link').click();
|
||||
|
||||
// # Input email, select member
|
||||
cy.findByText('Enter a name or email address').type('HosseinTheBestProgrammer@Mattermost.com{downarrow}{downarrow}{enter}');
|
||||
|
||||
// # Click invite members button
|
||||
cy.findByRole('button', {name: 'Invite'}).click({force: true});
|
||||
|
||||
// * Verify message is what you expect it to be
|
||||
cy.contains('The following email addresses do not belong to an accepted domain:', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').and('exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Stage: @prod
|
||||
// Group: @channels @system_console @authentication @not_cloud
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Authentication', () => {
|
||||
before(() => {
|
||||
cy.shouldNotRunOnCloudEdition();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// # Log in as admin.
|
||||
cy.apiAdminLogin();
|
||||
});
|
||||
|
||||
it('MM-T1762 - Invite Salt', () => {
|
||||
cy.visit('/admin_console/site_config/public_links');
|
||||
|
||||
// * Check that public link salt is masked
|
||||
cy.findByText('********************************').should('be.visible');
|
||||
|
||||
// # Click "Regenerate"
|
||||
cy.findByText('Regenerate', {timeout: TIMEOUTS.ONE_MIN}).click();
|
||||
|
||||
// * Check that new public link is generated and unmasked
|
||||
cy.findByText('********************************').should('not.exist');
|
||||
});
|
||||
|
||||
it('MM-T1775 - Maximum Login Attempts field resets to default after saving invalid value', () => {
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "10"', {timeout: TIMEOUTS.ONE_MIN}).clear().type('ten');
|
||||
|
||||
cy.uiSave();
|
||||
|
||||
// * Ensure error appears when saving a password outside of the limits
|
||||
cy.findByPlaceholderText('E.g.: "10"').invoke('val').should('equal', '10');
|
||||
|
||||
// * Verify that the config remain the same
|
||||
cy.apiGetConfig().then(({config}) => {
|
||||
expect(config.ServiceSettings.MaximumLoginAttempts).to.equal(10);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T1776 - Maximum Login Attempts field successfully saves valid change', () => {
|
||||
cy.visit('/admin_console/authentication/password');
|
||||
|
||||
cy.findByPlaceholderText('E.g.: "10"', {timeout: TIMEOUTS.ONE_MIN}).clear().type('2');
|
||||
|
||||
cy.uiSaveConfig();
|
||||
|
||||
// * Ensure error appears when saving a password outside of the limits
|
||||
cy.findByPlaceholderText('E.g.: "10"').invoke('val').should('equal', '2');
|
||||
|
||||
// * Verify that the config have changed
|
||||
cy.apiGetConfig().then(({config}) => {
|
||||
expect(config.ServiceSettings.MaximumLoginAttempts).to.equal(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
|
||||
// Group: @channels @system_console @authentication
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Authentication', () => {
|
||||
before(() => {
|
||||
// # Enable open server
|
||||
cy.apiUpdateConfig({
|
||||
TeamSettings: {
|
||||
EnableOpenServer: false,
|
||||
},
|
||||
});
|
||||
|
||||
// # Logout and visit default page
|
||||
cy.apiLogout();
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
it('MM-T1760 - Enable Open Server false: Create account link is hidden', () => {
|
||||
// * Assert that create account button is not visible
|
||||
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.TEN_SEC}).should('not.exist');
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user