mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Merge pull request #11532 from ToolJet/test/domain-independent-test-suite
Refactor Cypress test suite for domain independence with subpath and reverse proxy support
This commit is contained in:
commit
521c79a7a2
22 changed files with 163 additions and 173 deletions
9
.github/workflows/cypress-platform.yml
vendored
9
.github/workflows/cypress-platform.yml
vendored
|
|
@ -59,7 +59,7 @@ jobs:
|
|||
echo "TOOLJET_DB_HOST=localhost" >> .env
|
||||
echo "TOOLJET_DB_PASS=postgres" >> .env
|
||||
echo "PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj" >> .env
|
||||
echo "ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS=true" >> .env
|
||||
echo "ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS=false" >> .env
|
||||
echo "PGRST_HOST=localhost:3001" >> .env
|
||||
echo "SSO_GIT_OAUTH2_CLIENT_ID=dummy" >> .env
|
||||
echo "SSO_GIT_OAUTH2_CLIENT_SECRET=dummy" >> .env
|
||||
|
|
@ -174,7 +174,7 @@ jobs:
|
|||
echo "PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj" >> .env
|
||||
echo "PGRST_HOST=postgrest" >> .env
|
||||
echo "PGRST_DB_URI=postgres://postgres:postgres@postgres/tooljet_db" >> .env
|
||||
echo "ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS=true" >> .env
|
||||
echo "ENABLE_ONBOARDING_QUESTIONS_FOR_ALL_SIGN_UPS=false" >> .env
|
||||
echo "SSO_GIT_OAUTH2_CLIENT_ID=dummy" >> .env
|
||||
echo "SSO_GIT_OAUTH2_CLIENT_SECRET=dummy" >> .env
|
||||
echo "SSO_GIT_OAUTH2_HOST=dummy" >> .env
|
||||
|
|
@ -187,6 +187,11 @@ jobs:
|
|||
|
||||
- name: Pulling the docker-compose file
|
||||
run: curl -LO https://tooljet-test.s3.us-west-1.amazonaws.com/docker-compose.yaml && mkdir postgres_data
|
||||
|
||||
- name: Install Docker Compose
|
||||
run: |
|
||||
curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
- name: Run docker-compose file
|
||||
run: docker-compose up -d
|
||||
|
|
|
|||
|
|
@ -275,74 +275,6 @@ Cypress.Commands.add(
|
|||
);
|
||||
|
||||
|
||||
// Cypress.Commands.add("addComponentToApp", (appName, componentName, layoutConfig = {}) => {
|
||||
|
||||
|
||||
// cy.task("updateId", {
|
||||
// dbconfig: Cypress.env("app_db"),
|
||||
// sql: `select id from apps where name='${appName}';`,
|
||||
// }).then((resp) => {
|
||||
// appId = resp.rows[0]id;
|
||||
|
||||
|
||||
// // Default layout values
|
||||
// const defaultLayout = {
|
||||
// desktop: { top: 90, left: 9, width: 6, height: 40 },
|
||||
// mobile: { top: 90, left: 9, width: 6, height: 40 },
|
||||
// };
|
||||
|
||||
// // Merge default layout with the provided configuration
|
||||
// const layouts = {
|
||||
// desktop: { ...defaultLayout.desktop, ...layoutConfig.desktop },
|
||||
// mobile: { ...defaultLayout.mobile, ...layoutConfig.mobile },
|
||||
// };
|
||||
|
||||
// cy.getCookie("tj_auth_token", { log: false }).then((cookie) => {
|
||||
// Cypress.env("authToken", `tj_auth_token=${cookie.value}`);
|
||||
|
||||
// cy.request({
|
||||
// method: "GET",
|
||||
// url: `${Cypress.env("server_host")}/api/v2/apps/${appId}`,
|
||||
// headers: {
|
||||
// "Tj-Workspace-Id": Cypress.env("workspaceId"),
|
||||
// Cookie: `tj_auth_token=${cookie.value}`,
|
||||
// },
|
||||
// }).then((response) => {
|
||||
// expect(response.status).to.eq(200);
|
||||
|
||||
// const { id: editingVersionId, home_page_id: homePageId } = response.body.editing_version;
|
||||
// const componentId = crypto.randomUUID ? crypto.randomUUID() : require("uuid").v4();
|
||||
|
||||
// const requestBody = {
|
||||
// is_user_switched_version: false,
|
||||
// pageId: homePageId,
|
||||
// diff: {
|
||||
// [componentId]: {
|
||||
// name: componentName,
|
||||
// layouts: layouts,
|
||||
// type: "Text",
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
|
||||
// cy.request({
|
||||
// method: "POST",
|
||||
// url: `${Cypress.env("server_host")}/api/v2/apps/$${appId}/versions/${editingVersionId}/components`,
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// "Tj-Workspace-Id": Cypress.env("workspaceId"),
|
||||
// Cookie: `tj_auth_token=${cookie.value}`,
|
||||
// },
|
||||
// body: requestBody,
|
||||
// }).then((postResponse) => {
|
||||
// expect(postResponse.status).to.eq(201);
|
||||
// cy.log(`Component ${componentId} added successfully`);
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
Cypress.Commands.add("addComponentToApp", (appName, componentName, layoutConfig = {}) => {
|
||||
cy.task("updateId", {
|
||||
dbconfig: Cypress.env("app_db"),
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ Cypress.Commands.add(
|
|||
cy.clearAndType(onboardingSelectors.loginPasswordInput, password);
|
||||
cy.get(onboardingSelectors.signInButton).click();
|
||||
|
||||
cy.intercept("GET", "api/library_apps").as(
|
||||
"library_apps"
|
||||
);
|
||||
cy.intercept("GET", "/api/library_apps/").as("library_apps");
|
||||
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
|
||||
cy.wait("@library_apps");
|
||||
|
||||
|
|
@ -368,7 +366,7 @@ Cypress.Commands.add("defaultWorkspaceLogin", () => {
|
|||
"library_apps"
|
||||
);
|
||||
cy.visit("/my-workspace");
|
||||
// cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
|
||||
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
|
||||
cy.wait("@library_apps");
|
||||
});
|
||||
|
||||
|
|
@ -467,3 +465,12 @@ Cypress.Commands.add("appPrivacy", (appName, isPublic) => {
|
|||
sql: `UPDATE apps SET is_public = ${isPublicValue} WHERE name = '${appName}';`,
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.overwrite('intercept', (originalFn, method, endpoint, mockData) => {
|
||||
const isSubpath = Cypress.config('baseUrl')?.includes('/apps/tooljet');
|
||||
const cleanEndpoint = endpoint.replace('/apps/tooljet', '');
|
||||
const fullUrl = isSubpath ? `/apps/tooljet${cleanEndpoint}` : cleanEndpoint;
|
||||
|
||||
return originalFn(method, fullUrl, mockData);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
export const cyParamName = (paramName = "") => {
|
||||
return paramName.toLowerCase().replace(/\s+/g, "-");
|
||||
};
|
||||
import { cyParamName } from "./common";
|
||||
|
||||
|
||||
export const workspaceConstantsSelectors = {
|
||||
workspaceConstantsHelperText: '[data-cy="workspace-constant-helper-text"]',
|
||||
emptyStateImage: '[data-cy="empty-state-image"]',
|
||||
emptyStateHeader: '[data-cy="empty-state-header"]',
|
||||
emptyStateText: '[data-cy="empty-state-text"]',
|
||||
addNewConstantButton: '[data-cy="add-new-constant-button"]',
|
||||
addNewConstantButton: '[data-cy="form-add-new-constant-button"]',
|
||||
contantFormTitle: '[data-cy="constant-form-title"]',
|
||||
addConstantButton: '[data-cy="add-constant-button"]',
|
||||
envName: '[data-cy="env-name"]',
|
||||
constantsTableNameHeader: '[data-cy="workspace-variable-table-name-header"]',
|
||||
constantsTableValueHeader:
|
||||
'[data-cy="workspace-variable-table-value-header"]',
|
||||
nameInputFiled: '[data-cy="name-input-field"]',
|
||||
|
||||
constantName: (constName) => {
|
||||
return `[data-cy="${cyParamName(constName)}-workspace-constant-name"]`;
|
||||
|
|
@ -30,4 +30,7 @@ export const workspaceConstantsSelectors = {
|
|||
constHideButton: (constName) => {
|
||||
return `[data-cy="${cyParamName(constName)}-constant-visibility"]`;
|
||||
},
|
||||
constantsType: (type) => {
|
||||
return `[data-cy="${cyParamName(type)}-constants-input"]`;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
export const workspaceConstantsText = {
|
||||
workspaceConstantsHelperText:
|
||||
"To resolve a Workspace constant use {{constants.access_token}}",
|
||||
"To resolve a global workspace constant use {{constants.access_token}}",
|
||||
emptyStateHeader: "No Workspace constants yet",
|
||||
emptyStateText:
|
||||
"Use workspace constants seamlessly in both the app builder and data source connections across ToolJet.",
|
||||
addNewConstantButton: "Create new constant",
|
||||
addNewConstantButton: "+ Create new constant",
|
||||
addConstatntText: "Add new constant in production ",
|
||||
constantCreatedToast: "Constant has been created",
|
||||
constantCreatedToast: (type) => { return `${type} constant created successfully!` },
|
||||
constantsExisitToast: (type) => { return `${type} constant already exists!` }
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ describe("App slug", () => {
|
|||
);
|
||||
cy.get(commonWidgetSelector.appLinkField).verifyVisibleElement(
|
||||
"have.text",
|
||||
`http://localhost:8082/my-workspace/apps/${Cypress.env("appId")}`
|
||||
`${Cypress.config('baseUrl')}/my-workspace/apps/${Cypress.env("appId")}`
|
||||
);
|
||||
|
||||
cy.wait(500);
|
||||
|
|
@ -84,11 +84,11 @@ describe("App slug", () => {
|
|||
);
|
||||
cy.get(commonWidgetSelector.appLinkField).verifyVisibleElement(
|
||||
"have.text",
|
||||
`http://localhost:8082/my-workspace/apps/${data.slug}`
|
||||
`${Cypress.config('baseUrl')}/my-workspace/apps/${data.slug}`
|
||||
);
|
||||
cy.url().should(
|
||||
"eq",
|
||||
`http://localhost:8082/my-workspace/apps/${data.slug}`
|
||||
`${Cypress.config('baseUrl')}/my-workspace/apps/${data.slug}`
|
||||
);
|
||||
|
||||
releaseApp();
|
||||
|
|
@ -97,15 +97,15 @@ describe("App slug", () => {
|
|||
cy.wait(2000);
|
||||
cy.url().should(
|
||||
"eq",
|
||||
`http://localhost:8082/applications/${data.slug}/home?version=v1`
|
||||
`${Cypress.config('baseUrl')}/applications/${data.slug}/home?version=v1`
|
||||
);
|
||||
cy.visit("/my-workspace");
|
||||
cy.wait(500);
|
||||
|
||||
cy.visitSlug({
|
||||
actualUrl: `http://localhost:8082/applications/${data.slug}`,
|
||||
actualUrl: `${Cypress.config('baseUrl')}/applications/${data.slug}`,
|
||||
});
|
||||
cy.url().should("eq", `http://localhost:8082/applications/${data.slug}`);
|
||||
cy.url().should("eq", `${Cypress.config('baseUrl')}/applications/${data.slug}`);
|
||||
cy.visit("/my-workspace");
|
||||
cy.wait(500);
|
||||
|
||||
|
|
@ -176,20 +176,20 @@ describe("App slug", () => {
|
|||
cy.get(commonWidgetSelector.modalCloseButton).click();
|
||||
cy.url().should(
|
||||
"eq",
|
||||
`http://localhost:8082/my-workspace/apps/${data.slug}/home`
|
||||
`${Cypress.config('baseUrl')}/my-workspace/apps/${data.slug}/home`
|
||||
);
|
||||
|
||||
cy.openInCurrentTab(commonWidgetSelector.previewButton);
|
||||
cy.wait(1000);
|
||||
cy.url().should(
|
||||
"eq",
|
||||
`http://localhost:8082/applications/${data.slug}/home?version=v1`
|
||||
`${Cypress.config('baseUrl')}/applications/${data.slug}/home?version=v1`
|
||||
);
|
||||
cy.visit("/my-workspace");
|
||||
cy.wait(500);
|
||||
|
||||
cy.visitSlug({ actualUrl: `/applications/${data.slug}` });
|
||||
cy.url().should("eq", `http://localhost:8082/applications/${data.slug}`);
|
||||
cy.url().should("eq", `${Cypress.config('baseUrl')}/applications/${data.slug}`);
|
||||
cy.visit("/my-workspace");
|
||||
cy.wait(500);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ describe(
|
|||
"be.visible"
|
||||
);
|
||||
cy.visitSlug({
|
||||
actualUrl: `http://localhost:8082/applications/${data.slug}`,
|
||||
actualUrl: `${Cypress.config('baseUrl')}/applications/${data.slug}`,
|
||||
});
|
||||
cy.wait(3000);
|
||||
|
||||
|
|
@ -87,8 +87,8 @@ describe(
|
|||
"be.visible"
|
||||
);
|
||||
|
||||
cy.clearAndType(onboardingSelectors.emailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, "password");
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, "password");
|
||||
cy.get(onboardingSelectors.signInButton).click();
|
||||
|
||||
cy.wait(500);
|
||||
|
|
@ -111,7 +111,7 @@ describe(
|
|||
"be.visible"
|
||||
);
|
||||
cy.visitSlug({
|
||||
actualUrl: `http://localhost:8082/applications/${data.slug}`,
|
||||
actualUrl: `${Cypress.config('baseUrl')}/applications/${data.slug}`,
|
||||
});
|
||||
cy.wait(3000);
|
||||
cy.get(".text-widget-section > div").should("be.visible");
|
||||
|
|
@ -196,8 +196,8 @@ describe(
|
|||
|
||||
// logout();
|
||||
|
||||
cy.clearAndType(onboardingSelectors.emailInput, data.email);
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, "password");
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, data.email);
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, "password");
|
||||
cy.get(onboardingSelectors.signInButton).click();
|
||||
cy.pause();
|
||||
cy.wait(1000);
|
||||
|
|
@ -270,8 +270,8 @@ describe(
|
|||
cy.get(commonSelectors.createAnAccountLink).click();
|
||||
|
||||
cy.clearAndType(commonSelectors.nameInputField, data.firstName);
|
||||
cy.clearAndType(onboardingSelectors.emailInput, data.email);
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, commonText.password);
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, data.email);
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, commonText.password);
|
||||
cy.get(commonSelectors.signUpButton).click();
|
||||
|
||||
cy.apiLogin();
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ describe("Global Datasource Manager", () => {
|
|||
cy.get('[data-cy="databases-datasource-button"]').should("be.visible");
|
||||
|
||||
cy.apiCreateGDS(
|
||||
"http://localhost:3000/api/v2/data_sources",
|
||||
`${Cypress.env("server_host")}/api/v2/data_sources`,
|
||||
`cypress-${data.dsName2}-postgresql`,
|
||||
"postgresql",
|
||||
[
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import * as signup from "Support/utils/selfHostSignUp";
|
|||
import { logout } from "Support/utils/common";
|
||||
import { onboardingSelectors } from "Selectors/onboarding";
|
||||
|
||||
//selfhostsetup
|
||||
describe("Self host onboarding", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/setup");
|
||||
});
|
||||
|
||||
it("verify elements on self host onboarding page", () => {
|
||||
cy.get(commonSelectors.HostBanner).should("be.visible");
|
||||
cy.get(commonSelectors.pageLogo).should("be.visible");
|
||||
|
|
@ -7,6 +7,7 @@ import * as common from "Support/utils/common";
|
|||
import {
|
||||
contantsNameValidation,
|
||||
AddNewconstants,
|
||||
existingNameValidation,
|
||||
} from "Support/utils/workspaceConstants";
|
||||
import { buttonText } from "Texts/button";
|
||||
import { editAndVerifyWidgetName } from "Support/utils/commonWidget";
|
||||
|
|
@ -28,7 +29,7 @@ describe("Workspace constants", () => {
|
|||
const envVar = Cypress.env("environment");
|
||||
beforeEach(() => {
|
||||
cy.defaultWorkspaceLogin();
|
||||
cy.intercept("GET", "/api/library_apps").as("homePage");
|
||||
// cy.intercept("GET", "/api/library_apps", "homePage");
|
||||
cy.skipWalkthrough();
|
||||
});
|
||||
it("Verify workspace constants UI and CRUD operations", () => {
|
||||
|
|
@ -57,7 +58,7 @@ describe("Workspace constants", () => {
|
|||
|
||||
cy.get(commonSelectors.documentationLink).verifyVisibleElement(
|
||||
"have.text",
|
||||
commonText.documentationLink
|
||||
"Read documentation"
|
||||
);
|
||||
|
||||
cy.get("body").then(($body) => {
|
||||
|
|
@ -91,13 +92,13 @@ describe("Workspace constants", () => {
|
|||
cy.get(commonSelectors.nameLabel).verifyVisibleElement("have.text", "Name");
|
||||
cy.get(commonSelectors.nameInputField)
|
||||
.invoke("attr", "placeholder")
|
||||
.should("eq", "Enter Constant Name");
|
||||
.should("eq", "Enter constant name");
|
||||
cy.get(commonSelectors.nameInputField).should("be.visible");
|
||||
cy.get(commonSelectors.valueLabel).should(($el) => {
|
||||
expect($el.contents().first().text().trim()).to.eq("Value");
|
||||
});
|
||||
cy.get('[data-cy="encrypted-label"]>').should("be.visible");
|
||||
cy.verifyLabel("Encrypted");
|
||||
cy.get('[data-cy="form-encrypted-label"]')
|
||||
.verifyVisibleElement("have.text", "Encrypted");
|
||||
cy.get(commonSelectors.valueInputField)
|
||||
.invoke("attr", "placeholder")
|
||||
.should("eq", "Enter value");
|
||||
|
|
@ -116,12 +117,12 @@ describe("Workspace constants", () => {
|
|||
contantsNameValidation("9", commonText.constantsNameError);
|
||||
contantsNameValidation("%", commonText.constantsNameError);
|
||||
contantsNameValidation(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`a",
|
||||
"Xk4jY2mLn8pQsZ9Rt6vBc7wJaHqOdEfGuVxY3NkMLzPoWX5wee",
|
||||
"Maximum length has been reached"
|
||||
);
|
||||
contantsNameValidation(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`afgg",
|
||||
"Constant name should be between 1 and 32 characters"
|
||||
"Xk4jY2mLn8pQsZ9Rt6vBc7wJaHqOdEfGuVxY3NkMLzPoWX5weetr",
|
||||
"Constant name has exceeded 50 characters"
|
||||
);
|
||||
|
||||
cy.get(commonSelectors.valueInputField).click();
|
||||
|
|
@ -137,6 +138,7 @@ describe("Workspace constants", () => {
|
|||
cy.clearAndType(commonSelectors.nameInputField, data.constName);
|
||||
cy.get(commonSelectors.valueInputField).click();
|
||||
cy.clearAndType(commonSelectors.valueInputField, data.constName);
|
||||
cy.get(workspaceConstantsSelectors.constantsType("global")).check();
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.enabled");
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
cy.get(workspaceConstantsSelectors.constantName(data.constName)).should(
|
||||
|
|
@ -147,26 +149,23 @@ describe("Workspace constants", () => {
|
|||
cy.clearAndType(commonSelectors.nameInputField, data.constName);
|
||||
cy.get(commonSelectors.valueInputField).click();
|
||||
cy.clearAndType(commonSelectors.valueInputField, data.constName);
|
||||
cy.get(workspaceConstantsSelectors.constantsType("global")).check();
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).click();
|
||||
cy.verifyToastMessage(
|
||||
commonSelectors.toastMessage,
|
||||
workspaceConstantsText.constantCreatedToast
|
||||
workspaceConstantsText.constantCreatedToast("Global")
|
||||
);
|
||||
|
||||
cy.get(workspaceConstantsSelectors.addNewConstantButton).click();
|
||||
contantsNameValidation(
|
||||
data.constName,
|
||||
"Constant with this name already exists in Production environment"
|
||||
);
|
||||
existingNameValidation(data.constName, "test");
|
||||
cy.get(commonSelectors.cancelButton).click();
|
||||
|
||||
cy.get(workspaceConstantsSelectors.envName).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Production"
|
||||
);
|
||||
cy.get(workspaceConstantsSelectors.envName).should(($el) => {
|
||||
expect($el.contents().first().text().trim()).to.eq("Production");
|
||||
});
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.addNewConstantButton
|
||||
).verifyVisibleElement("have.text", "Create new constant");
|
||||
).verifyVisibleElement("have.text", "+ Create new constant");
|
||||
cy.get(
|
||||
workspaceConstantsSelectors.constantsTableNameHeader
|
||||
).verifyVisibleElement("have.text", "Name");
|
||||
|
|
@ -270,7 +269,8 @@ describe("Workspace constants", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("should verify the constants resolving value on components and query", () => {
|
||||
//Fix after app builder
|
||||
it.skip("should verify the constants resolving value on components and query", () => {
|
||||
cy.viewport(1200, 1300);
|
||||
|
||||
data.widgetName = fake.firstName.toLowerCase().replaceAll("[^A-Za-z]", "");
|
||||
|
|
@ -306,9 +306,9 @@ describe("Workspace constants", () => {
|
|||
editAndVerifyWidgetName(data.widgetName, []);
|
||||
cy.waitForAutoSave();
|
||||
|
||||
cy.get(
|
||||
'[data-cy="default-value-input-field"]'
|
||||
).clearAndTypeOnCodeMirror(`{{queries.restapi1.data.message`);
|
||||
cy.get('[data-cy="default-value-input-field"]').clearAndTypeOnCodeMirror(
|
||||
`{{queries.restapi1.data.message`
|
||||
);
|
||||
cy.forceClickOnCanvas();
|
||||
cy.waitForAutoSave();
|
||||
cy.get(dataSourceSelector.queryCreateAndRunButton).click();
|
||||
|
|
@ -323,7 +323,7 @@ describe("Workspace constants", () => {
|
|||
commonWidgetSelector.draggableWidget(data.widgetName)
|
||||
).verifyVisibleElement("have.value", "Production environment testing");
|
||||
});
|
||||
it("should verify the constants resolving in datasource connection form", () => {
|
||||
it.skip("should verify the constants resolving in datasource connection form", () => {
|
||||
data.ds = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
|
||||
|
||||
data.widgetName = fake.firstName.toLowerCase().replaceAll("[^A-Za-z]", "");
|
||||
|
|
@ -341,7 +341,7 @@ describe("Workspace constants", () => {
|
|||
AddNewconstants(data.restapiHeaderKey, "customHeader");
|
||||
AddNewconstants(data.restapiHeaderValue, "key=value");
|
||||
cy.apiCreateGDS(
|
||||
"http://localhost:3000/api/v2/data_sources",
|
||||
`${Cypress.env("server_host")}/api/v2/data_sources`,
|
||||
data.ds,
|
||||
"restapi",
|
||||
[
|
||||
|
|
@ -380,7 +380,7 @@ describe("Workspace constants", () => {
|
|||
};
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url: `http://localhost:3000/api/app-environments/versions?app_id=${Cypress.env(
|
||||
url: `${Cypress.env("server_host")}/api/app-environments/versions?app_id=${Cypress.env(
|
||||
"appId"
|
||||
)}`,
|
||||
headers: headers,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ describe("User signup", () => {
|
|||
data.workspaceName = fake.companyName;
|
||||
|
||||
cy.visit("/");
|
||||
cy.wait(500)
|
||||
cy.get(commonSelectors.createAnAccountLink).realClick();
|
||||
SignUpPageElements();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ describe("dashboard", () => {
|
|||
data.cloneAppName = `cloned-${data.appName}`;
|
||||
data.updatedFolderName = `new-${data.folderName}`;
|
||||
|
||||
|
||||
beforeEach(() => {
|
||||
cy.intercept("GET", "/api/library_apps").as("appLibrary");
|
||||
cy.intercept("DELETE", "/api/folders/*").as("folderDeleted");
|
||||
|
|
@ -42,13 +41,18 @@ describe("dashboard", () => {
|
|||
cy.intercept("GET", "/api/apps?page=1&folder=&searchKey=", {
|
||||
fixture: "intercept/emptyDashboard.json",
|
||||
}).as("emptyDashboard");
|
||||
cy.intercept("GET", "/api/folders?searchKey=", { folders: [] }).as(
|
||||
"folders"
|
||||
);
|
||||
cy.intercept("GET", "api/metadata", {
|
||||
installed_version: "2.9.2",
|
||||
version_ignored: false,
|
||||
|
||||
cy.intercept("GET", "/api/folders?searchKey=", {
|
||||
body: { folders: [] },
|
||||
}).as("folders");
|
||||
|
||||
cy.intercept("GET", "/api/metadata", {
|
||||
body: {
|
||||
installed_version: "2.9.2",
|
||||
version_ignored: false,
|
||||
},
|
||||
}).as("version");
|
||||
|
||||
cy.defaultWorkspaceLogin();
|
||||
cy.wait("@emptyDashboard");
|
||||
cy.wait("@folders");
|
||||
|
|
@ -181,7 +185,7 @@ describe("dashboard", () => {
|
|||
cy.apiLogin();
|
||||
cy.apiCreateApp(data.appName);
|
||||
cy.openApp();
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout)
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout);
|
||||
|
||||
cy.backToApps();
|
||||
|
||||
|
|
@ -341,7 +345,6 @@ describe("dashboard", () => {
|
|||
});
|
||||
|
||||
it("Should verify the app CRUD operation", () => {
|
||||
|
||||
const customLayout = {
|
||||
desktop: { top: 100, left: 20 },
|
||||
mobile: { width: 8, height: 50 },
|
||||
|
|
@ -351,7 +354,7 @@ describe("dashboard", () => {
|
|||
data.appName = `${fake.companyName}-App`;
|
||||
cy.defaultWorkspaceLogin();
|
||||
cy.createApp(data.appName);
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout)
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout);
|
||||
|
||||
cy.backToApps();
|
||||
|
||||
|
|
@ -362,7 +365,7 @@ describe("dashboard", () => {
|
|||
|
||||
navigateToAppEditor(data.appName);
|
||||
// cy.get(commonSelectors.canvas).should("contain", "text1");
|
||||
cy.get('.text-widget-section > div').should('be.visible')
|
||||
cy.get(".text-widget-section > div").should("be.visible");
|
||||
cy.backToApps();
|
||||
cy.wait("@appLibrary");
|
||||
|
||||
|
|
@ -384,7 +387,7 @@ describe("dashboard", () => {
|
|||
cy.defaultWorkspaceLogin();
|
||||
cy.createApp(data.appName);
|
||||
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout)
|
||||
cy.addComponentToApp(data.appName, "text1", customLayout);
|
||||
|
||||
cy.backToApps();
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ describe("Redirection error pages", () => {
|
|||
cy.apiLogin("test@tooljet.com", "password");
|
||||
cy.visit(`/applications/${data.lastName}`);
|
||||
cy.get(commonSelectors.backToHomeButton).click();
|
||||
|
||||
|
||||
});
|
||||
|
||||
it("Verify error message in case of restricted access", () => {
|
||||
|
|
@ -68,7 +68,7 @@ describe("Redirection error pages", () => {
|
|||
"have.text",
|
||||
"Back to home page"
|
||||
);
|
||||
cy.url().should("eq", "http://localhost:8082/error/invalid-link");
|
||||
cy.url().should("eq", `${Cypress.config('baseUrl')}/error/invalid-link`);
|
||||
|
||||
cy.get(commonSelectors.backToHomeButton).click();
|
||||
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
||||
|
|
@ -85,7 +85,7 @@ describe("Redirection error pages", () => {
|
|||
cy.clearAndType(commonWidgetSelector.appSlugInput, data.slug);
|
||||
cy.wait(1000);
|
||||
|
||||
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
||||
cy.visit(`${Cypress.config('baseUrl')}/applications/${data.slug}`);
|
||||
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
||||
"have.text",
|
||||
"App URL Unavailable"
|
||||
|
|
@ -112,7 +112,7 @@ describe("Redirection error pages", () => {
|
|||
cy.apiLogin("test@tooljet.com", "password");
|
||||
cy.wait(500);
|
||||
|
||||
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
||||
cy.visit(`${Cypress.config('baseUrl')}/applications/${data.slug}`);
|
||||
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
||||
"have.text",
|
||||
"App URL Unavailable"
|
||||
|
|
@ -133,7 +133,7 @@ describe("Redirection error pages", () => {
|
|||
cy.apiLogin("test@tooljet.com", "password");
|
||||
cy.wait(500);
|
||||
|
||||
cy.visit(`http://localhost:8082/applications/${data.slug}`);
|
||||
cy.visit(`${Cypress.config('baseUrl')}/applications/${data.slug}`);
|
||||
cy.get(commonSelectors.modalHeader).verifyVisibleElement(
|
||||
"have.text",
|
||||
"App URL Unavailable"
|
||||
|
|
@ -146,7 +146,18 @@ describe("Redirection error pages", () => {
|
|||
"have.text",
|
||||
"Back to home page"
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
cy.url().should(
|
||||
"eq",
|
||||
<<<<<<< HEAD
|
||||
`${Cypress.config('baseUrl')}/error/url-unavailable?appSlug=${data.slug}`
|
||||
=======
|
||||
`http://localhost:8082/error/restricted`
|
||||
>>>>>>> main
|
||||
);
|
||||
=======
|
||||
cy.url().should('contain', '/error/')
|
||||
>>>>>>> main
|
||||
cy.get(commonSelectors.backToHomeButton).click();
|
||||
cy.get(commonSelectors.pageSectionHeader).should("be.visible");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ describe("Workspace", () => {
|
|||
);
|
||||
cy.get(dashboardSelector.slugField).verifyVisibleElement(
|
||||
"have.text",
|
||||
"http://localhost:8082/<workspace-slug>"
|
||||
`${Cypress.config('baseUrl')}/<workspace-slug>`
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
|
|
@ -120,7 +120,7 @@ describe("Workspace", () => {
|
|||
);
|
||||
cy.get(dashboardSelector.slugField).verifyVisibleElement(
|
||||
"have.text",
|
||||
`http://localhost:8082/${data.workspaceSlug}`
|
||||
`${Cypress.config('baseUrl')}/${data.workspaceSlug}`
|
||||
);
|
||||
cy.get(dashboardSelector.slugErrorLabel).verifyVisibleElement(
|
||||
"have.text",
|
||||
|
|
@ -171,7 +171,7 @@ describe("Workspace", () => {
|
|||
"have.text",
|
||||
data.workspaceName
|
||||
);
|
||||
cy.url().should("eq", `http://localhost:8082/${data.workspaceSlug}`);
|
||||
cy.url().should("eq", `${Cypress.config('baseUrl')}/${data.workspaceSlug}`);
|
||||
|
||||
cy.get(commonSelectors.workspaceName).click();
|
||||
cy.get(commonSelectors.editRectangleIcon).click();
|
||||
|
|
@ -211,7 +211,7 @@ describe("Workspace", () => {
|
|||
);
|
||||
cy.get(dashboardSelector.slugField).verifyVisibleElement(
|
||||
"have.text",
|
||||
`http://localhost:8082/${data.workspaceSlug}`
|
||||
`${Cypress.config('baseUrl')}/${data.workspaceSlug}`
|
||||
);
|
||||
cy.get(commonSelectors.cancelButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
|
|
@ -299,6 +299,6 @@ describe("Workspace", () => {
|
|||
"have.text",
|
||||
data.workspaceName
|
||||
);
|
||||
cy.url().should("eq", `http://localhost:8082/${data.workspaceSlug}`);
|
||||
cy.url().should("eq", `${Cypress.config('baseUrl')}/${data.workspaceSlug}`);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,3 +24,10 @@ import "@cypress/code-coverage/support";
|
|||
Cypress.on("uncaught:exception", (err, runnable) => {
|
||||
return false;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
if (Cypress.env("deployment") === "proxy") {
|
||||
cy.visit("/");
|
||||
cy.get("button").contains("Visit Site").click();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {
|
|||
|
||||
export const login = () => {
|
||||
cy.visit("/");
|
||||
cy.clearAndType(onboardingSelectors.emailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, "password");
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, "password");
|
||||
cy.get(onboardingSelectors.signInButton).click();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export const addQueryN = (queryName, query, dbName) => {
|
|||
cy.clearAndType('[data-cy="gds-querymanager-search-bar"]', `${dbName}`);
|
||||
}
|
||||
});
|
||||
cy.intercept("POST", "http://localhost:3000/api/data_queries").as(
|
||||
cy.intercept("POST", "/api/data_queries").as(
|
||||
"createQuery"
|
||||
);
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ export const addQueryN = (queryName, query, dbName) => {
|
|||
export const addQuery = (queryName, query, dbName) => {
|
||||
cy.get('[data-cy="show-ds-popover-button"]').click();
|
||||
cy.get(".css-1rrkggf-Input").type(`${dbName}`);
|
||||
cy.intercept("POST", "http://localhost:3000/api/data_queries").as(
|
||||
cy.intercept("POST", "/api/data_queries").as(
|
||||
"createQuery"
|
||||
);
|
||||
cy.contains(`[id*="react-select-"]`, dbName).click();
|
||||
|
|
@ -116,7 +116,7 @@ export const addQuery = (queryName, query, dbName) => {
|
|||
export const addQueryAndOpenEditor = (queryName, query, dbName, appName) => {
|
||||
cy.get('[data-cy="show-ds-popover-button"]').click();
|
||||
cy.get(".css-1rrkggf-Input").type(`${dbName}`);
|
||||
cy.intercept("POST", "http://localhost:3000/api/data_queries").as(
|
||||
cy.intercept("POST", "/api/data_queries").as(
|
||||
"createQuery"
|
||||
);
|
||||
cy.contains(`[id*="react-select-"]`, dbName).click();
|
||||
|
|
@ -181,7 +181,7 @@ export const createDataQuery = (appName, url, key, value) => {
|
|||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: "http://localhost:3000/api/data_queries",
|
||||
url: `${Cypress.env("server_host")}/api/data_queries`,
|
||||
headers: headers,
|
||||
body: {
|
||||
app_id: appId,
|
||||
|
|
@ -241,7 +241,7 @@ export const createrestAPIQuery = (data) => {
|
|||
};
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: "http://localhost:3000/api/data_queries",
|
||||
url: `${Cypress.env("server_host")}/api/data_queries`,
|
||||
headers: headers,
|
||||
body: requestBody,
|
||||
}).then((response) => {
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ export const addUserToGroup = (groupName, email) => {
|
|||
};
|
||||
|
||||
export const createGroupAddAppAndUserToGroup = (groupName, email) => {
|
||||
cy.intercept("GET", "http://localhost:3000/api/group_permissions").as(
|
||||
cy.intercept("GET", "/api/group_permissions").as(
|
||||
`${groupName}`
|
||||
);
|
||||
createGroup(groupName);
|
||||
|
|
@ -582,7 +582,7 @@ export const createGroupAddAppAndUserToGroup = (groupName, email) => {
|
|||
|
||||
cy.request({
|
||||
method: "PUT",
|
||||
url: `http://localhost:3000/api/group_permissions/${groupId}`,
|
||||
url: `${Cypress.env("server_host")}/api/group_permissions/${groupId}`,
|
||||
headers: headers,
|
||||
body: { add_apps: [Cypress.env("appId")] },
|
||||
}).then((patchResponse) => {
|
||||
|
|
@ -597,7 +597,7 @@ export const createGroupAddAppAndUserToGroup = (groupName, email) => {
|
|||
|
||||
cy.request({
|
||||
method: "PUT",
|
||||
url: `http://localhost:3000/api/group_permissions/${groupId}`,
|
||||
url: `${Cypress.env("server_host")}/api/group_permissions/${groupId}`,
|
||||
headers: headers,
|
||||
body: { add_users: [userId] },
|
||||
}).then((patchResponse) => {
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ export const workspaceLoginPageElements = (workspaceName) => {
|
|||
};
|
||||
|
||||
export const passwordLoginVisible = () => {
|
||||
cy.get(onboardingSelectors.emailInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.passwordInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.loginEmailInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.loginPasswordInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.signInButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
commonText.loginButton
|
||||
|
|
@ -241,8 +241,8 @@ export const passwordLoginVisible = () => {
|
|||
};
|
||||
|
||||
export const workspaceLogin = (workspaceName) => {
|
||||
cy.clearAndType(onboardingSelectors.emailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, "password");
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, "dev@tooljet.io");
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, "password");
|
||||
cy.get(onboardingSelectors.signInButton).click();
|
||||
cy.wait(2000);
|
||||
cy.get(commonSelectors.homePageLogo).should("be.visible");
|
||||
|
|
@ -297,8 +297,8 @@ export const signInPageElements = () => {
|
|||
commonText.loginButton
|
||||
);
|
||||
|
||||
cy.get(onboardingSelectors.emailInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.passwordInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.loginEmailInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.loginPasswordInput).should("be.visible");
|
||||
|
||||
cy.get("body").then(($el) => {
|
||||
if ($el.text().includes("Google")) {
|
||||
|
|
@ -474,7 +474,7 @@ export const invitePageElements = () => {
|
|||
"have.text",
|
||||
commonText.passwordLabel
|
||||
);
|
||||
cy.get(onboardingSelectors.passwordInput).should("be.visible");
|
||||
cy.get(onboardingSelectors.loginPasswordInput).should("be.visible");
|
||||
cy.get(commonSelectors.acceptInviteButton).verifyVisibleElement(
|
||||
"have.text",
|
||||
commonText.acceptInviteButton
|
||||
|
|
@ -535,7 +535,7 @@ export const defaultSSO = (enable) => {
|
|||
cy.request(
|
||||
{
|
||||
method: "PATCH",
|
||||
url: "http://localhost:3000/api/organizations",
|
||||
url: `${Cypress.env("server_host")}/api/organizations`,
|
||||
headers: {
|
||||
"Tj-Workspace-Id": Cypress.env("workspaceId"),
|
||||
Cookie: `tj_auth_token=${cookie.value}`,
|
||||
|
|
@ -559,7 +559,7 @@ export const setSignupStatus = (enable, workspaceName = 'My workspace') => {
|
|||
cy.getCookie("tj_auth_token").then((cookie) => {
|
||||
cy.request({
|
||||
method: "PATCH",
|
||||
url: "http://localhost:3000/api/organizations",
|
||||
url: `${Cypress.env("server_host")}/api/organizations`,
|
||||
headers: {
|
||||
"Tj-Workspace-Id": workspaceId,
|
||||
Cookie: `tj_auth_token=${cookie.value}`,
|
||||
|
|
@ -595,7 +595,7 @@ export const resetDomain = () => {
|
|||
cy.request(
|
||||
{
|
||||
method: "PATCH",
|
||||
url: "http://localhost:3000/api/organizations",
|
||||
url: `${Cypress.env("server_host")}/api/organizations`,
|
||||
headers: {
|
||||
"Tj-Workspace-Id": Cypress.env("workspaceId"),
|
||||
Cookie: `tj_auth_token=${cookie.value}`,
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export const manageUsersElements = () => {
|
|||
export const inviteUser = (firstName, email) => {
|
||||
cy.userInviteApi(firstName, email);
|
||||
fetchAndVisitInviteLink(email);
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, "password");
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, "password");
|
||||
cy.get(commonSelectors.acceptInviteButton).click();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -132,14 +132,14 @@ export const userSignUp = (fullName, email, workspaceName) => {
|
|||
let invitationLink;
|
||||
cy.intercept("GET", "/api/organizations/public-configs").as("publicConfig");
|
||||
cy.visit("/");
|
||||
cy.wait("@publicConfig"); // Wait for the API response
|
||||
cy.get(commonSelectors.createAnAccountLink).realClick(); // Proceed to click the link
|
||||
cy.wait("@publicConfig");
|
||||
cy.get(commonSelectors.createAnAccountLink).realClick();
|
||||
cy.get(onboardingSelectors.nameInput).should('not.be.disabled');
|
||||
cy.wait(3000)
|
||||
cy.get(onboardingSelectors.nameInput).clear();
|
||||
cy.get(onboardingSelectors.nameInput).type(fullName);
|
||||
cy.clearAndType(onboardingSelectors.emailInput, email);
|
||||
cy.clearAndType(onboardingSelectors.passwordInput, commonText.password);
|
||||
cy.clearAndType(onboardingSelectors.loginEmailInput, email);
|
||||
cy.clearAndType(onboardingSelectors.loginPasswordInput, commonText.password);
|
||||
cy.get(commonSelectors.signUpButton).click();
|
||||
|
||||
cy.wait(500);
|
||||
|
|
|
|||
|
|
@ -14,10 +14,29 @@ export const contantsNameValidation = (value, error) => {
|
|||
cy.get(workspaceConstantsSelectors.addConstantButton).should("be.disabled");
|
||||
};
|
||||
|
||||
export const AddNewconstants = (name, value) => {
|
||||
export const AddNewconstants = (name, value, type = "global") => {
|
||||
cy.get(workspaceConstantsSelectors.addNewConstantButton).click();
|
||||
cy.clearAndType(commonSelectors.nameInputField, name);
|
||||
cy.get(commonSelectors.valueInputField).click();
|
||||
cy.clearAndType(commonSelectors.valueInputField, value);
|
||||
cy.get(workspaceConstantsSelectors.constantsType(type)).check();
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).click();
|
||||
};
|
||||
|
||||
export const existingNameValidation = (
|
||||
constName,
|
||||
constValue,
|
||||
type = "Global"
|
||||
) => {
|
||||
cy.clearAndType(commonSelectors.nameInputField, constName);
|
||||
cy.get(workspaceConstantsSelectors.constantsType(type)).check();
|
||||
cy.get(commonSelectors.valueInputField).click();
|
||||
cy.clearAndType(commonSelectors.valueInputField, constValue);
|
||||
cy.get(workspaceConstantsSelectors.addConstantButton).click();
|
||||
cy.get(commonSelectors.toastMessage)
|
||||
.as("toast")
|
||||
.should(
|
||||
"contain.text",
|
||||
workspaceConstantsText.constantsExisitToast("Global")
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue