PromucFlow_constructor/app/client/cypress/support/Objects/FeatureFlags.ts
Aman Agarwal 56e7f89402
chore: removed old flags for airgap instances (#36609)
## Description
Removed all the occurrences of listed flags in the codebase:

1. ab_ds_binding_enabled
2. ab_ds_schema_enabled
3. ab_gsheet_schema_enabled
4. ab_learnability_discoverability_collapse_all_except_data_enabled
5. ab_learnability_ease_of_initial_use_enabled
6. ab_mock_mongo_schema_enabled
7. ab_start_with_data_default_enabled
8. rollout_js_enabled_one_click_binding_enabled


Fixes #36256
_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.All"

### 🔍 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/11177173738>
> Commit: bfbf6bbe77b963c5d257c29cf5bac35139417a07
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11177173738&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 04 Oct 2024 10:31:10 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

## Summary by CodeRabbit

- **New Features**
- Enhanced test coverage for the Community Issues page, focusing on
pagination, search, filtering, and issue management.
- Improved functionality for adding new rows to table widgets, including
visibility controls and state validations.

- **Bug Fixes**
- Resolved issues related to the visibility of UI elements when adding
new rows and ensured accurate data reflection in the table.

- **Tests**
- Expanded tests for pagination, row selection, search functionality,
and filtering logic in table widgets.
- Added comprehensive assertions for client-side search and filtering
scenarios, including checks for modal visibility during issue
management.

- **Chores**
- Removed obsolete feature flags and streamlined logic for managing
feature flags across components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-07 15:26:25 +05:30

110 lines
3.1 KiB
TypeScript

import { LICENSE_FEATURE_FLAGS } from "../Constants";
import { ObjectsRegistry } from "./Registry";
import produce from "immer";
const defaultFlags = {
release_side_by_side_ide_enabled: true,
rollout_remove_feature_walkthrough_enabled: false, // remove this flag from here when it's removed from code
};
export const featureFlagIntercept = (
flags: Record<string, boolean> = {},
reload = true,
) => {
getConsolidatedDataApi({ ...flags, ...defaultFlags }, false);
const response = {
responseMeta: {
status: 200,
success: true,
},
data: {
...flags,
...defaultFlags,
},
errorDisplay: "",
};
cy.intercept("GET", "/api/v1/users/features", response);
if (reload) ObjectsRegistry.AggregateHelper.CypressReload();
};
export const getConsolidatedDataApi = (
flags: Record<string, boolean> = {},
reload = true,
) => {
cy.intercept("GET", "/api/v1/consolidated-api/*?*", (req) => {
req.reply((res: any) => {
if (
res.statusCode === 200 ||
res.statusCode === 401 ||
res.statusCode === 500
) {
const originalResponse = res?.body;
const updatedResponse = produce(originalResponse, (draft: any) => {
draft.data.featureFlags.data = {
...flags,
};
});
return res.send(updatedResponse);
}
});
}).as("getConsolidatedData");
if (reload) ObjectsRegistry.AggregateHelper.CypressReload();
};
export const featureFlagInterceptForLicenseFlags = () => {
cy.intercept(
{
method: "GET",
url: "/api/v1/users/features",
},
(req) => {
req.reply((res) => {
if (res) {
const originalResponse = res.body;
let modifiedResponse: any = {};
Object.keys(originalResponse.data).forEach((flag) => {
if (LICENSE_FEATURE_FLAGS.includes(flag)) {
modifiedResponse[flag] = originalResponse.data[flag];
}
});
modifiedResponse = {
...modifiedResponse,
release_app_sidebar_enabled: true,
};
res.send({
responseMeta: {
status: 200,
success: true,
},
data: { ...modifiedResponse },
errorDisplay: "",
});
}
});
},
).as("getLicenseFeatures");
cy.intercept("GET", "/api/v1/consolidated-api/*?*", (req) => {
req.reply((res: any) => {
if (res.statusCode === 200) {
const originalResponse = res?.body;
const updatedResponse = produce(originalResponse, (draft: any) => {
draft.data.featureFlags.data = {};
Object.keys(originalResponse.data.featureFlags.data).forEach(
(flag) => {
if (LICENSE_FEATURE_FLAGS.includes(flag)) {
draft.data.featureFlags.data[flag] =
originalResponse.data.featureFlags.data[flag];
}
},
);
draft.data.featureFlags.data["release_app_sidebar_enabled"] = true;
});
return res.send(updatedResponse);
}
});
}).as("getConsolidatedData");
ObjectsRegistry.AggregateHelper.CypressReload();
};