## Description Add cypress tests for custom js library with git ## 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: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
69 lines
2.0 KiB
TypeScript
69 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";
|
|
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() {
|
|
this._aggregateHelper.GetNClick(this._installer_trigger_locator);
|
|
}
|
|
|
|
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),
|
|
);
|
|
}
|
|
}
|