mattermost-mobile-upstream/detox/e2e/support/classification_test_helper.ts
yasserfaraazkhan 332f7caa0b fix(e2e): stabilize campaign flows and app selectors
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 14:27:02 +05:30

51 lines
1.8 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import System from '@support/server_api/system';
import {timeouts} from '@support/utils';
export const enableClassificationMarkings = async (baseUrl: string): Promise<void> => {
const patchResult = await System.apiPatchConfig(baseUrl, {
FeatureFlags: {
ClassificationMarkings: true,
},
});
if (patchResult.error) {
throw new Error(`enableClassificationMarkings: failed to patch server config: ${JSON.stringify(patchResult.error)}`);
}
let enabled = await System.waitForClientConfigFlag(
baseUrl,
'FeatureFlagClassificationMarkings',
'true',
{maxAttempts: 60, pollMs: timeouts.ONE_SEC},
);
if (!enabled) {
const {config, error} = await System.apiGetConfig(baseUrl);
if (error || !config) {
throw new Error(`enableClassificationMarkings: failed to read server config: ${JSON.stringify(error)}`);
}
config.FeatureFlags = config.FeatureFlags || {};
config.FeatureFlags.ClassificationMarkings = true;
const replaceResult = await System.apiReplaceConfig(baseUrl, config);
if (replaceResult.error) {
throw new Error(`enableClassificationMarkings: failed to replace server config: ${JSON.stringify(replaceResult.error)}`);
}
enabled = await System.waitForClientConfigFlag(
baseUrl,
'FeatureFlagClassificationMarkings',
'true',
{maxAttempts: 60, pollMs: timeouts.ONE_SEC},
);
}
if (!enabled) {
throw new Error(
'enableClassificationMarkings: FeatureFlagClassificationMarkings did not become true; ' +
'the server license or server configuration may block this feature flag',
);
}
};