PromucFlow_constructor/app/client/cypress/support/Pages/AdminSettings.ts
Aishwarya-U-R 67d20d9858
test: Cypress | Helpers improved + Flaky fixes (#30735)
## Description
- This PR fixes the RenameApplication flakyness in CI with added dynamic
check
- Also replacing js cy.renameApp to TS helper 
- Flaky fixes -
cypress/e2e/Regression/ClientSide/Workspace/MemberRoles_Spec.ts (entire
spec updates for EnableGAC, removed signout from 'it' blocks)
- cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (7th
flaky fixed)
-
cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
(5th test)
-
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_Existing_app_spec.js
(2nd - added validation to match the test description, 1st & 3rd -
removed static waits, Added multiple dynamic checks)
-
cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApplicationURL_spec.js
(3rd & 4th flaky tests)
- homePage.AssertViewPageLoad() created
- homePage.LaunchAppFromAppHover() improved
- homePage.Signout() - added dynamic checks
- Added more validation to homePage.Signup() method with Dynamic checks
- homePage.LeaveWorkspace() removed redundant SelectWorkspace call
- admingSettings.EnableGAC() - added dynamic checks
- featureFlagIntercept - removed static sleep, reload check improved
- agHelper.VisitNAssert() - removed static sleep
- homePage.OpenMembersPageForWorkspace() - removed sleep, added dynamic
checks

#### Type of change
- Script fix (non-breaking change which fixes an issue)

## Testing
#### How Has This Been Tested?
- [X] Cypress CI runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed

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

## Summary by CodeRabbit

- **Refactor**
- Enhanced Cypress test commands across multiple test suites for
improved efficiency and readability.
- Refactored conditional checks and method invocations for better test
scenario handling.
- **Tests**
- Updated testing approaches for application deployment, workspace
management, and error handling.
- Introduced new assertions for UI visibility and functional behavior in
automated tests.
- **Chores**
- Optimized GitHub Actions workflow by adjusting the matrix count for
build processes.
- Added new test specs for limited tests in the client-side regression
suite.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-01 16:42:53 +05:30

59 lines
2.2 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";
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 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 });
}
}