PromucFlow_constructor/app/client/cypress/support/Pages/AdminSettings.ts
Ankita Kinger 2f738ed360
chore: Make edit launch buttons as links & add upgrade ramps for session timeout setting (#31862)
## Description

- Make edit launch buttons as links for better user experience
- Add upgrade ramps for session timeout setting

Fixes [#29829](https://github.com/appsmithorg/appsmith/issues/29829)
[#31724](https://github.com/appsmithorg/appsmith/issues/31724)

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]  
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8370510386>
> Commit: `b45ae17a5f28fe4706a69cc0dd141e5bb5e8b225`
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8370510386&attempt=2"
target="_blank">Click here!</a>
> All cypress tests have passed 🎉🎉🎉

<!-- end of auto-generated comment: Cypress test results  -->

































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

- **New Features**
- Introduced a session timeout setting for user sessions, enhancing
security and compliance.
- Improved admin settings interface with additional configuration
options for session management.
- **Enhancements**
- Streamlined navigation within the application by removing reliance on
default page IDs.
- Enhanced input fields in admin settings with support for default
values and custom formats.
- **Style Updates**
- Updated styling for labels, icons, and text inputs in the admin
settings for better user experience.
- **Tests**
- Expanded Cypress test coverage for admin settings, including checks
for business and enterprise settings, authentication, branding, and
navigation.
- **Refactor**
- Simplified code by renaming constants and updating component
properties for clarity and maintainability.
- **Chores**
- Updated Cypress configuration and support files for improved test
automation practices.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-21 15:37:13 +05:30

78 lines
2.9 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 rolesTab = ".t--settings-category-roles";
public auditLogsTab = ".t--settings-category-audit-logs";
public routes = {
APPLICATIONS: "/applications",
SETTINGS: "/settings",
GENERAL: "/settings/general",
EMAIL: "/settings/email",
DEVELOPER_SETTINGS: "/settings/developer-settings",
AUTHENTICATION: "/settings/authentication",
GOOGLEAUTH: "/settings/authentication/google-auth",
GITHUBAUTH: "/settings/authentication/github-auth",
FORMLOGIN: "/settings/authentication/form-login",
ADVANCED: "/settings/advanced",
VERSION: "/settings/version",
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 });
}
}