* Add license load metric to About screen - Add REST endpoint to fetch license load percentage - Display load metric in About screen next to server version Fixes: https://mattermost.atlassian.net/browse/MM-63728 * MM-63728: Address PR feedback from enahum - Move license load metric fetch to a remote action - Use isMinimumServerVersion to check for server 10.8.0 or higher 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Simplify getLicenseLoadMetric to directly return number 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Move getLicenseLoadMetric to dedicated license.ts file - Create new remote action file specifically for license-related functions - Add test file for the license actions - Update imports in about.tsx 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Remove redundant license check in about.tsx - Rely on getLicenseLoadMetric to handle the license check 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Update E2E tests for license load metric - Add license load metric test IDs to about screen - Update E2E test to check for load metric when license is enabled - Handle cases where server might not support the feature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * recover app/actions/remote/general.ts * MM-63728: Return error from getLicenseLoadMetric instead of silent failure - Remove silent failure and debug logging - Return the error object when API call fails - Update the About component to handle possible error responses - Update tests to verify error handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Remove groupLabel parameter from getLicenseLoadMetric - Remove groupLabel parameter from client getLicenseLoadMetric method in interface and implementation - Update client tests to reflect the parameter removal - Update license action test to verify no parameter is passed 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * simplify about screen checks * MM-63728: Use jest.mocked and real version checks in license tests - Removed isMinimumServerVersion mock, letting tests use real version checking - Used proper type casting for mock Client - Added comprehensive version compatibility test cases - Simplified test setup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Remove redundant server version test - Removed redundant test for different server versions - Existing tests already cover the necessary version compatibility cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * MM-63728: Refactor license test to use better mocking pattern - Refactored the test file to use a better mocking pattern similar to custom_emoji.test.ts - Simplified mock declarations using jest.mock() - Added type import for Client for better readability - Improved type casting for mock objects 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * npm run fix --------- Co-authored-by: Claude <noreply@anthropic.com>
97 lines
4.3 KiB
TypeScript
97 lines
4.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {SettingsScreen} from '@support/ui/screen';
|
|
import {timeouts} from '@support/utils';
|
|
import {expect} from 'detox';
|
|
|
|
class AboutScreen {
|
|
testID = {
|
|
aboutScreen: 'about.screen',
|
|
backButton: 'screen.back.button',
|
|
scrollView: 'about.scroll_view',
|
|
logo: 'about.logo',
|
|
siteName: 'about.site_name',
|
|
title: 'about.title',
|
|
subtitle: 'about.subtitle',
|
|
appVersionTitle: 'about.app_version.title',
|
|
appVersionValue: 'about.app_version.value',
|
|
serverVersionTitle: 'about.server_version.title',
|
|
serverVersionValue: 'about.server_version.value',
|
|
licenseLoadMetricTitle: 'about.license_load_metric.title',
|
|
licenseLoadMetricValue: 'about.license_load_metric.value',
|
|
databaseTitle: 'about.database.title',
|
|
databaseValue: 'about.database.value',
|
|
databaseSchemaVersionTitle: 'about.database_schema_version.title',
|
|
databaseSchemaVersionValue: 'about.database_schema_version.value',
|
|
copInfoButton: 'about.copy_info',
|
|
licensee: 'about.licensee',
|
|
learnMoreText: 'about.learn_more.text',
|
|
learnMoreUrl: 'about.learn_more.url',
|
|
poweredBy: 'about.powered_by',
|
|
copyright: 'about.copyright',
|
|
termsOfService: 'about.terms_of_service',
|
|
privacyPolicy: 'about.privacy_policy',
|
|
noticeText: 'about.notice_text',
|
|
buildHashTitle: 'about.build_hash.title',
|
|
buildHashValue: 'about.build_hash.value',
|
|
buildHashEnterpriseTitle: 'about.build_hash_enterprise.title',
|
|
buildHashEnterpriseValue: 'about.build_hash_enterprise.value',
|
|
buildDateTitle: 'about.build_date.title',
|
|
buildDateValue: 'about.build_date.value',
|
|
};
|
|
|
|
aboutScreen = element(by.id(this.testID.aboutScreen));
|
|
backButton = element(by.id(this.testID.backButton));
|
|
scrollView = element(by.id(this.testID.scrollView));
|
|
logo = element(by.id(this.testID.logo));
|
|
siteName = element(by.id(this.testID.siteName));
|
|
title = element(by.id(this.testID.title));
|
|
subtitle = element(by.id(this.testID.subtitle));
|
|
appVersionTitle = element(by.id(this.testID.appVersionTitle));
|
|
appVersionValue = element(by.id(this.testID.appVersionValue));
|
|
serverVersionTitle = element(by.id(this.testID.serverVersionTitle));
|
|
serverVersionValue = element(by.id(this.testID.serverVersionValue));
|
|
licenseLoadMetricTitle = element(by.id(this.testID.licenseLoadMetricTitle));
|
|
licenseLoadMetricValue = element(by.id(this.testID.licenseLoadMetricValue));
|
|
databaseTitle = element(by.id(this.testID.databaseTitle));
|
|
databaseValue = element(by.id(this.testID.databaseValue));
|
|
copyInfoButton = element(by.id(this.testID.copInfoButton));
|
|
databaseSchemaVersionTitle = element(by.id(this.testID.databaseSchemaVersionTitle));
|
|
databaseSchemaVersionValue = element(by.id(this.testID.databaseSchemaVersionValue));
|
|
licensee = element(by.id(this.testID.licensee));
|
|
learnMoreText = element(by.id(this.testID.learnMoreText));
|
|
learnMoreUrl = element(by.id(this.testID.learnMoreUrl));
|
|
poweredBy = element(by.id(this.testID.poweredBy));
|
|
copyright = element(by.id(this.testID.copyright));
|
|
termsOfService = element(by.id(this.testID.termsOfService));
|
|
privacyPolicy = element(by.id(this.testID.privacyPolicy));
|
|
noticeText = element(by.id(this.testID.noticeText));
|
|
buildHashTitle = element(by.id(this.testID.buildHashTitle));
|
|
buildHashValue = element(by.id(this.testID.buildHashValue));
|
|
buildHashEnterpriseTitle = element(by.id(this.testID.buildHashEnterpriseTitle));
|
|
buildHashEnterpriseValue = element(by.id(this.testID.buildHashEnterpriseValue));
|
|
buildDateTitle = element(by.id(this.testID.buildDateTitle));
|
|
buildDateValue = element(by.id(this.testID.buildDateValue));
|
|
|
|
toBeVisible = async () => {
|
|
await waitFor(this.aboutScreen).toExist().withTimeout(timeouts.TEN_SEC);
|
|
|
|
return this.aboutScreen;
|
|
};
|
|
|
|
open = async () => {
|
|
// # Open about screen
|
|
await SettingsScreen.aboutOption.tap();
|
|
|
|
return this.toBeVisible();
|
|
};
|
|
|
|
back = async () => {
|
|
await this.backButton.tap();
|
|
await expect(this.aboutScreen).not.toBeVisible();
|
|
};
|
|
}
|
|
|
|
const aboutScreen = new AboutScreen();
|
|
export default aboutScreen;
|