Files
upstream-mattermost/e2e-tests/cypress/tests/integration/channels/system_console/environment_spec.js
upstream-mirror 240db4e2a7
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:29:55 +05:00

286 lines
12 KiB
JavaScript

// 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 @not_cloud
import * as TIMEOUTS from '@/fixtures/timeouts';
describe('Environment', () => {
let townsquareLink;
let testTeam;
const mattermostIcon = 'mattermost-icon_128x128.png';
before(() => {
cy.shouldNotRunOnCloudEdition();
cy.apiInitSetup().then(({team}) => {
testTeam = team;
townsquareLink = `/${team.name}/channels/town-square`;
});
});
it('MM-T959 - Web server mode - Webserver gzip', () => {
cy.visit('/admin_console/environment/web_server');
// # Click dropdown to open selection
cy.findByTestId('ServiceSettings.WebserverModedropdown').should('have.value', 'gzip');
// # Navigate to a channel
cy.visit(townsquareLink);
// # Open team menu and click "Team Settings"
cy.uiOpenTeamMenu('Team settings');
// * Check that the 'Team Settings' modal was opened
cy.get('#teamSettingsModal').should('exist').within(() => {
// # Verify upload icon button is visible
cy.get('i[title="Edit Icon"]').should('be.visible');
// # Upload a file on center view
cy.findByTestId('uploadPicture').attachFile(mattermostIcon);
// after uploading the picture the save button must be disabled
cy.uiSave().wait(TIMEOUTS.HALF_SEC);
// # Close the modal
cy.get('button[aria-label="Close"]').should('be.visible').click();
});
// Validate that the image is being displayed
cy.get(`#${testTeam.name}TeamButton`).scrollIntoView().within(() => {
cy.findByTestId('teamIconImage').then((imageDiv) => {
const url = imageDiv.css('background-image').split('"')[1];
// # Verify that the response to fetch image is successful and not emmpty
cy.request({url, encoding: 'base64'}).then((response) => {
expect(response.status).to.equal(200);
expect(response.body).to.not.be.null;
});
});
});
});
it('MM-T960 - Web server mode - Webserver Uncompressed', () => {
cy.visit('/admin_console/environment/web_server');
// # Click dropdown to open selection
cy.findByTestId('ServiceSettings.WebserverModedropdown').select('Uncompressed');
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
// # Navigate to a channel
cy.visit(townsquareLink);
// # Open team menu and click "Team Settings"
cy.uiOpenTeamMenu('Team settings');
// * Check that the 'Team Settings' modal was opened
cy.get('#teamSettingsModal').should('exist').within(() => {
// # Verify upload icon button is visible
cy.get('i[title="Edit Icon"]').should('be.visible');
// # Upload a file on center view
cy.findByTestId('uploadPicture').attachFile(mattermostIcon);
// * After uploading the picture the save button must be disabled
cy.uiSave().wait(TIMEOUTS.HALF_SEC);
// # Close the modal
cy.get('button[aria-label="Close"]').should('be.visible').click();
});
// Validate that the image is being displayed
cy.get(`#${testTeam.name}TeamButton`).scrollIntoView().within(() => {
cy.findByTestId('teamIconImage').then((imageDiv) => {
const url = imageDiv.css('background-image').split('"')[1];
// # Verify that the response to fetch image is successful and not emmpty
cy.request({url, encoding: 'base64'}).then((response) => {
expect(response.status).to.equal(200);
expect(response.body).to.not.be.null;
});
});
});
});
it('MM-T961 - Web server mode - Webserver Disabled', () => {
cy.visit('/admin_console/environment/web_server');
// # Click dropdown to open selection
cy.findByTestId('ServiceSettings.WebserverModedropdown').select('Disabled');
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
// # Navigate to a channel
cy.visit(townsquareLink);
// # Open team menu and click "Team Settings"
cy.uiOpenTeamMenu('Team settings');
// * Check that the 'Team Settings' modal was opened
cy.get('#teamSettingsModal').should('exist').within(() => {
// # Verify upload icon button is visible
cy.get('i[title="Edit Icon"]').should('be.visible');
// # Upload a file on center view
cy.findByTestId('uploadPicture').attachFile(mattermostIcon);
// * After uploading the picture the save button must be disabled
cy.uiSave().wait(TIMEOUTS.HALF_SEC);
// # Close the modal
cy.get('button[aria-label="Close"]').should('be.visible').click();
});
// Validate that the image is being displayed
cy.get(`#${testTeam.name}TeamButton`).scrollIntoView().within(() => {
cy.findByTestId('teamIconImage').then((imageDiv) => {
const url = imageDiv.css('background-image').split('"')[1];
// # Verify that the response to fetch image is successful not emmpty
cy.request({url, encoding: 'base64'}).then((response) => {
expect(response.status).to.equal(200);
expect(response.body).to.not.be.null;
});
});
});
});
it('MM-T991 - Database fields can be edited and saved', () => {
cy.visit('/admin_console/environment/database');
const queryTimeoutValue = 100;
const maxOpenConnsValue = 1000;
cy.findByTestId('queryTimeoutinput').clear().type(queryTimeoutValue);
cy.findByTestId('maxOpenConnsinput').clear().type(maxOpenConnsValue);
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
// Get config again
cy.apiGetConfig().then(({config}) => {
// * Verify the database setting values are saved
expect(config.SqlSettings.QueryTimeout).to.eq(queryTimeoutValue);
expect(config.SqlSettings.MaxOpenConns).to.eq(maxOpenConnsValue);
});
});
it('MM-T993 - Minimum hashtag length at least 2', () => {
const defaultHashtagLength = 3;
const minimumHashtagLength = 2;
function setAndVerifyHashtagLength(length) {
cy.findByTestId('minimumHashtagLengthinput').clear().type(length);
// # Click Save button to save the settings
cy.get('#saveSetting').click({force: true}).wait(TIMEOUTS.ONE_SEC);
// * Verify saved config value
cy.apiGetConfig().then(({config}) => {
const expectedLength = length < minimumHashtagLength ? defaultHashtagLength : length;
expect(config.ServiceSettings.MinimumHashtagLength).to.eq(expectedLength);
});
}
cy.visit('/admin_console/environment/database');
setAndVerifyHashtagLength(4);
setAndVerifyHashtagLength(1);
setAndVerifyHashtagLength(2);
});
it('MM-T995 - Amazon S3 settings', () => {
cy.visit('/admin_console/environment/file_storage');
// # CLick dropdown to open selection
cy.findByTestId('FileSettings.DriverNamedropdown').select('Amazon S3');
// Check that these fields are disabled
cy.findByTestId('FileSettings.Directoryinput').should('be.disabled');
// Check that these fields are not disabled
cy.findByTestId('FileSettings.MaxFileSizenumber').should('not.be.disabled');
cy.findByTestId('FileSettings.AmazonS3Bucketinput').should('not.be.disabled');
cy.findByTestId('FileSettings.AmazonS3PathPrefixinput').should('not.be.disabled');
cy.findByTestId('FileSettings.AmazonS3Regioninput').should('not.be.disabled');
cy.findByTestId('FileSettings.AmazonS3AccessKeyIdinput').should('not.be.disabled');
const amazonS3BucketName = 'test';
const amazonS3PathPrefix = 'test';
cy.findByTestId('FileSettings.MaxFileSizenumber').clear().type(52428800);
cy.findByTestId('FileSettings.AmazonS3Bucketinput').clear().type(amazonS3BucketName);
cy.findByTestId('FileSettings.AmazonS3PathPrefixinput').clear().type(amazonS3PathPrefix);
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
// Get config again
cy.apiGetConfig().then(({config}) => {
// * Verify the database setting values are saved
expect(config.FileSettings.AmazonS3Bucket).to.eq(amazonS3BucketName);
expect(config.FileSettings.AmazonS3PathPrefix).to.eq(amazonS3PathPrefix);
});
});
it('MM-T996 - Amazon S3 connection error messaging', () => {
cy.visit('/admin_console/environment/file_storage');
// # CLick dropdown to open selection
cy.findByTestId('FileSettings.DriverNamedropdown').select('Amazon S3');
const amazonS3PathPrefix = 'test';
cy.findByTestId('FileSettings.AmazonS3Bucketinput').clear();
cy.findByTestId('FileSettings.AmazonS3PathPrefixinput').scrollIntoView().clear().type(amazonS3PathPrefix);
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
cy.get('#TestFileStoreConnection').scrollIntoView().should('be.visible').within(() => {
cy.findByText('Test Connection').should('be.visible').click().wait(TIMEOUTS.ONE_SEC);
waitForAlert('Connection unsuccessful: S3 Bucket is required');
});
const amazonS3BucketName = '12';
cy.findByTestId('FileSettings.AmazonS3Bucketinput').clear().type(amazonS3BucketName);
// # Click Save button to save the settings
cy.get('#saveSetting').click().wait(TIMEOUTS.ONE_SEC);
cy.get('#TestFileStoreConnection').scrollIntoView().should('be.visible').within(() => {
cy.findByText('Test Connection').should('be.visible').click().wait(TIMEOUTS.ONE_SEC);
waitForAlert('Connection unsuccessful: Unable to authenticate against the file storage backend. Verify your credentials and authentication settings.');
});
});
it('MM-T963 - Configuration - Purge caches', () => {
cy.visit('/admin_console/environment/web_server');
// # Find the purge all caches button on the page and click it
cy.get('#PurgeButton').scrollIntoView().should('be.visible').within(() => {
cy.findByText('Purge All Caches').should('be.visible').click().wait(TIMEOUTS.ONE_SEC);
});
// # Reload the page
cy.reload();
// * Verify app continues to run successfully by querying for the header
cy.get('.admin-console', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').within(() => {
cy.get('.admin-console__header').should('be.visible').and('have.text', 'Web Server');
});
});
function waitForAlert(message) {
cy.waitUntil(() => cy.get('.alert').scrollIntoView().should('be.visible').then((alert) => {
return alert[0].innerText === message;
}));
}
});