## Description
- **This PR flaky fixes below specs:**
- GenerateCRUD/MySQL2_Spec.ts script fix
- ServerSide/ApiTests/API_All_Verb_spec.js
- Regression/Apps/PromisesApp_spec.js
- TableV2_Property_ToggleJs_With_Binding_spec.js
- GSheet cases failures due to EditApponHover method fix
- Radio/Radio2_spec.ts, using `GetHeight` instead of
`GetWidgetCSSHeight`
- Select/Select3_Spec.ts
- Widgets/Text/Text_new_feature_spec.js
- Binding/API_with_List_Widget_spec.js
- Workspace/LoginFromUIApp_spec.js - removed redundant code
- QueryPane/DSDocs_Spec.ts
- ServerSide/QueryPane/GoogleSheets_spec.ts
- TableV2/Date_column_editing_1_spec.ts
- Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts - script flow
corrected
- ServerSide/QueryPane/Mongo_Spec.js
- **Added validation for form plugin response data, which addresses the
Empty toast issue**
- **Below specs are fixed for new appName localStorage changes:**
- /SettingsPane/PageSettings_spec.ts
- BugTests/Moment_Spec.ts
- /Fork/ForkAppWithMultipleDS_Spec.ts
- Fork/ForkApplicationWithinAppEditor_spec.ts
- Fork/ForkApplication_spec.ts
- /ClientSide/OtherUIFeatures/Analytics_spec.js
- OtherUIFeatures/ApplicationURL_spec.js
- OtherUIFeatures/ExportApplication_spec.js - Duplicate case removed
- OtherUIFeatures/UpdateApplication_spec.js
- VisualTests/JSEditorIndent_spec.js
- Workspace/WorkspaceImportApplication_spec.js
- **Improvemnets:**
- deployMode.StubWindowNAssert() improved to validate `getPluginForm`
instead of `getWorkspace`
- agHelper.AddDsl() improved, removed wait times
- appSettings.CheckUrl() - appName url updated
- assertHelper.AssertDocumentReady() -removed wait times
- assertHelper.AssertNetworkResponseData() - added for `getPluginForm`
validation for Page loads
- deployMode.DeployApp() -removed wait times
- homePage.CreateNewWorkspace() - improved to set localStorage for
workspaceName, workspaceId & create new workspace without new name
- homePage.CreateNewApplication() - - improved to set localStorage for
appName
- jsEditor.NavigateToNewJSEditor() - improved to remove tooltip
- cy.CreateAppInFirstListedWorkspace() - improved to set localStorage
for appName, removed waitTimes, Removed rename of every app for every
spec, calling AssertNetworkResponseData(getPluginForm)
- cy.DeleteWorkspaceByApi() added
- e2e.js - removed guid generation for first app, added
cy.DeleteWorkspaceByApi() in after()
#### 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
118 lines
3.4 KiB
TypeScript
118 lines
3.4 KiB
TypeScript
import "cypress-wait-until";
|
|
import { ObjectsRegistry } from "../Objects/Registry";
|
|
import { ReusableHelper } from "../Objects/ReusableHelper";
|
|
|
|
export const EntityItems = {
|
|
Page: 0,
|
|
Query: 1,
|
|
Api: 2,
|
|
JSObject: 3,
|
|
Widget: 4,
|
|
Datasource: 5,
|
|
} as const;
|
|
|
|
export type EntityItemsType = (typeof EntityItems)[keyof typeof EntityItems];
|
|
|
|
export class AssertHelper extends ReusableHelper {
|
|
private locator = ObjectsRegistry.CommonLocators;
|
|
public _modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
|
|
|
|
public isMac = Cypress.platform === "darwin";
|
|
|
|
public Sleep(timeout = 1000) {
|
|
cy.wait(timeout);
|
|
}
|
|
|
|
public AssertDocumentReady() {
|
|
cy.waitUntil(() =>
|
|
//cy.document().then((doc) => doc.readyState === "complete"),
|
|
cy.document().should((doc) => {
|
|
expect(doc.readyState).to.equal("complete");
|
|
}),
|
|
);
|
|
//cy.window({ timeout: 60000 }).should("have.property", "onload");//commenting to reduce time
|
|
}
|
|
|
|
public AssertDelete(entityType: EntityItemsType) {
|
|
let networkCall = "";
|
|
switch (entityType) {
|
|
case EntityItems.Api:
|
|
case EntityItems.Query:
|
|
networkCall = "deleteAction";
|
|
break;
|
|
case EntityItems.Widget:
|
|
networkCall = "updateLayout";
|
|
break;
|
|
case EntityItems.JSObject:
|
|
networkCall = "deleteJSCollection";
|
|
this.AssertContains("deleted successfully");
|
|
break;
|
|
case EntityItems.Datasource:
|
|
networkCall = "deleteDatasource";
|
|
break;
|
|
case EntityItems.Page:
|
|
networkCall = "deletePage";
|
|
break;
|
|
|
|
default:
|
|
networkCall && this.AssertNetworkStatus(networkCall);
|
|
}
|
|
}
|
|
|
|
public GetAliasName(aliasName: string) {
|
|
aliasName = aliasName.startsWith("@") ? aliasName : "@" + aliasName;
|
|
return aliasName;
|
|
}
|
|
|
|
public WaitForNetworkCall(aliasName: string, responseTimeout = 60000) {
|
|
// cy.wait(aliasName).then(($apiCall: any) => {
|
|
// expect($apiCall.response.body.responseMeta.status).to.eq(expectedStatus);
|
|
// });
|
|
|
|
// cy.wait(aliasName).should(
|
|
// "have.nested.property",
|
|
// "response.body.responseMeta.status",
|
|
// expectedStatus,
|
|
// );
|
|
this.Sleep(); //Wait a bit for call to finish!
|
|
return cy.wait(this.GetAliasName(aliasName), { responseTimeout });
|
|
}
|
|
|
|
public AssertNetworkStatus(aliasName: string, expectedStatus = 200) {
|
|
this.WaitForNetworkCall(aliasName);
|
|
cy.get(this.GetAliasName(aliasName))
|
|
.its("response.body.responseMeta.status")
|
|
.should("eq", expectedStatus);
|
|
|
|
//To improve below:
|
|
// cy.wait(aliasName, { timeout: timeout }).should((response: any) => {
|
|
// expect(response.status).to.be.oneOf([expectedStatus]);
|
|
// });
|
|
}
|
|
|
|
public AssertNetworkResponseData(aliasName: string) {
|
|
this.WaitForNetworkCall(aliasName, 100000);
|
|
cy.get(this.GetAliasName(aliasName))
|
|
.its("response.body.data")
|
|
.should("not.be.empty");
|
|
}
|
|
|
|
public AssertNetworkExecutionSuccess(aliasName: string, expectedRes = true) {
|
|
this.WaitForNetworkCall(aliasName);
|
|
cy.get(aliasName)
|
|
.its("response.body.data.isExecutionSuccess")
|
|
.should("eq", expectedRes);
|
|
}
|
|
|
|
public AssertContains(
|
|
text: string | RegExp,
|
|
exists: "exist" | "not.exist" | "be.visible" = "exist",
|
|
selector?: string,
|
|
) {
|
|
if (selector) {
|
|
return cy.contains(selector, text).should(exists);
|
|
}
|
|
return cy.contains(text).should(exists);
|
|
}
|
|
}
|