Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Cypress test for validating file uploads greater than 20MB #38496

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const commonlocators = require("../../../../locators/commonlocators.json");
import {
agHelper,
apiPage,
dataManager,
draggableWidgets,
entityExplorer,
locators,
propPane,
} from "../../../../support/Objects/ObjectsCore";
const apiwidget = require("../../../../locators/apiWidgetslocator.json");

describe(
"To test [Bug]: A-force -> Not being able to upload file using binary format and multi part form data #34123",
{ tags: ["@tag.Datasource", "@tag.Git", "@tag.AccessControl"] },
() => {
// Bug: https://github.com/appsmithorg/appsmith/issues/34123
it("1. Validate whether file >20MB can be uploaded", () => {
// Step 1: Add a File Picker widget and configure it
entityExplorer.DragDropWidgetNVerify(draggableWidgets.FILEPICKER);

// Set allowed file types
propPane.EnterJSContext("Allowed file types", `["*"]`);

// Set file data format to 'Array of Objects'
cy.get(commonlocators.filePickerDataFormat).click({ force: true });
cy.contains("Array of Objects").should("be.visible").click();

// Set max file size to 50MB
propPane.UpdatePropertyFieldValue("Max file size(Mb)", "50");

// Step 2: Upload a file greater than 20MB
agHelper.ClickButton("Select Files");
agHelper.UploadFile("FileGreaterThan20MB.json");

// Assert that the file is selected
agHelper.AssertText(locators._buttonText, "text", "1 files selected");

// Step 3: Create and configure the API
apiPage.CreateAndFillApi(
dataManager.dsValues[dataManager.defaultEnviorment].multipartAPI,
"TestUpload20MB",
80000,
"POST",
);
apiPage.EnterBodyFormData(
"MULTIPART_FORM_DATA",
"file",
"{{FilePicker1.files[0]}}",
"File",
);

// Step 4: Run the API and verify the response
apiPage.RunAPI();
apiPage.ResponseStatusCheck("200");

// Assert the response contains the uploaded file name
cy.get(apiwidget.responseText).contains(
`"file": "FileGreaterThan20MB.json"`,
);
});
},
);
Loading
Loading