PromucFlow_constructor/app/client/cypress/support/Pages/AdminSettings.ts
Ankita Kinger e9cca6a56f
feat: Updating admin settings page as per new designs (#40101)
## Description

Updating admin settings page as per new designs:

https://www.figma.com/design/XouAwUQJKF2lf57bQvNM1e/Cloud-Billing-(-Phase-1-)?node-id=15907-10916&m=dev


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Settings"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14302998753>
> Commit: 259bdc292d08fd3f6cc4ffb2fce833b71c123d2e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14302998753&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Settings`
> Spec:
> <hr>Mon, 07 Apr 2025 07:33:30 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced an updated profile page for managing account details and
profile images.
- Expanded and restructured the Admin Settings with clear sections like
Instance Settings, Configuration, User Management, Branding, and
Profile.
  - Added new icons that enhance the visual experience.
- Implemented a new styled component for conditional rendering of links
in settings.
  - Added user settings for session management and Git configuration.
- Enhanced test cases for Admin Settings to ensure proper navigation and
functionality.
- Introduced a new configuration for instance settings, allowing for
detailed management options.
- Added a new configuration for profile settings, enhancing user
management capabilities.
- Introduced a new configuration for email settings, reflecting
organizational needs.

- **Bug Fixes**
- Revised the save button text to “Save Changes” and refined success
notifications.

- **Refactor**
- Streamlined routing and configuration for a more intuitive and
consistent Admin Settings experience.
- Updated category management logic in the LeftPane component to focus
on user management and organizational categories.
- Modified the filtering logic in admin settings helpers for improved
clarity and functionality.
- Enhanced the overall structure of test cases for better organization
and clarity.

- **Style**
  - Updated header and layout styling for improved visual consistency.
  - Enhanced the visual presentation of the SettingsSubHeader component.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-04-07 15:44:20 +05:30

81 lines
3.1 KiB
TypeScript

import { ObjectsRegistry } from "../Objects/Registry";
import { featureFlagIntercept } from "../Objects/FeatureFlags";
export class AdminSettings {
public agHelper = ObjectsRegistry.AggregateHelper;
public locator = ObjectsRegistry.CommonLocators;
public homePage = ObjectsRegistry.HomePage;
public assertHelper = ObjectsRegistry.AssertHelper;
public _adminSettingsBtn = ".admin-settings-menu-option";
public _saveButton = ".t--admin-settings-save-button";
private _settingsList = ".t--settings-category-list";
public _usersTab = ".t--settings-category-users";
public _roles = (user: string) =>
"//span[contains(text(), '" +
user +
"')]/parent::div/parent::span/parent::a/parent::td/following-sibling::td[1]";
public _instanceName = '[name="instanceName"]';
public _googleMapsAPIField = '[name="googleMapsKey"]';
public rolesTab = ".t--settings-category-roles";
public auditLogsTab = ".t--settings-category-audit-logs";
public routes = {
APPLICATIONS: "/applications",
SETTINGS: "/settings",
PROFILE: "/settings/profile",
GENERAL: "/settings/general",
EMAIL: "/settings/email",
USER_SETTINGS: "/settings/user-settings",
INSTANCE_SETTINGS: "/settings/instance-settings",
CONFIGURATION: "/settings/configuration",
VERSION: "/settings/version",
AUTHENTICATION: "/settings/authentication",
GOOGLEAUTH: "/settings/authentication/google-auth",
GITHUBAUTH: "/settings/authentication/github-auth",
FORMLOGIN: "/settings/authentication/form-login",
BRANDING: "/settings/branding",
ACCESS_CONTROL: "/settings/access-control",
AUDIT_LOGS: "/settings/audit-logs",
PROVISIONING: "/settings/provisioning",
};
public NavigateToAdminSettings(toNavigateToHome = true) {
toNavigateToHome && this.homePage.NavigateToHome();
this.agHelper.AssertElementVisibility(this._adminSettingsBtn);
this.agHelper.GetNClick(this._adminSettingsBtn);
this.assertHelper.AssertNetworkStatus("getEnvVariables");
this.agHelper.AssertElementVisibility(this._settingsList);
}
public EnableGAC(
toNavigateToHome = true,
toNavigateBackToHome = true,
methodType: "adminSettings" | "home" = "adminSettings",
) {
switch (methodType) {
case "adminSettings":
this.NavigateToAdminSettings(toNavigateToHome);
this.enableGACFeatureFlag();
this.assertHelper.AssertDocumentReady();
this.agHelper.WaitUntilEleAppear(this.rolesTab);
this.agHelper.AssertElementExist(this.rolesTab);
this.agHelper.AssertElementVisibility(this.rolesTab);
toNavigateBackToHome && this.homePage.NavigateToHome();
break;
case "home":
toNavigateToHome && this.homePage.NavigateToHome();
this.enableGACFeatureFlag();
this.assertHelper.AssertDocumentReady();
this.agHelper.AssertElementExist(this.homePage._homePageContainer);
this.agHelper.AssertElementVisibility(this.homePage._homePageContainer);
break;
default:
break;
}
}
private enableGACFeatureFlag() {
featureFlagIntercept({ license_gac_enabled: true });
}
}