PromucFlow_constructor/app/client/cypress/support/Pages/InviteModal.ts
Ankita Kinger 2e08a913a7
feat: Updating invite modal & app settings for SSO embedding to introduce private app embedding (#22279)
## Description

Updating invite modal and app settings for SSO embedding to introduce
upgrade content for private apps. This is being done to introduce
private embedding SSO in invite modal and app settings for Business
Edition.

Fixes [#20578](https://github.com/appsmithorg/appsmith/issues/20578)

## Type of change

- New feature (non-breaking change which adds functionality)

## How Has This Been Tested?
- Manual
- Cypress

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] 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: Dipyaman Biswas <dipyaman@appsmith.com>
2023-04-20 17:55:32 +05:30

91 lines
3.0 KiB
TypeScript

import HomePage from "../../locators/HomePage";
import { ObjectsRegistry } from "../Objects/Registry";
// Edit mode modal
export class InviteModal {
private agHelper = ObjectsRegistry.AggregateHelper;
private embedSettings = ObjectsRegistry.EmbedSettings;
private deployPage = ObjectsRegistry.DeployMode;
private commonLocators = ObjectsRegistry.CommonLocators;
public locators = {
_inviteTab: "[data-cy='t--tab-INVITE']",
_embedTab: "[data-cy='t--tab-EMBED']",
_shareButton: ".t--application-share-btn",
_closeButton: ".t--close-form-dialog",
_previewEmbed: "[data-cy='preview-embed']",
_shareSettingsButton: "[data-testid='t--share-settings-btn']",
_upgradeButton: "[data-testid='t--upgrade-btn']",
_upgradeContent: "[data-testid='t--upgrade-content']",
_restrictionChange: "[data-testid='t--change-embedding-restriction']",
};
public SelectInviteTab() {
this.agHelper.GetNClick(this.locators._inviteTab);
}
public SelectEmbedTab() {
this.agHelper.GetNClick(this.locators._embedTab);
}
public OpenShareModal() {
this.agHelper.GetNClick(this.locators._shareButton);
}
public CloseModal() {
this.agHelper.GetNClick(this.locators._closeButton);
}
public SwitchToInviteTab() {
this.agHelper.GetNClick(this.locators._shareSettingsButton);
}
public enablePublicAccessViaShareSettings(enable: "true" | "false" = "true") {
this.SelectEmbedTab();
this.SwitchToInviteTab();
const input = this.agHelper.GetElement(HomePage.enablePublicAccess);
input.invoke("attr", "checked").then((value) => {
if (value !== enable) {
this.agHelper.GetNClick(HomePage.enablePublicAccess);
cy.wait("@changeAccess").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
}
});
cy.wait(10000);
cy.get(HomePage.editModeInviteModalCloseBtn).first().click({ force: true });
}
public enablePublicAccessViaInviteTab(enable: "true" | "false" = "true") {
this.SelectInviteTab();
const input = this.agHelper.GetElement(HomePage.enablePublicAccess);
input.invoke("attr", "checked").then((value) => {
if (value !== enable) {
this.agHelper.GetNClick(HomePage.enablePublicAccess);
cy.wait("@changeAccess").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
}
});
cy.wait(4000);
}
public ValidatePreviewEmbed(toShowNavBar: "true" | "false" = "true") {
this.OpenShareModal();
this.SelectEmbedTab();
this.embedSettings.ToggleShowNavigationBar(toShowNavBar);
cy.get(this.locators._previewEmbed).invoke("removeAttr", "target").click();
if (toShowNavBar === "true") {
this.agHelper.AssertElementExist(this.commonLocators._backToEditor);
this.deployPage.NavigateBacktoEditor();
} else {
this.agHelper.AssertElementAbsence(this.commonLocators._backToEditor);
cy.go("back");
}
}
}