PromucFlow_constructor/app/client/cypress/support/Pages/LibraryInstaller.ts
Tanvi Bhakta cd030cebae
chore: replace custom wrapper for Add JS Library in entity explorer with design-system's popover (#26072)
## Description

Depends on https://github.com/appsmithorg/design-system/pull/567
Fixes https://github.com/appsmithorg/appsmith/issues/25569

#### Media


https://github.com/appsmithorg/appsmith/assets/13763558/5b136833-06ef-4f5e-969f-447ea53e5933



#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
This PR changes the design of the popover, but the functionality remains
the same.
The functionality of the popover should be tested. 

>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing

https://github.com/appsmithorg/appsmith/pull/26072#issuecomment-1683351732

https://github.com/appsmithorg/appsmith/pull/26072#issuecomment-1687388154
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: Vijetha-Kaja <vijetha@appsmith.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-08-28 14:52:28 +05:30

71 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 =
".ads-v2-popover__body-header .ads-v2-icon";
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),
);
}
}