Fix failed test cases (#8121)

This commit is contained in:
Ajith KV 2023-11-07 17:06:38 +05:30 committed by GitHub
parent c1618d7343
commit 8a44c9e6ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 118 additions and 62 deletions

View file

@ -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",

View 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")}`)
})
});

View file

@ -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");
});

View file

@ -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", () => {

View file

@ -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");
});
});
});