Skip to content
Merged
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 @@ -151,7 +151,7 @@ describe('Authentication', () => {

['1user', 'te', 'user#1', 'user!1'].forEach((option) => {
cy.get('#input_name').clear().type(option);
cy.findByText('Create Account').click();
cy.findByText('Create account').click();

// * Assert the error is what is expected;
cy.get('.Input___error').scrollIntoView().should('be.visible');
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('Authentication', () => {

cy.get('#input_name').clear().type(`Test${getRandomId()}`);

cy.findByText('Create Account').click();
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');
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('Authentication', () => {

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
cy.get('.AlertBanner__title').scrollIntoView().should('be.visible');
Expand All @@ -271,7 +271,7 @@ describe('Authentication', () => {
cy.findByText('Copy invite link').click();

// # Input email, select member
cy.findByLabelText('Add or Invite People').type(`test-${getRandomId()}@mattermost.com{downarrow}{downarrow}{enter}`, {force: true});
cy.findByLabelText('Invite People').type(`test-${getRandomId()}@mattermost.com{downarrow}{downarrow}{enter}`, {force: true});

// # Click invite members button
cy.findByRole('button', {name: 'Invite'}).click({force: true});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ describe('Guest Accounts', () => {
// # Click "Save".
cy.findByText('Save').click().wait(TIMEOUTS.ONE_SEC);

// # Get MFA secret
// # Visit a page to trigger MFA setup redirect, then complete MFA setup for admin
cy.visit('/');
cy.url().should('include', 'mfa/setup');
cy.uiGetMFASecret(sysadmin.id).then((secret) => {
adminMFASecret = secret;
});

// # Navigate to Guest Access page.
cy.visit('/admin_console/authentication/guest_access');
cy.url().should('include', '/admin_console/authentication/guest_access');

// # Enable guest accounts.
cy.findByTestId('GuestAccountsSettings.Enabletrue').check();
Expand Down Expand Up @@ -144,20 +147,20 @@ describe('Guest Accounts', () => {
// # Create an account with Email and Password.
cy.get('#input_name').type(username);
cy.get('#input_password-input').type(username);
cy.findByText('Create Account').click();
cy.findByText('Create account').click();

// * When MFA is enforced for Guest Access, guest user should be forced to configure MFA while creating an account.
cy.url().should('include', 'mfa/setup');
cy.get('#mfa').wait(TIMEOUTS.HALF_SEC).find('.col-sm-12').then((p) => {
cy.get('#mfa').wait(TIMEOUTS.HALF_SEC).find('p.col-sm-12 span').then((p) => {
const secretp = p.text();
const secret = secretp.split(' ')[1];

const token = authenticator.generateToken(secret);
cy.get('#mfa').find('.form-control').type(token);
cy.get('#mfa').find('.btn.btn-primary').click();
cy.findByPlaceholderText('MFA Code').type(token);
cy.findByText('Save').click();

cy.wait(TIMEOUTS.ONE_SEC);
cy.get('#mfa').find('.btn.btn-primary').click();
cy.findByText('Okay').click();
});
cy.apiLogout();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Guest Account - Member Invitation Flow', () => {
cy.get('#input_email').type(email);
cy.get('#input_name').type(username);
cy.get('#input_password-input').type('Testing123');
cy.findByText('Create Account').click();
cy.findByText('Create account').click();

// * Verify if user is added to the invited team
cy.uiGetLHSHeader().findByText(testTeam.display_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ describe('Onboarding', () => {
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
// # 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'}).
cy.findByRole('textbox', {name: 'Invite People'}).
typeWithForce(email).wait(TIMEOUTS.HALF_SEC).
typeWithForce('{enter}');
cy.findByTestId('inviteButton').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ describe('Signup Email page', () => {
});

it('should match elements, body', () => {
const {
PRIVACY_POLICY_LINK,
TERMS_OF_SERVICE_LINK,
} = FixedCloudConfig.SupportSettings;

// * Check elements in the body
cy.get('.signup-body').should('be.visible');
cy.get('.header-logo-link').should('be.visible');
Expand All @@ -78,11 +73,15 @@ describe('Signup Email page', () => {
cy.findByText('Your password must be 5-72 characters long.').should('be.visible');

cy.get('#saveSetting').scrollIntoView().should('be.visible');
cy.get('#saveSetting').should('contain', 'Create Account');

cy.get('.signup-body-card-agreement').should('contain', `By proceeding to create your account and use ${config.TeamSettings.SiteName}, you agree to our Terms of Use and Privacy Policy. If you do not agree, you cannot use ${config.TeamSettings.SiteName}.`);
cy.get(`.signup-body-card-agreement > span > [href="${config.SupportSettings.TermsOfServiceLink || TERMS_OF_SERVICE_LINK}"]`).should('be.visible');
cy.get(`.signup-body-card-agreement > span > [href="${config.SupportSettings.PrivacyPolicyLink || PRIVACY_POLICY_LINK}"]`).should('be.visible');
cy.get('#saveSetting').should('contain', 'Create account');

// * Check newsletter subscription checkbox text and links
cy.findByText('I would like to receive Mattermost security updates via newsletter.').should('be.visible');
cy.findByText(/By subscribing, I consent to receive emails from Mattermost with product updates, promotions, and company news\./).should('be.visible');
cy.findByText(/I have read the/).parent().within(() => {
cy.findByRole('link', {name: 'Privacy Policy'}).should('be.visible').and('have.attr', 'href').and('include', 'mattermost.com/pl/privacy-policy/');
cy.findByRole('link', {name: 'unsubscribe'}).should('be.visible').and('have.attr', 'href').and('include', 'forms.mattermost.com/UnsubscribePage.html');
});
});

it('should match elements, footer', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const inviteUserByEmail = (email) => {
// # Wait half a second to ensure that the modal has been fully loaded
cy.wait(TIMEOUTS.HALF_SEC);

cy.findByRole('textbox', {name: 'Add or Invite People'}).
cy.findByRole('textbox', {name: 'Invite People'}).
typeWithForce(email).
wait(TIMEOUTS.HALF_SEC).
typeWithForce('{enter}');
Expand Down Expand Up @@ -71,7 +71,7 @@ export const signupAndVerifyTutorial = (username, password, teamDisplayName) =>
cy.get('#name', {timeout: TIMEOUTS.HALF_MIN}).should('be.visible').type(username);
cy.get('#password').should('be.visible').type(password);

// # Attempt to create an account by clicking on the 'Create Account' button
// # Attempt to create an account by clicking on the 'Create account' button
cy.get('#createAccountButton').click();

// # Close the onboarding tutorial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ describe('Team Settings', () => {
// # Set 'sample.mattermost.com' as the only allowed email domain and save
cy.get('#allowedDomains').click().type(emailDomain).type(' ');
cy.findByText('Save').should('be.visible').click();

// # Close the modal
cy.get('#teamSettingsModalLabel').find('button').should('be.visible').click();
});

// # Close the modal
cy.findByLabelText('Close').click();

// * Wait for modal to be closed
cy.get('#teamSettingsModal').should('not.exist');

// # Open team menu and click 'Invite People'
cy.uiOpenTeamMenu('Invite people');

Expand All @@ -63,7 +66,7 @@ describe('Team Settings', () => {
// * Assert that the user has successfully been invited to the team
cy.get('.invitation-modal-confirm--sent').should('be.visible').within(() => {
cy.get('.username-or-icon').find('span').eq(0).should('have.text', userDetailsString);
cy.get('.InviteResultRow').find('div').eq(1).should('have.text', inviteSuccessMessage);
cy.get('.InviteResultRow').find('.reason').should('have.text', inviteSuccessMessage);
});

// # Click on the 'Invite More People button'
Expand All @@ -75,14 +78,14 @@ describe('Team Settings', () => {
// * Assert that the invite failed and the correct error message is shown
cy.get('.invitation-modal-confirm--not-sent').should('be.visible').within(() => {
cy.get('.username-or-icon').find('span').eq(1).should('have.text', invalidEmail);
cy.get('.InviteResultRow').find('div').eq(1).should('have.text', inviteFailedMessage);
cy.get('.InviteResultRow').find('.reason').should('have.text', inviteFailedMessage);
});
});

function inviteNewMemberToTeam(email) {
cy.wait(TIMEOUTS.HALF_SEC);

cy.findByRole('combobox', {name: 'Add or Invite People'}).
cy.findByRole('combobox', {name: 'Invite People'}).
typeWithForce(email).
wait(TIMEOUTS.HALF_SEC).
typeWithForce('{enter}');
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/playwright/lib/src/ui/pages/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class SignupPage {
this.usernameInput = page.locator('#input_name');
this.passwordInput = page.locator('#input_password-input');
this.passwordToggleButton = page.locator('#password_toggle');
this.createAccountButton = page.locator('button:has-text("Create Account")');
this.createAccountButton = page.locator('button:has-text("Create account")');
this.emailError = page.locator('text=Please enter a valid email address');
this.usernameError = page.locator(
'text=Usernames have to begin with a lowercase letter and be 3-22 characters long. You can use lowercase letters, numbers, periods, dashes, and underscores.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,12 @@ test('MM-63378 System Manager without team access permissions cannot view team d
await expect(teamStatsHeading).toBeVisible();

// Verify the user has no API access to the otherTeam.
await expect(systemManagerClient.getTeam(otherTeam.id)).rejects.toThrow();
let apiError: Error | null = null;
try {
await systemManagerClient.getTeam(otherTeam.id);
} catch (error) {
apiError = error as Error;
}
expect(apiError).not.toBeNull();
expect(apiError?.message).toContain('You do not have the appropriate permissions');
});
42 changes: 21 additions & 21 deletions server/channels/api4/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func TestCreateChannel(t *testing.T) {
require.NoError(t, err)

// Verify that the guest user can access the private channel they were added to
_, _, err = guestClient.GetChannel(context.Background(), private.Id, "")
_, _, err = guestClient.GetChannel(context.Background(), private.Id)
require.NoError(t, err)

// Verify that the guest user cannot add members to the private channel
Expand All @@ -268,7 +268,7 @@ func TestCreateChannel(t *testing.T) {
require.NoError(t, err)

// Verify that the guest user can access the public channel they were added to
_, _, err = guestClient.GetChannel(context.Background(), public.Id, "")
_, _, err = guestClient.GetChannel(context.Background(), public.Id)
require.NoError(t, err)

// Verify that the guest user cannot add members to the public channel
Expand Down Expand Up @@ -1624,50 +1624,50 @@ func TestGetChannel(t *testing.T) {
th := Setup(t).InitBasic(t)
client := th.Client

channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)
require.Equal(t, th.BasicChannel.Id, channel.Id, "ids did not match")

_, err = client.RemoveUserFromChannel(context.Background(), th.BasicChannel.Id, th.BasicUser.Id)
require.NoError(t, err)
_, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id, "")
_, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)

channel, _, err = client.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
channel, _, err = client.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.NoError(t, err)
require.Equal(t, th.BasicPrivateChannel.Id, channel.Id, "ids did not match")

_, err = client.RemoveUserFromChannel(context.Background(), th.BasicPrivateChannel.Id, th.BasicUser.Id)
require.NoError(t, err)
_, resp, err := client.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
_, resp, err := client.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.Error(t, err)
CheckForbiddenStatus(t, resp)

_, resp, err = client.GetChannel(context.Background(), model.NewId(), "")
_, resp, err = client.GetChannel(context.Background(), model.NewId())
require.Error(t, err)
CheckNotFoundStatus(t, resp)

_, err = client.Logout(context.Background())
require.NoError(t, err)
_, resp, err = client.GetChannel(context.Background(), th.BasicChannel.Id, "")
_, resp, err = client.GetChannel(context.Background(), th.BasicChannel.Id)
require.Error(t, err)
CheckUnauthorizedStatus(t, resp)

user := th.CreateUser(t)
_, _, err = client.Login(context.Background(), user.Email, user.Password)
require.NoError(t, err)
_, resp, err = client.GetChannel(context.Background(), th.BasicChannel.Id, "")
_, resp, err = client.GetChannel(context.Background(), th.BasicChannel.Id)
require.Error(t, err)
CheckForbiddenStatus(t, resp)

th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
_, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id, "")
_, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)

_, _, err = client.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
_, _, err = client.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.NoError(t, err)

_, resp, err = client.GetChannel(context.Background(), th.BasicUser.Id, "")
_, resp, err = client.GetChannel(context.Background(), th.BasicUser.Id)
require.Error(t, err)
CheckNotFoundStatus(t, resp)
})
Expand Down Expand Up @@ -3644,7 +3644,7 @@ func TestViewChannel(t *testing.T) {

member, _, err := client.GetChannelMember(context.Background(), th.BasicChannel.Id, th.BasicUser.Id, "")
require.NoError(t, err)
channel, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err = client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)
require.Equal(t, channel.TotalMsgCount, member.MsgCount, "should match message counts")
require.Equal(t, int64(0), member.MentionCount, "should have no mentions")
Expand Down Expand Up @@ -3679,9 +3679,9 @@ func TestReadMultipleChannels(t *testing.T) {
user := th.BasicUser

t.Run("Should successfully mark public channels as read for self", func(t *testing.T) {
channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)
channel2, _, err := client.GetChannel(context.Background(), th.BasicChannel2.Id, "")
channel2, _, err := client.GetChannel(context.Background(), th.BasicChannel2.Id)
require.NoError(t, err)

channelResponse, _, err := client.ReadMultipleChannels(context.Background(), user.Id, []string{channel.Id, channel2.Id})
Expand All @@ -3692,7 +3692,7 @@ func TestReadMultipleChannels(t *testing.T) {
})

t.Run("Should successfully mark private channels as read for self", func(t *testing.T) {
channel, _, err := client.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
channel, _, err := client.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.NoError(t, err)

// private channel without membership should be ignored
Expand All @@ -3704,7 +3704,7 @@ func TestReadMultipleChannels(t *testing.T) {
})

t.Run("Should fail marking public/private channels for other user", func(t *testing.T) {
channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err := client.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)

_, _, err = client.ReadMultipleChannels(context.Background(), th.BasicUser2.Id, []string{channel.Id})
Expand All @@ -3713,9 +3713,9 @@ func TestReadMultipleChannels(t *testing.T) {

t.Run("Admin should succeed in marking public/private channels for other user", func(t *testing.T) {
adminClient := th.SystemAdminClient
channel, _, err := adminClient.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err := adminClient.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)
privateChannel, _, err := adminClient.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
privateChannel, _, err := adminClient.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.NoError(t, err)

channelResponse, _, err := adminClient.ReadMultipleChannels(context.Background(), th.BasicUser2.Id, []string{channel.Id, privateChannel.Id})
Expand All @@ -3729,9 +3729,9 @@ func TestReadMultipleChannels(t *testing.T) {
th.LoginSystemManager(t)
sysMgrClient := th.SystemManagerClient

channel, _, err := sysMgrClient.GetChannel(context.Background(), th.BasicChannel.Id, "")
channel, _, err := sysMgrClient.GetChannel(context.Background(), th.BasicChannel.Id)
require.NoError(t, err)
privateChannel, _, err := sysMgrClient.GetChannel(context.Background(), th.BasicPrivateChannel.Id, "")
privateChannel, _, err := sysMgrClient.GetChannel(context.Background(), th.BasicPrivateChannel.Id)
require.NoError(t, err)

_, _, err = sysMgrClient.ReadMultipleChannels(context.Background(), th.BasicUser2.Id, []string{channel.Id, privateChannel.Id})
Expand Down
5 changes: 4 additions & 1 deletion server/channels/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ func NewServer(options ...Option) (*Server, error) {
}

if _, err = url.ParseRequestURI(*s.platform.Config().ServiceSettings.SiteURL); err != nil {
mlog.Error("SiteURL must be set. Some features will operate incorrectly if the SiteURL is not set. See documentation for details: https://mattermost.com/pl/configure-site-url")
// Don't spam the logs when in CI or local testing mode
if !(os.Getenv("IS_CI") == "true" || os.Getenv("IS_LOCAL_TESTING") == "true") {
mlog.Error("SiteURL must be set. Some features will operate incorrectly if the SiteURL is not set. See documentation for details: https://mattermost.com/pl/configure-site-url")
}
}

// Start email batching because it's not like the other jobs
Expand Down
Loading
Loading