snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
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

This commit is contained in:
upstream-mirror
2026-09-16 00:29:55 +05:00
commit 240db4e2a7
15309 changed files with 2173406 additions and 0 deletions

View File

@@ -0,0 +1,216 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import * as TIMEOUTS from '../../fixtures/timeouts';
// *****************************************************************************
// Plugins
// https://api.mattermost.com/#tag/plugins
// *****************************************************************************
Cypress.Commands.add('apiGetAllPlugins', () => {
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: '/api/v4/plugins',
method: 'GET',
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.equal(200);
return cy.wrap({plugins: response.body});
});
});
function getPlugin(plugins, pluginId, version) {
return Cypress._.find(plugins, (plugin) => {
return version ? plugin.id === pluginId && plugin.version === version : plugin.id === pluginId;
});
}
Cypress.Commands.add('apiGetPluginStatus', (pluginId, version) => {
return cy.apiGetAllPlugins().then(({plugins}) => {
const active = getPlugin(plugins.active, pluginId, version);
const inactive = getPlugin(plugins.inactive, pluginId, version);
if (active) {
return cy.wrap({isInstalled: true, isActive: true});
}
if (inactive) {
return cy.wrap({isInstalled: true, isActive: false});
}
return cy.wrap({isInstalled: false, isActive: false});
});
});
Cypress.Commands.add('apiUploadPlugin', (filename) => {
const options = {
url: '/api/v4/plugins',
method: 'POST',
successStatus: 201,
};
return cy.apiUploadFile('plugin', filename, options).then(() => {
return cy.wait(TIMEOUTS.THREE_SEC);
});
});
Cypress.Commands.add('apiUploadAndEnablePlugin', ({filename, url, id, version}) => {
return cy.apiGetPluginStatus(id, version).then((data) => {
// # Only short-circuit when version is specified, so we know the exact
// installed version matches the desired artifact. Without a version,
// any installed version would match and we'd silently skip the install.
if (version && data.isActive) {
cy.log(`${id}: Plugin is active.`);
return cy.wrap(data);
}
if (version && data.isInstalled) {
cy.log(`${id}: Plugin is inactive. Only going to enable.`);
return cy.apiEnablePluginById(id).then(() => {
cy.wait(TIMEOUTS.ONE_SEC);
return cy.wrap(data);
});
}
// # Remove any old version of the plugin before installing the new one
const removeOldVersion = () => {
return cy.apiGetPluginStatus(id).then((anyVersionData) => {
if (anyVersionData.isInstalled || anyVersionData.isActive) {
cy.log(`${id}: Removing old version before installing new one.`);
return cy.apiRemovePluginById(id);
}
return cy.wrap(null);
});
};
if (url) {
// # Upload plugin by URL then enable
cy.log(`${id}: Plugin is to be uploaded via URL and then enable.`);
return removeOldVersion().then(() => {
return cy.apiInstallPluginFromUrl(url).then(() => {
cy.wait(TIMEOUTS.FIVE_SEC);
return cy.apiEnablePluginById(id).then(() => {
cy.wait(TIMEOUTS.ONE_SEC);
return cy.wrap({isInstalled: true, isActive: true});
});
});
});
}
// # Upload plugin by file then enable
cy.log(`${id}: Plugin is to be uploaded by filename and then enable.`);
return removeOldVersion().then(() => {
return cy.apiUploadPlugin(filename).then(() => {
return cy.apiEnablePluginById(id).then(() => {
return cy.wrap({isInstalled: true, isActive: true});
});
});
});
});
});
Cypress.Commands.add('apiInstallPluginFromUrl', (url, force = true) => {
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: `/api/v4/plugins/install_from_url?plugin_download_url=${encodeURIComponent(url)}&force=${force}`,
method: 'POST',
timeout: TIMEOUTS.TWO_MIN,
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.equal(201);
cy.wait(TIMEOUTS.THREE_SEC);
return cy.wrap({plugin: response.body});
});
});
Cypress.Commands.add('apiEnablePluginById', (pluginId) => {
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: `/api/v4/plugins/${encodeURIComponent(pluginId)}/enable`,
method: 'POST',
timeout: TIMEOUTS.TWO_MIN,
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.equal(200);
return cy.wrap(response);
});
});
Cypress.Commands.add('apiDisablePluginById', (pluginId) => {
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: `/api/v4/plugins/${encodeURIComponent(pluginId)}/disable`,
method: 'POST',
timeout: TIMEOUTS.ONE_MIN,
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.equal(200);
return cy.wrap(response);
});
});
const prepackagedPlugins = [
'antivirus',
'mattermost-autolink',
'com.mattermost.aws-sns',
'com.mattermost.plugin-channel-export',
'com.mattermost.custom-attributes',
'github',
'com.github.manland.mattermost-plugin-gitlab',
'com.mattermost.plugin-incident-management',
'jenkins',
'jira',
'com.mattermost.nps',
'com.mattermost.welcomebot',
'zoom',
'playbooks',
];
Cypress.Commands.add('apiDisableNonPrepackagedPlugins', () => {
cy.apiGetAllPlugins().then(({plugins}) => {
plugins.active.forEach((plugin) => {
if (!prepackagedPlugins.includes(plugin.id)) {
cy.apiDisablePluginById(plugin.id);
}
});
});
});
Cypress.Commands.add('apiRemovePluginById', (pluginId) => {
return cy.request({
headers: {'X-Requested-With': 'XMLHttpRequest'},
url: `/api/v4/plugins/${encodeURIComponent(pluginId)}`,
method: 'DELETE',
timeout: TIMEOUTS.TWO_MIN,
failOnStatusCode: false,
}).then((response) => {
return cy.wrap(response);
});
});
Cypress.Commands.add('apiUninstallAllPlugins', () => {
// # Uninstall all plugins
cy.apiGetAllPlugins().then(({plugins}) => {
const {active, inactive} = plugins;
inactive.forEach((plugin) => cy.apiRemovePluginById(plugin.id));
active.forEach((plugin) => cy.apiRemovePluginById(plugin.id));
});
// * Check that all plugins are uninstalled
cy.apiGetAllPlugins().then(({plugins}) => {
const {active, inactive} = plugins;
// # Log all uninstalled plugins for debugging
if (active.length) {
cy.log(JSON.stringify(active));
}
if (inactive.length) {
cy.log(JSON.stringify(active));
}
expect(active.length).to.equal(0);
expect(inactive.length).to.equal(0);
});
});