2023-11-14 12:10:06 +00:00
|
|
|
|
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
|
|
|
|
|
|
import { groupsSelector } from "Selectors/manageGroups";
|
|
|
|
|
|
|
|
|
|
|
|
import { fake } from "Fixtures/fake";
|
|
|
|
|
|
import {
|
|
|
|
|
|
logout,
|
|
|
|
|
|
navigateToAppEditor,
|
|
|
|
|
|
navigateToManageGroups,
|
|
|
|
|
|
releaseApp,
|
|
|
|
|
|
} from "Support/utils/common";
|
|
|
|
|
|
import { commonText } from "Texts/common";
|
|
|
|
|
|
import { inviteUser } from "Support/utils/manageUsers";
|
|
|
|
|
|
import { userSignUp } from "Support/utils/onboarding";
|
|
|
|
|
|
|
2023-11-17 10:59:04 +00:00
|
|
|
|
describe("Redirection error pages", () => {
|
2023-11-14 12:10:06 +00:00
|
|
|
|
const data = {};
|
|
|
|
|
|
data.appName = `${fake.companyName} App`;
|
|
|
|
|
|
data.firstName = fake.firstName;
|
|
|
|
|
|
data.email = fake.email.toLowerCase();
|
|
|
|
|
|
data.slug = data.appName.toLowerCase().replace(/\s+/g, "-");
|
|
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
|
cy.apiLogin();
|
|
|
|
|
|
});
|
|
|
|
|
|
before(() => {
|
|
|
|
|
|
cy.apiLogin();
|
|
|
|
|
|
inviteUser(data.firstName, data.email);
|
|
|
|
|
|
logout();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("Verify error modal in case of invalid app URL", () => {
|
|
|
|
|
|
cy.visit(`/applications/${data.lastName}`);
|
|
|
|
|
|
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Invalid link"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.modalDescription).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"The link you provided is invalid. Please check the link and try again."
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Back to home page"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
|
|
|
|
|
cy.logoutApi();
|
|
|
|
|
|
|
|
|
|
|
|
cy.visit(`/applications/${data.lastName}`);
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.workEmailLabel).should("be.visible");
|
|
|
|
|
|
|
|
|
|
|
|
cy.apiLogin(data.email, "password");
|
|
|
|
|
|
cy.visit(`/applications/${data.lastName}`);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("Verify error message in case of restricted access", () => {
|
|
|
|
|
|
data.appName = `${fake.companyName} App`;
|
|
|
|
|
|
cy.apiCreateApp(data.appName);
|
|
|
|
|
|
cy.openApp();
|
|
|
|
|
|
releaseApp();
|
|
|
|
|
|
|
|
|
|
|
|
cy.get(commonWidgetSelector.shareAppButton).click();
|
|
|
|
|
|
cy.clearAndType(commonWidgetSelector.appNameSlugInput, data.slug);
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
cy.logoutApi();
|
|
|
|
|
|
|
|
|
|
|
|
cy.apiLogin(data.email, "password");
|
|
|
|
|
|
cy.visit(`/applications/${data.slug}`);
|
|
|
|
|
|
|
|
|
|
|
|
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Restricted access"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.modalDescription).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"You don’t have access to this app. Kindly contact admin to know more."
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Back to home page"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.url().should("eq", "http://localhost:8082/error/restricted");
|
|
|
|
|
|
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("Verify error modal for app url of unreleased apps", () => {
|
|
|
|
|
|
data.appName = `${fake.companyName} App`;
|
|
|
|
|
|
data.slug = data.appName.toLowerCase().replace(/\s+/g, "-");
|
|
|
|
|
|
|
|
|
|
|
|
cy.apiCreateApp(data.appName);
|
|
|
|
|
|
cy.openApp();
|
|
|
|
|
|
cy.get(commonSelectors.leftSideBarSettingsButton).click();
|
|
|
|
|
|
cy.get(commonWidgetSelector.appSlugInput).clear();
|
|
|
|
|
|
cy.clearAndType(commonWidgetSelector.appSlugInput, data.slug);
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
|
|
|
|
|
|
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
|
|
|
|
|
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
2023-12-21 10:09:47 +00:00
|
|
|
|
"App URL Unavailable"
|
2023-11-14 12:10:06 +00:00
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.modalDescription).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
2023-12-21 10:09:47 +00:00
|
|
|
|
'The app URL is currently unavailable because the app has not been released. Please either release it or contact admin for access.'
|
2023-11-14 12:10:06 +00:00
|
|
|
|
);
|
2023-12-21 10:09:47 +00:00
|
|
|
|
cy.get('[data-cy="open-app-button"]').verifyVisibleElement("have.text", "Open app")
|
|
|
|
|
|
|
2023-11-14 12:10:06 +00:00
|
|
|
|
cy.get(commonSelectors.backToHomeButton).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Back to home page"
|
|
|
|
|
|
);
|
2023-12-21 10:09:47 +00:00
|
|
|
|
|
|
|
|
|
|
cy.url().should("eq", `http://localhost:8082/error/url-unavailable?appSlug=${data.slug}`);
|
2023-11-14 12:10:06 +00:00
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
|
|
|
|
|
|
|
|
|
|
|
cy.logoutApi();
|
|
|
|
|
|
cy.apiLogin(data.email, "password");
|
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
|
|
|
|
|
|
|
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
|
|
|
|
|
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Restricted access"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.modalDescription).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"You don’t have access to this app. Kindly contact admin to know more."
|
|
|
|
|
|
);
|
2023-12-21 10:09:47 +00:00
|
|
|
|
// cy.get('[data-cy="open-app-button"]').verifyVisibleElement("have.text", "Open app")
|
|
|
|
|
|
|
2023-11-14 12:10:06 +00:00
|
|
|
|
cy.get(commonSelectors.backToHomeButton).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Back to home page"
|
|
|
|
|
|
);
|
|
|
|
|
|
cy.url().should("eq", "http://localhost:8082/error/restricted");
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
|
|
|
|
|
logout();
|
|
|
|
|
|
|
|
|
|
|
|
cy.defaultWorkspaceLogin();
|
|
|
|
|
|
navigateToManageGroups();
|
|
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
cy.get(groupsSelector.appSearchBox).click();
|
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
|
cy.get(groupsSelector.searchBoxOptions).contains(data.appName).click();
|
|
|
|
|
|
cy.get(groupsSelector.selectAddButton).click();
|
|
|
|
|
|
cy.get("table").contains("td", data.appName);
|
|
|
|
|
|
cy.contains("td", data.appName)
|
|
|
|
|
|
.parent()
|
|
|
|
|
|
.within(() => {
|
|
|
|
|
|
cy.get("td input").eq(1).check();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
cy.logoutApi();
|
|
|
|
|
|
cy.apiLogin(data.email, "password");
|
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
|
|
|
|
|
|
|
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
|
|
|
|
|
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
2023-12-21 10:09:47 +00:00
|
|
|
|
"App URL Unavailable"
|
2023-11-14 12:10:06 +00:00
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.modalDescription).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
2023-12-21 10:09:47 +00:00
|
|
|
|
'The app URL is currently unavailable because the app has not been released. Please either release it or contact admin for access.'
|
2023-11-14 12:10:06 +00:00
|
|
|
|
);
|
|
|
|
|
|
cy.get(commonSelectors.backToHomeButton).verifyVisibleElement(
|
|
|
|
|
|
"have.text",
|
|
|
|
|
|
"Back to home page"
|
|
|
|
|
|
);
|
2023-12-21 10:09:47 +00:00
|
|
|
|
cy.url().should("eq", `http://localhost:8082/error/url-unavailable?appSlug=${data.slug}`);
|
2023-11-14 12:10:06 +00:00
|
|
|
|
cy.get(commonSelectors.backToHomeButton).click();
|
|
|
|
|
|
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|