mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Fix failed test cases (#8121)
This commit is contained in:
parent
c1618d7343
commit
8a44c9e6ee
5 changed files with 118 additions and 62 deletions
|
|
@ -3,7 +3,7 @@ export const workspaceConstantsText = {
|
|||
"To resolve a Workspace constant use {{constants.access_token}}",
|
||||
emptyStateHeader: "No Workspace constants yet",
|
||||
emptyStateText:
|
||||
"Use Workspace constants seamlessly in both the app builder and global data source connections across ToolJet.",
|
||||
"Use workspace constants seamlessly in both the app builder and data source connections across ToolJet.",
|
||||
addNewConstantButton: "Create new constant",
|
||||
addConstatntText: "Add new constant in production ",
|
||||
constantCreatedToast: "Constant has been created",
|
||||
|
|
|
|||
39
cypress-tests/cypress/e2e/ce/appSlug.cy.js
Normal file
39
cypress-tests/cypress/e2e/ce/appSlug.cy.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
|
||||
import { fake } from "Fixtures/fake";
|
||||
import { logout, navigateToAppEditor, verifyTooltip, releaseApp } from "Support/utils/common";
|
||||
import { commonText } from "Texts/common";
|
||||
import { addNewUserMW } from "Support/utils/userPermissions";
|
||||
import { userSignUp } from "Support/utils/onboarding";
|
||||
|
||||
describe("App share functionality", () => {
|
||||
const data = {};
|
||||
data.appName = `${fake.companyName} App`;
|
||||
data.firstName = fake.firstName;
|
||||
data.lastName = fake.lastName.replaceAll("[^A-Za-z]", "");
|
||||
data.email = fake.email.toLowerCase();
|
||||
const slug = data.appName.toLowerCase().replace(/\s+/g, "-");
|
||||
const firstUserEmail = data.email
|
||||
const envVar = Cypress.env("environment");
|
||||
// beforeEach(() => {
|
||||
// cy.appUILogin();
|
||||
// });
|
||||
before(() => {
|
||||
cy.apiLogin();
|
||||
cy.apiCreateApp(data.appName);
|
||||
// cy.visit('/')
|
||||
// logout();
|
||||
})
|
||||
|
||||
it("", () => {
|
||||
cy.openApp(data.appName);
|
||||
|
||||
cy.get('[data-cy="left-sidebar-settings-button"]').click();
|
||||
cy.get('[data-cy="app-slug-label"]').verifyVisibleElement("have.text", "Unique app slug");
|
||||
cy.get('[data-cy="app-slug-input-field"]').verifyVisibleElement("have.value", Cypress.env("appId"));
|
||||
cy.get('[data-cy="app-slug-info-label"]').verifyVisibleElement("have.text", "URL-friendly 'slug' consists of lowercase letters, numbers, and hyphens");
|
||||
cy.get('[data-cy="app-link-label"]').verifyVisibleElement("have.text", "App link");
|
||||
cy.get('[data-cy="app-link-field"]').verifyVisibleElement("have.text", `http://localhost:8082/my-workspace/apps/${Cypress.env("appId")}`)
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
|
|
@ -57,7 +57,9 @@ describe("App share functionality", () => {
|
|||
cy.get(commonSelectors.editorPageLogo).click();
|
||||
|
||||
logout();
|
||||
cy.wait(2500);
|
||||
cy.visit(`/applications/${slug}`);
|
||||
cy.wait(2500);
|
||||
|
||||
cy.get(commonSelectors.loginButton).should("be.visible");
|
||||
|
||||
|
|
@ -76,8 +78,9 @@ describe("App share functionality", () => {
|
|||
cy.get(commonSelectors.editorPageLogo).click();
|
||||
|
||||
logout();
|
||||
cy.wait(2500);
|
||||
cy.visit(`/applications/${slug}`);
|
||||
cy.wait(500);
|
||||
cy.wait(2500);
|
||||
cy.get('[data-cy="draggable-widget-table1"]').should("be.visible");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ describe("User permissions", () => {
|
|||
cy.contains(dashboardText.createAppButton).should("not.exist");
|
||||
}
|
||||
});
|
||||
common.logout();
|
||||
cy.logoutApi();
|
||||
});
|
||||
|
||||
it("Should verify the View and Edit permission", () => {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ describe("Workspace constants", () => {
|
|||
.click();
|
||||
|
||||
cy.get(commonSelectors.breadcrumbTitle).should(($el) => {
|
||||
expect($el.contents().first().text().trim()).to.eq("Workspace settings");
|
||||
expect($el.contents().first().text().trim()).to.eq(
|
||||
"Workspace settings"
|
||||
);
|
||||
});
|
||||
cy.get(commonSelectors.breadcrumbPageTitle).verifyVisibleElement(
|
||||
"have.text",
|
||||
|
|
@ -67,7 +69,9 @@ describe("Workspace constants", () => {
|
|||
);
|
||||
|
||||
cy.get("body").then(($body) => {
|
||||
if ($body.find(workspaceConstantsSelectors.emptyStateImage).length > 0) {
|
||||
if (
|
||||
$body.find(workspaceConstantsSelectors.emptyStateImage).length > 0
|
||||
) {
|
||||
cy.get(workspaceConstantsSelectors.emptyStateImage).should(
|
||||
"be.visible"
|
||||
);
|
||||
|
|
@ -77,7 +81,9 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
workspaceConstantsText.emptyStateHeader
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.emptyStateText).verifyVisibleElement(
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.emptyStateText
|
||||
).verifyVisibleElement(
|
||||
"have.text",
|
||||
workspaceConstantsText.emptyStateText
|
||||
);
|
||||
|
|
@ -94,7 +100,10 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
workspaceConstantsText.addConstatntText
|
||||
);
|
||||
cy.get(commonSelectors.nameLabel).verifyVisibleElement("have.text", "Name");
|
||||
cy.get(commonSelectors.nameLabel).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Name"
|
||||
);
|
||||
cy.get(commonSelectors.nameInputField)
|
||||
.invoke("attr", "placeholder")
|
||||
.should("eq", "Enter Constant Name");
|
||||
|
|
@ -111,11 +120,12 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
"Cancel"
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Add constant"
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.addConstantButton
|
||||
).verifyVisibleElement("have.text", "Add constant");
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should(
|
||||
"be.disabled"
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.disabled");
|
||||
|
||||
contantsNameValidation(" ", commonText.constantsNameError);
|
||||
contantsNameValidation("9", commonText.constantsNameError);
|
||||
|
|
@ -134,13 +144,17 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
commonText.constantsValueError
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.disabled");
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should(
|
||||
"be.disabled"
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
cy.get(workspaceConstantsSelectors.addNewConstantButton).click();
|
||||
|
||||
cy.clearAndType(commonSelectors.nameInputField, data.constName);
|
||||
cy.clearAndType(commonSelectors.valueInputField, data.constName);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.enabled");
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should(
|
||||
"be.enabled"
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
cy.get(workspaceConstantsSelectors.constantName(data.constName)).should(
|
||||
"not.exist"
|
||||
|
|
@ -189,14 +203,22 @@ describe("Workspace constants", () => {
|
|||
).verifyVisibleElement("have.text", "Delete");
|
||||
cy.get(commonSelectors.pagination).should("be.visible");
|
||||
|
||||
cy.get(workspaceConstantsSelectors.constEditButton(data.constName)).click();
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.constEditButton(data.constName)
|
||||
).click();
|
||||
|
||||
cy.get(workspaceConstantsSelectors.contantFormTitle).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Update constant in production "
|
||||
);
|
||||
cy.get(commonSelectors.nameLabel).verifyVisibleElement("have.text", "Name");
|
||||
cy.get(commonSelectors.nameInputField).should("have.value", data.constName);
|
||||
cy.get(commonSelectors.nameLabel).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Name"
|
||||
);
|
||||
cy.get(commonSelectors.nameInputField).should(
|
||||
"have.value",
|
||||
data.constName
|
||||
);
|
||||
cy.get(commonSelectors.nameInputField)
|
||||
.should("be.visible")
|
||||
.and("be.disabled");
|
||||
|
|
@ -211,20 +233,25 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
"Cancel"
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Update"
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.addConstantButton
|
||||
).verifyVisibleElement("have.text", "Update");
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should(
|
||||
"be.disabled"
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.disabled");
|
||||
|
||||
cy.clearAndType(commonSelectors.valueInputField, data.newConstvalue);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.enabled");
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should(
|
||||
"be.enabled"
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.constantValue(data.constName)
|
||||
).verifyVisibleElement("have.text", data.constName);
|
||||
|
||||
cy.get(workspaceConstantsSelectors.constEditButton(data.constName)).click();
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.constEditButton(data.constName)
|
||||
).click();
|
||||
cy.clearAndType(commonSelectors.valueInputField, data.newConstvalue);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).click();
|
||||
cy.verifyToastMessage(
|
||||
|
|
@ -246,7 +273,10 @@ describe("Workspace constants", () => {
|
|||
"have.text",
|
||||
"Cancel"
|
||||
);
|
||||
cy.get(commonSelectors.yesButton).verifyVisibleElement("have.text", "Yes");
|
||||
cy.get(commonSelectors.yesButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Yes"
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.constantValue(data.constName)
|
||||
|
|
@ -312,47 +342,31 @@ describe("Workspace constants", () => {
|
|||
`[data-cy="inspector-node-${data.constantsName}"] > .mx-2`
|
||||
).verifyVisibleElement("have.text", `"dJ_8Q~BcaMPd"`);
|
||||
|
||||
cy.get('[data-cy="button-release"]').click();
|
||||
cy.get('[data-cy="yes-button"]').click();
|
||||
cy.verifyToastMessage(commonSelectors.toastMessage, "Version v1 released");
|
||||
|
||||
if (envVar === "Community") {
|
||||
cy.get('[data-cy="button-release"]').click();
|
||||
cy.get('[data-cy="yes-button"]').click();
|
||||
cy.verifyToastMessage(
|
||||
commonSelectors.toastMessage,
|
||||
"Version v1 released"
|
||||
);
|
||||
cy.get(commonWidgetSelector.shareAppButton).click();
|
||||
cy.clearAndType(commonWidgetSelector.appNameSlugInput, `${data.slug}`);
|
||||
cy.wait(1500);
|
||||
cy.get(commonWidgetSelector.modalCloseButton).click();
|
||||
cy.forceClickOnCanvas();
|
||||
cy.waitForAutoSave();
|
||||
cy.wait(500)
|
||||
cy.openInCurrentTab(commonWidgetSelector.previewButton);
|
||||
cy.wait(4000);
|
||||
|
||||
cy.get(commonWidgetSelector.shareAppButton).click();
|
||||
cy.clearAndType(commonWidgetSelector.appNameSlugInput, `${data.slug}`);
|
||||
cy.get(commonWidgetSelector.modalCloseButton).click();
|
||||
cy.forceClickOnCanvas();
|
||||
cy.waitForAutoSave();
|
||||
cy.openInCurrentTab(commonWidgetSelector.previewButton);
|
||||
cy.wait(4000);
|
||||
cy.get(
|
||||
commonWidgetSelector.draggableWidget(data.constantsName)
|
||||
).verifyVisibleElement("have.text", "dJ_8Q~BcaMPd");
|
||||
|
||||
cy.get(
|
||||
commonWidgetSelector.draggableWidget(data.constantsName)
|
||||
).verifyVisibleElement("have.text", "dJ_8Q~BcaMPd");
|
||||
cy.get('[data-cy="viewer-page-logo"]').click();
|
||||
cy.wait("@homePage");
|
||||
cy.visit(`/applications/${data.slug}`);
|
||||
cy.wait(4000);
|
||||
|
||||
cy.get('[data-cy="viewer-page-logo"]').click();
|
||||
cy.wait("@homePage");
|
||||
cy.visit(`/applications/${data.slug}`);
|
||||
cy.wait(4000);
|
||||
|
||||
cy.get(
|
||||
commonWidgetSelector.draggableWidget(data.constantsName)
|
||||
).verifyVisibleElement("have.text", "dJ_8Q~BcaMPd");
|
||||
} else {
|
||||
cy.forceClickOnCanvas();
|
||||
cy.waitForAutoSave();
|
||||
cy.openInCurrentTab(commonWidgetSelector.previewButton);
|
||||
cy.wait(4000);
|
||||
|
||||
cy.get(
|
||||
commonWidgetSelector.draggableWidget(data.constantsName)
|
||||
).verifyVisibleElement("have.text", "dJ_8Q~BcaMPd");
|
||||
|
||||
cy.get('[data-cy="viewer-page-logo"]').click();
|
||||
cy.wait("@homePage");
|
||||
}
|
||||
cy.get(
|
||||
commonWidgetSelector.draggableWidget(data.constantsName)
|
||||
).verifyVisibleElement("have.text", "dJ_8Q~BcaMPd");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue