mattermost-mobile-upstream/detox/provision/plugins.test.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

60 lines
2.7 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';
import {DEMO_PLUGIN_REQUIREMENT, REQUIRED_PLUGINS} from './constants';
import {demoPluginSettingsPatch, demoPluginViolation, strayPluginIds} from './plugins';
describe('strayPluginIds', () => {
it('should keep prepackaged and provisioned plugins and return the rest', () => {
const active = [
{id: 'com.mattermost.calls'},
{id: 'com.mattermost.demo-plugin'},
{id: 'mattermost-ai'},
{id: 'zoom'},
{id: 'com.example.leftover'},
];
assert.deepEqual(strayPluginIds(active, [...REQUIRED_PLUGINS, DEMO_PLUGIN_REQUIREMENT]), ['com.example.leftover']);
});
it('should report the demo plugin as stray on a server it is not provisioned for', () => {
const active = [{id: 'com.mattermost.demo-plugin'}, {id: 'com.example.leftover'}];
assert.deepEqual(strayPluginIds(active, REQUIRED_PLUGINS), ['com.mattermost.demo-plugin', 'com.example.leftover']);
});
});
describe('demoPluginViolation', () => {
const active = [{id: 'com.mattermost.calls'}, {id: 'com.mattermost.demo-plugin'}];
it('should flag an active demo plugin on a server provisioned without it', () => {
assert.match(demoPluginViolation(active, false) ?? '', /com\.mattermost\.demo-plugin is active on a server provisioned without it/);
});
it('should allow the demo plugin when it was requested, or when it is not active', () => {
assert.equal(demoPluginViolation(active, true), undefined);
assert.equal(demoPluginViolation([{id: 'com.mattermost.calls'}], false), undefined);
assert.equal(demoPluginViolation(undefined, false), undefined);
});
});
describe('demoPluginSettingsPatch', () => {
it('should turn DialogOnlyMode on for a missing or empty entry', () => {
assert.deepEqual(demoPluginSettingsPatch({}), {DialogOnlyMode: true});
});
it('should keep other settings and replace any spelling of DialogOnlyMode', () => {
assert.deepEqual(demoPluginSettingsPatch({username: 'demo', dialogonlymode: false}), {username: 'demo', DialogOnlyMode: true});
});
it('should leave an entry that already has DialogOnlyMode on', () => {
assert.equal(demoPluginSettingsPatch({DialogOnlyMode: true}), null);
assert.equal(demoPluginSettingsPatch({dialogonlymode: true, username: 'demo'}), null);
});
it('should not treat a string "true" as on', () => {
assert.deepEqual(demoPluginSettingsPatch({dialogonlymode: 'true'}), {DialogOnlyMode: true});
});
});