## 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 -->
117 lines
3.5 KiB
TypeScript
117 lines
3.5 KiB
TypeScript
import { LICENSE_FEATURE_FLAGS } from "../Constants";
|
|
import produce from "immer";
|
|
export const featureFlagIntercept = (
|
|
flags: Record<string, boolean> = {},
|
|
reload = true,
|
|
) => {
|
|
const response = {
|
|
responseMeta: {
|
|
status: 200,
|
|
success: true,
|
|
},
|
|
data: {
|
|
...flags,
|
|
release_app_sidebar_enabled: true,
|
|
release_show_new_sidebar_pages_pane_enabled: true,
|
|
rollout_consolidated_page_load_fetch_enabled: true,
|
|
},
|
|
errorDisplay: "",
|
|
};
|
|
cy.intercept("GET", "/api/v1/users/features", response);
|
|
|
|
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 = { ...flags };
|
|
draft.data.featureFlags.data["release_app_sidebar_enabled"] = true;
|
|
draft.data.featureFlags.data[
|
|
"release_show_new_sidebar_pages_pane_enabled"
|
|
] = true;
|
|
draft.data.featureFlags.data[
|
|
"rollout_consolidated_page_load_fetch_enabled"
|
|
] = true;
|
|
});
|
|
return res.send(updatedResponse);
|
|
}
|
|
});
|
|
}).as("getConsolidatedData");
|
|
|
|
if (reload) {
|
|
cy.reload();
|
|
cy.waitUntil(() =>
|
|
cy.document().should((doc) => {
|
|
expect(doc.readyState).to.equal("complete");
|
|
}),
|
|
);
|
|
cy.waitUntil(() =>
|
|
cy
|
|
.window({ timeout: Cypress.config().pageLoadTimeout })
|
|
.then((win) => expect(win).haveOwnProperty("onload")),
|
|
);
|
|
}
|
|
};
|
|
|
|
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,
|
|
rollout_consolidated_page_load_fetch_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;
|
|
draft.data.featureFlags.data[
|
|
"rollout_consolidated_page_load_fetch_enabled"
|
|
] = true;
|
|
});
|
|
return res.send(updatedResponse);
|
|
}
|
|
});
|
|
}).as("getConsolidatedData");
|
|
|
|
cy.reload();
|
|
cy.wait(2000); //for the page to re-load finish for CI runs
|
|
};
|