PromucFlow_constructor/app/client/cypress/support/Pages/LibraryInstaller.ts
Aishwarya-U-R d7b2bad974
test: Cypress | Cy 12 upgrade + Flaky fixes (#23852)
## Description
- This PR upgrades cypress from 11.2 to 12.13.0 which fixes the random
browser crash issue in CI runs
 - ValidateNetworkStatus() updates to validate the n/w responses
 - cy.route() to cy.intercept()
 - Converting dataSources.json to HostPort.ts
 - Api responses read - updating to right Cy12 supported format
- js inconsistent testJsontext to TS `EnterJSContext` in few failing
specs
 - CI - higher resolution trials
- Improves _.agHelper.RefreshPage() - fixing Error: Socket closed before
finished writing response
 - AssertDocumentReady() created
 - within(()) & .children() - handled for Cy12
- Improved DeployApp(), NavigateBacktoEditor(), RefreshPage(), AddDsl()
methods
- js inconsistent goToEditFromPublish to TS `NavigateBacktoEditor` in
all specs
- js inconsistent PublishtheApp to TS `_.agHelper.DeployApp` in all
specs
- Convert /DynamicHeight/Text_Widget_spec.js to TS with all supporting
TS helpers
 - ToggleJSMode()
 - COMMIT_INFO_MESSAGE improved
 - Remove tooltip on the Application Name after rename
- js inconsistent cy.addDsl(dsl); to TS helper `_.agHelper.AddDsl(val);`
 - ++++ Much more improvements....

#### Type of change
- Script fixes

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

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

---------

Co-authored-by: Vijetha-Kaja <vijetha@appsmith.com>
2023-06-15 18:51:11 +05:30

70 lines
2.0 KiB
TypeScript

import { ObjectsRegistry } from "../Objects/Registry";
export class LibraryInstaller {
private _aggregateHelper = ObjectsRegistry.AggregateHelper;
private _installer_trigger_locator =
".t--entity-add-btn.group.libraries button";
private _installer_close_locator = ".t--close-installer";
private getLibraryLocatorInExplorer(libraryName: string) {
return `.t--installed-library-${libraryName}`;
}
private getLibraryCardLocator(libraryName: string) {
return `div.library-card.t--${libraryName}`;
}
public OpenInstaller(force = false) {
this._aggregateHelper.GetNClick(this._installer_trigger_locator, 0, force);
}
public CloseInstaller() {
this._aggregateHelper.GetNClick(this._installer_close_locator);
}
public installLibrary(
libraryName: string,
accessor: string,
checkIfSuccessful = true,
) {
cy.get(this.getLibraryCardLocator(libraryName))
.find(".t--download")
.click();
if (checkIfSuccessful) this.assertInstall(libraryName, accessor);
}
private assertInstall(libraryName: string, accessor: string) {
this._aggregateHelper.AssertContains(
`Installation Successful. You can access the library via ${accessor}`,
);
cy.get(this.getLibraryCardLocator(libraryName))
.find(".installed")
.should("be.visible");
this._aggregateHelper.AssertElementExist(
this.getLibraryLocatorInExplorer(libraryName),
);
}
public uninstallLibrary(libraryName: string) {
cy.get(this.getLibraryLocatorInExplorer(libraryName))
.realHover()
.find(".t--uninstall-library")
.click();
}
public assertUnInstall(libraryName: string) {
this._aggregateHelper.AssertContains(
`${libraryName} is uninstalled successfully.`,
);
this._aggregateHelper.AssertElementAbsence(
this.getLibraryLocatorInExplorer(libraryName),
);
}
public AssertLibraryinExplorer(libraryName: string) {
this._aggregateHelper.AssertElementExist(
this.getLibraryLocatorInExplorer(libraryName),
);
}
}