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

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

@@ -11,10 +11,10 @@
// Group: @channels @system_console @authentication
import * as TIMEOUTS from '../../../fixtures/timeouts';
import {getRandomId} from '../../../utils';
describe('Authentication', () => {
const restrictCreationToDomains = 'mattermost.com, test.com';
let testUser;
let testUserAlreadyInTeam;
let testTeam;
@@ -41,84 +41,83 @@ describe('Authentication', () => {
// # Set restricted domain
cy.apiUpdateConfig({
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', () => {
// # Set restricted domain
cy.apiUpdateConfig({
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', () => {
// # Set restricted domain
cy.apiUpdateConfig({
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', () => {
@@ -128,9 +127,8 @@ describe('Authentication', () => {
RequireEmailVerification: false,
},
}).then(({config}) => {
// # Log out and go to front page
cy.apiLogout();
// # Go to front page
cy.visit('/login');
// * Assert that create account button is visible
@@ -139,7 +137,7 @@ describe('Authentication', () => {
// # Go to sign up with email page
cy.visit('/signup_user_complete');
const username = `Hossein${getRandomId()}`;
const username = `Test${getRandomId()}`;
const email = `${username.toLowerCase()}@example.com`;
cy.get('#input_email', {timeout: TIMEOUTS.ONE_MIN}).type(email);
@@ -169,17 +167,16 @@ describe('Authentication', () => {
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');
});
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
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()}`);
@@ -109,7 +109,7 @@ describe('Authentication', () => {
// # 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_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_name').clear().type(`BestUsernameInTheWorld${getRandomId()}`);

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

@@ -145,7 +145,7 @@ describe('Authentication', () => {
// # 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_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
cy.get('#input_password-input').type('Test123456!');
@@ -154,6 +154,7 @@ describe('Authentication', () => {
cy.findByText('Create Account').click();
// * 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');
});
});
@@ -176,11 +177,11 @@ describe('Authentication', () => {
// # 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_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
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();
@@ -207,15 +208,16 @@ describe('Authentication', () => {
// # 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_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
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();
// * 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');
});
@@ -239,15 +241,16 @@ describe('Authentication', () => {
// # 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_email', {timeout: TIMEOUTS.ONE_MIN}).type(`test-${getRandomId()}@example.com`);
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();
// * 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');
});
@@ -261,6 +264,7 @@ describe('Authentication', () => {
});
cy.visit('/');
cy.postMessage('hello');
// # Open team menu and click on "Invite People"
cy.uiOpenTeamMenu('Invite People');
@@ -269,7 +273,7 @@ describe('Authentication', () => {
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}');
cy.findByLabelText('Add or Invite People').type(`test-${getRandomId()}@mattermost.com{downarrow}{downarrow}{enter}`, {force: true});
// # Click invite members button
cy.findByRole('button', {name: 'Invite'}).click({force: true});