Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release' into chore/remove-serve…
Browse files Browse the repository at this point in the history
…r-side-filtering-flag
  • Loading branch information
dhruvikn committed Sep 27, 2023
2 parents 064219c + 2719225 commit 60521de
Show file tree
Hide file tree
Showing 64 changed files with 890 additions and 277 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ RUN rm -rf \
VOLUME [ "/appsmith-stacks" ]

# ------------------------------------------------------------------------
ENV TMP /tmp/appsmith
ENV TMP="/tmp/appsmith"
ENV NGINX_WWW_PATH="$TMP/www"

# Add backend server - Application Layer
ARG JAR_FILE=./app/server/dist/server-*.jar
Expand Down Expand Up @@ -81,9 +82,10 @@ COPY ./app/client/packages/rts/package.json ./app/client/packages/rts/dist rts/

RUN cd ./utils && npm install --only=prod && npm install --only=prod -g . && cd - \
&& chmod 0644 /etc/cron.d/* \
&& chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh /watchtower-hooks/*.sh \
&& chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh templates/nginx-app.conf.sh /watchtower-hooks/*.sh \
# Disable setuid/setgid bits for the files inside container.
&& find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true
&& find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true \
&& node prepare-image.mjs

# Update path to load appsmith utils tool as default
ENV PATH /opt/appsmith/utils/node_modules/.bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ Let's build great software together.
[![rajatagrawal](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/1189106?v=4&w=50&h=50&mask=circle)](https://github.com/rajatagrawal)
[![nsarupr](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/20905988?v=4&w=50&h=50&mask=circle)](https://github.com/nsarupr)
[![NilanshBansal](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/25542733?v=4&w=50&h=50&mask=circle)](https://github.com/NilanshBansal)
[![sondermanish](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/107841575?v=4&w=50&h=50&mask=circle)](https://github.com/sondermanish)
[![dhruvikn](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/22471214?v=4&w=50&h=50&mask=circle)](https://github.com/dhruvikn)
[![sondermanish](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/107841575?v=4&w=50&h=50&mask=circle)](https://github.com/sondermanish)
[![areyabhishek](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/30255708?v=4&w=50&h=50&mask=circle)](https://github.com/areyabhishek)
[![KelvinOm](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/11555074?v=4&w=50&h=50&mask=circle)](https://github.com/KelvinOm)
[![Druthi](https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/20187542?v=4&w=50&h=50&mask=circle)](https://github.com/Druthi)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
import {
agHelper,
locators,
entityExplorer,
deployMode,
propPane,
} from "../../../../../support/Objects/ObjectsCore";

describe("Verify file picker widget", () => {
before(() => {
agHelper.AddDsl("filepickerDsl");
});
it("1. Verify property visibility", () => {
const basicProperties = [
"allowedfiletypes",
"dataformat",
`maxno\\.offiles`,
];

const labelProperties = ["text"];

const validationProperties = ["required", "maxfilesize\\(mb\\)"];

const generalProperties = ["visible", "disable", "animateloading"];

const eventsProperties = ["onfilesselected"];

const styleColorProperties = ["buttoncolor"];

const styleBorderProperties = ["borderradius", "boxshadow"];

entityExplorer.SelectEntityByName("FilePicker1", "Widgets");

propPane.AssertPropertyVisibility(basicProperties, "basic");
propPane.AssertPropertyVisibility(labelProperties, "label");
propPane.AssertPropertyVisibility(validationProperties, "validation");
propPane.AssertPropertyVisibility(generalProperties, "general");
propPane.AssertPropertyVisibility(eventsProperties, "events");
propPane.MoveToTab("Style");
propPane.AssertPropertyVisibility(styleColorProperties, "color");
propPane.AssertPropertyVisibility(styleBorderProperties, "borderandshadow");
});

it("2. Verify Renaming, duplication and deletion", () => {
// Rename and verify
entityExplorer.RenameEntityFromExplorer(
"FilePicker1",
"NewFilePicker",
true,
);
agHelper.AssertElementVisibility(locators._widgetName("NewFilePicker"));

// Copy and paste widget using cmd+c and cmd+v
entityExplorer.CopyPasteWidget("NewFilePicker");
entityExplorer.AssertEntityPresenceInExplorer("NewFilePickerCopy");
entityExplorer.DeleteWidgetFromEntityExplorer("NewFilePickerCopy");

// Copy paste from property pane and delete from property pane
propPane.CopyPasteWidgetFromPropertyPane("NewFilePicker");
propPane.DeleteWidgetFromPropertyPane("NewFilePickerCopy");
entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
propPane.MoveToTab("Content");
});

it("3. Verify max number of files", () => {
agHelper.AssertText(locators._buttonText, "text", "Select Files");
propPane.UpdatePropertyFieldValue("Max no. of files", "2");
agHelper.ClickButton("Select Files");
agHelper.UploadFile("AAAFlowerVase.jpeg");
// Verify Add more is visible
agHelper.GetNClick(locators._buttonInDeployedMode, 0, true);
agHelper.AssertElementVisibility(locators._fileUploadAddMore);
agHelper.GetNClick(locators._fileUploadAddMore);

// Verify Add more does not exist when max no. files are added
agHelper.UploadFile("appsmithlogo.png");
agHelper.GetNClick(locators._buttonInDeployedMode, 0, true);
agHelper.AssertElementAbsence(locators._fileUploadAddMore);
agHelper.GetNClick(locators._fileUploadDashboardClose);

agHelper.AssertText(locators._buttonText, "text", "2 files selected");
});

it("4. Verify Validation max file size supported", () => {
propPane.UpdatePropertyFieldValue("Max file size(Mb)", "1");
agHelper.GetNClick(locators._buttonInDeployedMode, 0, true);
agHelper.GetNClick('[title="Remove file"]');
agHelper.GetNClick(locators._fileUploadAddMore);
agHelper
.GetElement(locators._uploadFiles)
.eq(0)
.selectFile("cypress/fixtures/Appsmith.gif", { force: true })
.wait(3000);
agHelper.AssertElementVisibility(
locators._fileUploadErrorContains(
"This file exceeds maximum allowed size of 1 MB ",
),
);
agHelper.GetNClick(locators._fileUploadDashboardClose);
});

it("5. Validate visible and disabled toggle", () => {
propPane.TogglePropertyState("visible", "Off");

// Preview mode
agHelper.GetNClick(locators._enterPreviewMode);
agHelper.AssertElementAbsence(
locators._widgetInDeployed("filepickerwidgetv2"),
);
agHelper.GetNClick(locators._exitPreviewMode);

// Deploy mode
deployMode.DeployApp();
agHelper.AssertElementAbsence(
locators._widgetInDeployed("filepickerwidgetv2"),
);
deployMode.NavigateBacktoEditor();

entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
propPane.TogglePropertyState("visible", "On");

// Preview mode
agHelper.GetNClick(locators._enterPreviewMode);
agHelper.AssertElementVisibility(
locators._widgetInDeployed("filepickerwidgetv2"),
);
agHelper.GetNClick(locators._exitPreviewMode);

// Deploy mode
deployMode.DeployApp();
agHelper.AssertElementVisibility(
locators._widgetInDeployed("filepickerwidgetv2"),
);
deployMode.NavigateBacktoEditor();

// Visible JS mode
entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
propPane.ToggleJSMode("Visible", true);
propPane.UpdatePropertyFieldValue("Visible", "false");

deployMode.DeployApp();
agHelper.AssertElementAbsence(
locators._widgetInDeployed("filepickerwidgetv2"),
);
deployMode.NavigateBacktoEditor();

entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
propPane.ToggleJSMode("Visible", true);
propPane.UpdatePropertyFieldValue("Visible", "true");
propPane.ToggleJSMode("Visible", false);

// Disabled
propPane.TogglePropertyState("disable", "On");
agHelper.AssertAttribute(
locators._widgetInDeployed("filepickerwidgetv2"),
"disabled",
"disabled",
);

// Preview mode
agHelper.GetNClick(locators._enterPreviewMode);
agHelper.AssertAttribute(
locators._widgetInDeployed("filepickerwidgetv2"),
"disabled",
"disabled",
);
agHelper.GetNClick(locators._exitPreviewMode);

// Deploy mode
deployMode.DeployApp();
agHelper.AssertAttribute(
locators._widgetInDeployed("filepickerwidgetv2"),
"disabled",
"disabled",
);
deployMode.NavigateBacktoEditor();

entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
propPane.TogglePropertyState("disable", "Off");
});

it("6. Verify onFilesSelected", () => {
propPane.ToggleJSMode("onFilesSelected", true);
propPane.UpdatePropertyFieldValue(
"onFilesSelected",
"{{showAlert('File Selected', '');}}",
);
deployMode.DeployApp();
agHelper.ClickButton("Select Files");
agHelper.UploadFile("appsmithlogo.png");
agHelper.ValidateToastMessage("File Selected");
deployMode.NavigateBacktoEditor();
});

it("7. Verify button color and border and shadows", () => {
entityExplorer.SelectEntityByName("NewFilePicker", "Widgets");
// Verify button color picker opens up
propPane.MoveToTab("Style");
agHelper.GetNClick(propPane._propertyControlColorPicker("buttoncolor"));
agHelper.AssertElementVisibility(propPane._colorPickerV2Color);
// Verify full color picker
agHelper.AssertAttribute(propPane._colorPickerInput, "type", "text", 0);
propPane.TogglePropertyState("buttoncolor", "On", "");
agHelper.AssertAttribute(propPane._colorPickerInput, "type", "color", 0);

// Verify border
agHelper.GetNClick(propPane._segmentedControl("0px"));
agHelper.AssertCSS(locators._buttonInDeployedMode, "border-radius", "0px");

// Verify Box Shadow
agHelper.GetNClick(`${propPane._segmentedControl("0")}:contains('Large')`);
agHelper.AssertCSS(
locators._buttonInDeployedMode,
"box-shadow",
"rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px",
);
});
});
Binary file added app/client/cypress/fixtures/Appsmith.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,9 @@ export class CommonLocators {
_callbackAddBtn = ".action-callback-add .ads-v2-button";
_checkboxInDeployedMode = "//label[contains(@class, 'bp3-checkbox')]//input";
_listText = "//span[text()='Blue']/../..";
_fileUploadDashboardClose = ".uppy-Dashboard-close";
_fileUploadErrorContains = (msg: string) =>
`.uppy-Informer p:contains('${msg}')`;
_fileUploadAddMore = ".uppy-DashboardContent-addMore";
_buttonText = ".bp3-button-text";
}
2 changes: 1 addition & 1 deletion app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"fuse.js": "^3.4.5",
"fusioncharts": "^3.18.0",
"fusionmaps": "^3.18.0",
"graphql": "^16.3.0",
"graphql": "^16.8.1",
"history": "^4.10.1",
"http-proxy": "^1.18.1",
"immer": "^9.0.6",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const KBViewerFloatingButton = () => {
return null;
};

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const KBEditorMenuItem = () => {
return null;
};

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -267,94 +267,5 @@ describe("7. Test util methods", () => {
expect(evalProps).toEqual(initialEvalProps);
});
});

describe("serialise", () => {
it("should clean out all functions in the generated state", () => {
const state = {
Table1: {
filteredTableData: smallDataSet,
selectedRows: [],
// eslint-disable-next-line @typescript-eslint/no-empty-function
someFn: () => {},
pageSize: 0,
__evaluation__: {
evaluatedValues: {},
},
},
} as any;

const identicalEvalPathsPatches = {
"Table1.__evaluation__.evaluatedValues.['filteredTableData']":
"Table1.filteredTableData",
};
const evalProps = {
Table1: {
__evaluation__: {
evaluatedValues: {
someProp: "abc",
// eslint-disable-next-line @typescript-eslint/no-empty-function
someEvalFn: () => {},
},
},
},
} as any;
const dataTree = makeEntityConfigsAsObjProperties(state, {
sanitizeDataTree: true,
evalProps,
identicalEvalPathsPatches,
}) as any;
const expectedState = produce(state, (draft: any) => {
draft.Table1.__evaluation__.evaluatedValues.someProp = "abc";
delete draft.Table1.someFn;
draft.Table1.__evaluation__.evaluatedValues.filteredTableData =
smallDataSet;
});

expect(dataTree).toEqual(expectedState);
//function introduced by evalProps is cleaned out
expect(
dataTree.Table1.__evaluation__.evaluatedValues.someEvalFn,
).toBeUndefined();
});

it("should serialise bigInteger values", () => {
const someBigInt = BigInt(121221);
const state = {
Table1: {
pageSize: someBigInt,
__evaluation__: {
evaluatedValues: {},
},
},
} as any;

const identicalEvalPathsPatches = {
"Table1.__evaluation__.evaluatedValues.['pageSize']":
"Table1.pageSize",
};
const evalProps = {
Table1: {
__evaluation__: {
evaluatedValues: {
someProp: someBigInt,
},
},
},
} as any;

const dataTree = makeEntityConfigsAsObjProperties(state, {
sanitizeDataTree: true,
evalProps,
identicalEvalPathsPatches,
});
const expectedState = produce(state, (draft: any) => {
draft.Table1.pageSize = "121221";
draft.Table1.__evaluation__.evaluatedValues.pageSize = "121221";
draft.Table1.__evaluation__.evaluatedValues.someProp = "121221";
});

expect(dataTree).toEqual(expectedState);
});
});
});
});
Loading

0 comments on commit 60521de

Please sign in to comment.