Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -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 @onboarding
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
const uniqueUserId = getRandomId();
|
||||
|
||||
function signupWithEmail(name, pw) {
|
||||
// # Go to /login
|
||||
cy.visit('/login');
|
||||
|
||||
// # Click on sign up button
|
||||
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.HALF_MIN}).should('be.visible').click();
|
||||
|
||||
// # Type email address (by adding the uniqueUserId in the email address)
|
||||
cy.get('#input_email').type('unique.' + uniqueUserId + '@sample.mattermost.com');
|
||||
|
||||
// # Type 'unique-1' for username
|
||||
cy.get('#input_name').type(name);
|
||||
|
||||
// # Type 'unique1pw' for password
|
||||
cy.get('#input_password-input').type(pw);
|
||||
|
||||
// # Click on Create Account button
|
||||
cy.findByText('Create Account').click();
|
||||
}
|
||||
|
||||
describe('Cloud Onboarding', () => {
|
||||
before(() => {
|
||||
// # Disable other auth options
|
||||
const newSettings = {
|
||||
Office365Settings: {Enable: false},
|
||||
LdapSettings: {Enable: false},
|
||||
};
|
||||
cy.apiUpdateConfig(newSettings);
|
||||
cy.apiLogout();
|
||||
});
|
||||
|
||||
it('MM-T403 Email address already exists', () => {
|
||||
// # Signup a new user with an email address and user generated in signupWithEmail
|
||||
signupWithEmail('unique.' + uniqueUserId, 'unique1pw');
|
||||
|
||||
// * Verify there is Logout Button
|
||||
cy.contains('Logout').should('be.visible');
|
||||
|
||||
// * Verify 'Teams you can join' is visible
|
||||
cy.get('#teamsYouCanJoinContent').should('be.visible');
|
||||
|
||||
// * Verify the link to create a new team is available
|
||||
cy.get('#createNewTeamLink').should('have.attr', 'href', '/create_team').and('be.visible', 'contain', 'Create a team');
|
||||
|
||||
// # Logout and signup another user with the same email but different username and password
|
||||
cy.apiLogout();
|
||||
signupWithEmail('unique-2', 'unique2pw');
|
||||
|
||||
// * Error message displays below the Create Account button that says "An account with that email already exists"
|
||||
cy.findByText('An account with that email already exists.').should('be.visible');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,108 @@
|
||||
// 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 @te_only @onboarding
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
import {getRandomId} from '../../../utils';
|
||||
|
||||
import {inviteUserByEmail, verifyEmailInviteAndVisitLink, signupAndVerifyTutorial} from '../team_settings/helpers';
|
||||
|
||||
describe('Onboarding', () => {
|
||||
const sysadmin = getAdminAccount();
|
||||
const usernameOne = `user${getRandomId()}`;
|
||||
const usernameTwo = `user${getRandomId()}`;
|
||||
const usernameThree = `user${getRandomId()}`;
|
||||
const emailOne = `${usernameOne}@sample.mattermost.com`;
|
||||
const emailTwo = `${usernameTwo}@sample.mattermost.com`;
|
||||
const emailThree = `${usernameThree}@sample.mattermost.com`;
|
||||
const password = 'passwd';
|
||||
|
||||
let testTeam;
|
||||
let siteName;
|
||||
|
||||
before(() => {
|
||||
cy.shouldRunOnTeamEdition();
|
||||
|
||||
// # Disable LDAP, enable onboarding and do email test if setup properly
|
||||
cy.apiUpdateConfig({
|
||||
LdapSettings: {Enable: false},
|
||||
ServiceSettings: {EnableOnboardingFlow: true},
|
||||
}).then(({config}) => {
|
||||
siteName = config.TeamSettings.SiteName;
|
||||
});
|
||||
cy.shouldHaveEmailEnabled();
|
||||
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
testTeam = team;
|
||||
cy.visit(`/${team.name}/channels/town-square`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T399 Invalidate Pending Email Invitations', () => {
|
||||
// # As sysadmin, invite the first user and logout
|
||||
inviteUserByEmail(emailOne);
|
||||
cy.apiLogout();
|
||||
|
||||
// # Get the email sent to the first user, verify the email and go to the provided link
|
||||
verifyEmailInviteAndVisitLink(sysadmin.username, usernameOne, emailOne, testTeam, siteName);
|
||||
|
||||
// # Signup as as the first user and verify that signup was successful
|
||||
signupAndVerifyTutorial(usernameOne, password, testTeam.display_name);
|
||||
|
||||
// # Logout from the current user and login as sysadmin
|
||||
cy.apiLogout();
|
||||
cy.apiAdminLogin();
|
||||
cy.reload();
|
||||
|
||||
// # Open the 'Invite People' modal
|
||||
cy.uiOpenTeamMenu('Invite People');
|
||||
|
||||
// # Wait half a second to ensure that the modal has been fully loaded
|
||||
cy.wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Invite two more users and close the modal
|
||||
inviteNewUser(emailTwo);
|
||||
cy.findByTestId('invite-more').click();
|
||||
inviteNewUser(emailThree);
|
||||
cy.findByText('Done').should('be.visible').click();
|
||||
|
||||
// # Go to system console and invalidate the last two email invites
|
||||
cy.uiOpenProductMenu('System Console');
|
||||
cy.findByText('Signup').scrollIntoView().should('be.visible').click();
|
||||
cy.get('#InvalidateEmailInvitesButton').should('be.visible').within(() => {
|
||||
cy.findByText('Invalidate pending email invites').should('be.visible').click();
|
||||
});
|
||||
|
||||
// # Logout from sysadmin account
|
||||
cy.apiLogout();
|
||||
|
||||
// # Get the email sent to the second user, verify the email and go to the provided link
|
||||
verifyEmailInviteAndVisitLink(sysadmin.username, usernameTwo, emailTwo, testTeam, siteName);
|
||||
|
||||
// # Type username and password
|
||||
cy.get('#name').should('be.visible').type(usernameTwo);
|
||||
cy.get('#password').should('be.visible').type(password);
|
||||
|
||||
// # Attempt to create an account by clicking on the 'Create Account' button
|
||||
cy.get('#createAccountButton').click();
|
||||
|
||||
// * Ensure that since the invite was invalidated, the correct error message should be shown
|
||||
cy.get('#existingEmailErrorContainer').should('exist').and('have.text', 'The signup link does not appear to be valid.');
|
||||
});
|
||||
|
||||
function inviteNewUser(email) {
|
||||
cy.findByRole('textbox', {name: 'Add or Invite People'}).
|
||||
typeWithForce(email).wait(TIMEOUTS.HALF_SEC).
|
||||
typeWithForce('{enter}');
|
||||
cy.get('#inviteMembersButton').click();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,120 @@
|
||||
// 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 @enterprise @onboarding
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {generateRandomUser} from '../../../support/api/user';
|
||||
import {
|
||||
getWelcomeEmailTemplate,
|
||||
reUrl,
|
||||
verifyEmailBody,
|
||||
} from '../../../utils';
|
||||
|
||||
describe('Onboarding', () => {
|
||||
let siteName;
|
||||
let siteUrl;
|
||||
let testTeam;
|
||||
const {username, email, password} = generateRandomUser();
|
||||
|
||||
before(() => {
|
||||
// # Disable LDAP, require email invitation, and do email test if setup properly
|
||||
cy.apiUpdateConfig({
|
||||
LdapSettings: {Enable: false},
|
||||
EmailSettings: {RequireEmailVerification: true},
|
||||
ServiceSettings: {EnableOnboardingFlow: true},
|
||||
}).then(({config}) => {
|
||||
siteName = config.TeamSettings.SiteName;
|
||||
siteUrl = config.ServiceSettings.SiteURL;
|
||||
});
|
||||
cy.shouldHaveEmailEnabled();
|
||||
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
testTeam = team;
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T400 Create account from login page link using email-password', () => {
|
||||
// # Open team menu and click on "Team Settings"
|
||||
cy.uiOpenTeamMenu('Team Settings');
|
||||
|
||||
// * Check that the 'Team Settings' modal was opened
|
||||
cy.get('#teamSettingsModal').should('exist').within(() => {
|
||||
cy.get('#open_inviteEdit').should('be.visible').click();
|
||||
|
||||
// # Enable any user with an account on the server to join the team
|
||||
cy.get('#teamOpenInvite').should('be.visible').click();
|
||||
cy.findByText('Save').should('be.visible').click();
|
||||
|
||||
// # Close the modal
|
||||
cy.get('#teamSettingsModalLabel').find('button').should('be.visible').click();
|
||||
});
|
||||
|
||||
// # Logout from sysadmin account
|
||||
cy.apiLogout();
|
||||
|
||||
// # Visit the team url
|
||||
cy.visit(`/${testTeam.name}`);
|
||||
|
||||
// # Attempt to create a new account
|
||||
cy.get('.login-body-card', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible');
|
||||
cy.findByText('Don\'t have an account?').should('be.visible').click();
|
||||
cy.get('#input_email').should('be.focused').and('be.visible').type(email);
|
||||
cy.get('#input_name').should('be.visible').type(username);
|
||||
cy.get('#input_password-input').should('be.visible').type(password);
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
cy.findByText('You’re almost done!').should('be.visible');
|
||||
|
||||
// # Get invitation email and go to the provided link
|
||||
getEmail(username, email);
|
||||
|
||||
// * Ensure that the email was correctly verified
|
||||
cy.findByText('Email Verified').should('be.visible');
|
||||
|
||||
// * Ensure that the email was pre-filled and the password input box is focused
|
||||
cy.get('#input_loginId').should('be.visible').and('have.value', email);
|
||||
cy.get('#input_password-input').should('be.visible').and('be.focused').type(password);
|
||||
|
||||
// # Click on the login button
|
||||
cy.get('#saveSetting').click();
|
||||
|
||||
// # Close the onboarding tutorial
|
||||
cy.uiCloseOnboardingTaskList();
|
||||
|
||||
// * Check that the display name of the team the user was invited to is being correctly displayed
|
||||
cy.uiGetLHSHeader().findByText(testTeam.display_name);
|
||||
|
||||
// * Check that 'Town Square' is currently being selected
|
||||
cy.get('.SidebarChannel.active').within(() => {
|
||||
cy.get('#sidebarItem_town-square').should('exist');
|
||||
});
|
||||
|
||||
// * Check that the 'Beginning of Town Square' message is visible
|
||||
cy.findByText('Beginning of Town Square').should('be.visible');
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
function getEmail(username, email) {
|
||||
cy.getRecentEmail({username, email}).then((data) => {
|
||||
// * Verify that the email subject is correct
|
||||
expect(data.subject).to.equal(`[${siteName}] You joined ${siteUrl.split('/')[2]}`);
|
||||
|
||||
// * Verify that the email body is correct
|
||||
const expectedEmailBody = getWelcomeEmailTemplate(email, siteName, testTeam.name);
|
||||
verifyEmailBody(expectedEmailBody, data.body);
|
||||
|
||||
// # Visit permalink (e.g. click on email link)
|
||||
const permalink = data.body[4].match(reUrl)[0];
|
||||
cy.visit(permalink);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
// 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 @onboarding
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {generateRandomUser} from '../../../support/api/user';
|
||||
import {
|
||||
getWelcomeEmailTemplate,
|
||||
reUrl,
|
||||
verifyEmailBody,
|
||||
stubClipboard,
|
||||
} from '../../../utils';
|
||||
|
||||
describe('Onboarding', () => {
|
||||
let testTeam;
|
||||
let siteName;
|
||||
|
||||
before(() => {
|
||||
// # Do email test if setup properly
|
||||
cy.shouldHaveEmailEnabled();
|
||||
|
||||
// # Update config to require email verification and onboarding flow
|
||||
cy.apiUpdateConfig({
|
||||
ServiceSettings: {EnableOnboardingFlow: true},
|
||||
EmailSettings: {
|
||||
RequireEmailVerification: true,
|
||||
},
|
||||
}).then(({config}) => {
|
||||
siteName = config.TeamSettings.SiteName;
|
||||
});
|
||||
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
testTeam = team;
|
||||
cy.visit(`/${team.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T398 Use team invite link to sign up using email and password', () => {
|
||||
stubClipboard().as('clipboard');
|
||||
|
||||
// # Open the 'Invite People' full screen modal and get the invite url
|
||||
cy.uiOpenTeamMenu('Invite People');
|
||||
|
||||
// # Copy invite link to clipboard
|
||||
cy.findByTestId('InviteView__copyInviteLink').click();
|
||||
|
||||
cy.get('@clipboard').its('contents').then((val) => {
|
||||
const inviteLink = val;
|
||||
|
||||
// # Logout from admin account and visit the invite url
|
||||
cy.apiLogout();
|
||||
cy.visit(inviteLink);
|
||||
});
|
||||
|
||||
// * Verify it's on email signup page
|
||||
cy.findByText('Email address').should('be.visible');
|
||||
cy.findByPlaceholderText('Choose a Password').should('be.visible');
|
||||
|
||||
// # Type email, username and password
|
||||
const user = generateRandomUser();
|
||||
const {username, email, password} = user;
|
||||
cy.get('#input_email', {timeout: TIMEOUTS.HALF_MIN}).should('be.visible').type(email);
|
||||
cy.get('#input_name').should('be.visible').type(username);
|
||||
cy.get('#input_password-input').should('be.visible').type(password);
|
||||
|
||||
// # Attempt to create an account by clicking on the 'Create Account' button
|
||||
cy.findByText('Create Account').click();
|
||||
|
||||
cy.wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * Check that 'Mattermost: You are almost done' text should be visible when email hasn't been verified yet
|
||||
cy.findByText('You’re almost done!').should('be.visible');
|
||||
|
||||
cy.getRecentEmail(user).then((data) => {
|
||||
const {body: expectedBody} = data;
|
||||
const expectedEmailBody = getWelcomeEmailTemplate(user.email, siteName, testTeam.name);
|
||||
|
||||
// * Verify email body
|
||||
verifyEmailBody(expectedEmailBody, expectedBody);
|
||||
|
||||
const permalink = expectedBody[4].match(reUrl)[0];
|
||||
|
||||
// * Check that URL in address bar does not have an `undefined` team name appended
|
||||
cy.url().should('not.include', 'undefined');
|
||||
|
||||
// # Visit permalink (e.g. click on email link)
|
||||
cy.visit(permalink);
|
||||
|
||||
// # Check that 'Email Verified' text should be visible, email is pre-filled, and password field is focused, then login
|
||||
cy.findByText('Email Verified', {timeout: TIMEOUTS.HALF_MIN}).should('be.visible');
|
||||
cy.get('#input_loginId').should('have.value', email);
|
||||
cy.get('#input_password-input').should('be.visible').type(password);
|
||||
cy.get('#saveSetting').click();
|
||||
cy.findByText('The email/username or password is invalid.').should('not.exist');
|
||||
});
|
||||
|
||||
// # Close the onboarding tutorial
|
||||
cy.uiCloseOnboardingTaskList();
|
||||
|
||||
// * Check that the display name of the team the user successfully joined is correct
|
||||
cy.uiGetLHSHeader().findByText(testTeam.display_name);
|
||||
|
||||
// * Check that 'Town Square' is currently being selected
|
||||
cy.get('.active').within(() => {
|
||||
cy.findByText('Town Square').should('exist');
|
||||
});
|
||||
|
||||
// * Check that the 'Beginning of Town Square' message is visible
|
||||
cy.findByText('Beginning of Town Square').should('be.visible').wait(TIMEOUTS.ONE_SEC);
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user