mattermost-mobile-upstream/detox/provision/index.ts
yasser khan ebc91be6e0
E2E: run shared channels tests on CI, demo plugin v0.12.2 on all full-suite servers (#10267)
* E2E: run the shared channels tests on CI instead of skipping them

CI servers now boot with Shared Channels running (matterwick#106), so the suite runs there and fails setup if the service is missing.

* E2E: run demo plugin v0.12.2 in DialogOnlyMode

Moves the demo plugin to v0.12.2 and writes DialogOnlyMode: true into its settings entry before it is installed on server B, so it no longer creates a demo user and channels or posts in every team on every server event. Only /dialog is kept, which is all the dialog specs use. The entry still keeps an older build on a reused server out of config saves.

* E2E: give a neutral reason when Shared Channels is unavailable

hasSharedChannels is false both when the license lacks Shared Channels and when GET /remotecluster fails; point to the globalSetup log line that names the actual reason.

* E2E: run the read-only dialog specs on the pool servers

With demo plugin v0.12.2 in DialogOnlyMode it no longer posts in every team, so it is installed on every full-suite server (pool A and mutation B) instead of B only. interactive_dialog_plugin and interactive_dialog_collapsible change no server-wide state, so they leave the mutation manifest and run on the pool. interactive_dialog_mobile_upload_disabled stays on B. The shared SITE_3 and smoke servers still get no demo plugin, and CMT still rejects a site 2 that is also a pool site 1.

* E2E: remove unused demo plugin helpers

apiUploadAndEnablePlugin and apiClearDemoPluginFileUploadKV had no callers (the KV route does not exist). Provisioning installs the plugin, so the install plan they used goes too.

* fix(e2e): say why a spec has no result (#10280)

* chore: Update NOTICE.txt file with updated dependencies (#10277)

Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>

* fix(e2e): say whether a spec with no result had a silent shard or a stopped one

A spec that produced no result now says which: no spec of its shard reported
(the shard ran or uploaded nothing), or other specs of its shard reported (its
Jest process stopped before reaching this spec). E2E triage re-runs the first
and judges the second by the spec's own history. The shard of each spec comes
from the generate-specs matrix rows; without them the old wording stays.

---------

Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>
2026-10-27 11:42:07 +05:30

44 lines
1.6 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/**
* Provisions a Mattermost test server for E2E tests.
*
* Usage: npx tsx provision/index.ts <server_url> [--demo-plugin | --no-demo-plugin]
*
* The demo plugin is installed by default; CI passes --no-demo-plugin for the shared SITE_3 and smoke-only servers.
*
* Environment variables:
* ADMIN_USERNAME / ADMIN_PASSWORD - admin credentials (required)
* AGENTS_PLUGIN_DOWNLOAD_URL - optional override for mattermost-ai install URL
*/
import {readCredentialsFromEnv} from './env';
import {logError} from './log';
import {provisionServer} from './provision';
import {validateServerUrl} from './validate-url';
const USAGE = 'Usage: npx tsx provision/index.ts <server_url> [--demo-plugin | --no-demo-plugin]';
const DEMO_PLUGIN_FLAGS = ['--demo-plugin', '--no-demo-plugin'];
const args = process.argv.slice(2);
const serverUrl = args.find((arg) => !arg.startsWith('--'));
const demoFlags = args.filter((arg) => DEMO_PLUGIN_FLAGS.includes(arg));
const unknownFlags = args.filter((arg) => arg.startsWith('--') && !DEMO_PLUGIN_FLAGS.includes(arg));
if (!serverUrl || unknownFlags.length > 0 || demoFlags.length > 1) {
logError(USAGE);
process.exit(1);
}
validateServerUrl(serverUrl);
const credentials = readCredentialsFromEnv();
// Without a flag the demo plugin is installed, as local runs always did.
const demoPlugin = demoFlags.length === 0 || demoFlags[0] === '--demo-plugin';
provisionServer(serverUrl, credentials, {demoPlugin}).catch((err: Error) => {
logError(`Fatal error: ${err.message}`);
process.exit(1);
});