Skip to content

Commit

Permalink
Merge branch 'version-14' of https://github.com/frappe/frappe into ve…
Browse files Browse the repository at this point in the history
…rsion-14
  • Loading branch information
aliriocastro committed Jul 1, 2024
2 parents 71f0738 + 0f41be0 commit 50e478f
Show file tree
Hide file tree
Showing 199 changed files with 3,130 additions and 1,470 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ jobs:
- run: |
pip install pip-audit
cd ${GITHUB_WORKSPACE}
pip-audit --desc on --ignore-vuln GHSA-4xqq-73wg-5mjp .
pip-audit --desc on --ignore-vuln GHSA-4xqq-73wg-5mjp --ignore-vuln GHSA-2g68-c3qc-8985 .
44 changes: 0 additions & 44 deletions cypress/integration/api.js

This file was deleted.

37 changes: 0 additions & 37 deletions cypress/integration/control_attach.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,6 @@ context("Attach Control", () => {
});
});
});
it('Checking functionality for "Link" button in the "Attach" fieldtype', () => {
//Navigating to the new form for the newly created doctype
cy.new_form("Test Attach Control");

//Clicking on the attach button which is displayed as part of creating a doctype with "Attach" fieldtype
cy.findByRole("button", { name: "Attach" }).click();

//Clicking on "Link" button to attach a file using the "Link" button
cy.findByRole("button", { name: "Link" }).click();
cy.findByPlaceholderText("Attach a web link").type(
"https://wallpaperplay.com/walls/full/8/2/b/72402.jpg"
);

//Clicking on the Upload button to upload the file
cy.intercept("POST", "/api/method/upload_file").as("upload_image");
cy.get(".modal-footer").findByRole("button", { name: "Upload" }).click({ delay: 500 });
cy.wait("@upload_image");
cy.findByRole("button", { name: "Save" }).click();

//Checking if the URL of the attached image is getting displayed in the field of the newly created doctype
cy.get(".attached-file > .ellipsis > .attached-file-link")
.should("have.attr", "href")
.and("equal", "https://wallpaperplay.com/walls/full/8/2/b/72402.jpg");

//Clicking on the "Clear" button
cy.get('[data-action="clear_attachment"]').click();

//Checking if clicking on the clear button clears the field of the doctype form and again displays the attach button
cy.get(".control-input > .btn-sm").should("contain", "Attach");

//Deleting the doc
cy.go_to_list("Test Attach Control");
cy.get(".list-row-checkbox").eq(0).click();
cy.get(".actions-btn-group > .btn").contains("Actions").click();
cy.get('.actions-btn-group > .dropdown-menu [data-label="Delete"]').click();
cy.click_modal_primary_button("Yes");
});

it('Checking functionality for "Library" button in the "Attach" fieldtype', () => {
//Navigating to the new form for the newly created doctype
Expand Down
53 changes: 21 additions & 32 deletions cypress/integration/control_autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,53 @@
context("Control Autocomplete", () => {
before(() => {
cy.login();
cy.visit("/app/website");
cy.visit("/app");
cy.wait(4000);
});

function get_dialog_with_autocomplete(options) {
cy.visit("/app/website");
const get_dialog_with_autocomplete = (fieldname, options) => {
return cy.dialog({
title: "Autocomplete",
fields: [
{
label: "Select an option",
fieldname: "autocomplete",
fieldname: fieldname,
fieldtype: "Autocomplete",
options: options || ["Option 1", "Option 2", "Option 3"],
options: options,
},
],
});
}
};

it("should set the valid value", () => {
get_dialog_with_autocomplete().as("dialog");

cy.get(".frappe-control[data-fieldname=autocomplete] input").focus().as("input");
cy.wait(1000);
cy.get("@input").type("2", { delay: 300 });
cy.get(".frappe-control[data-fieldname=autocomplete]")
.findByRole("listbox")
.should("be.visible");
cy.get(".frappe-control[data-fieldname=autocomplete] input").type("{enter}", {
delay: 300,
});
cy.get(".frappe-control[data-fieldname=autocomplete] input").blur();
const fieldname = "autocomplete_1";
get_dialog_with_autocomplete(fieldname, ["Option 1", "Option 2", "Option 3"]).as("dialog");
cy.get(`.control-input > .awesomplete > input[data-fieldname=${fieldname}]`).as("input");
cy.wait(500);
cy.get("@input").type("2{enter}", { delay: 300 });
cy.get("@dialog").then((dialog) => {
let value = dialog.get_value("autocomplete");
let value = dialog.get_value(fieldname);
expect(value).to.eq("Option 2");
dialog.clear();
dialog.hide();
});
});

it("should set the valid value with different label", () => {
const options_with_label = [
const fieldname = "autocomplete_2";
get_dialog_with_autocomplete(fieldname, [
{ label: "Option 1", value: "option_1" },
{ label: "Option 2", value: "option_2" },
];
get_dialog_with_autocomplete(options_with_label).as("dialog");
]).as("dialog");

cy.get(".frappe-control[data-fieldname=autocomplete] input").focus().as("input");
cy.get(".frappe-control[data-fieldname=autocomplete]")
.findByRole("listbox")
.should("be.visible");
cy.get("@input").type("2", { delay: 300 });
cy.get(".frappe-control[data-fieldname=autocomplete] input").type("{enter}", {
delay: 300,
});
cy.get(".frappe-control[data-fieldname=autocomplete] input").blur();
cy.get(`.control-input > .awesomplete > input[data-fieldname=${fieldname}]`).as("input");
cy.wait(500);
cy.get("@input").type("2{enter}", { delay: 300 });
cy.get("@dialog").then((dialog) => {
let value = dialog.get_value("autocomplete");
let value = dialog.get_value(fieldname);
expect(value).to.eq("option_2");
dialog.clear();
dialog.hide();
});
});
});
3 changes: 3 additions & 0 deletions cypress/integration/control_duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ context("Control Duration", () => {

it("should set duration", () => {
get_dialog_with_duration().as("dialog");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=duration] input").first().click();
cy.get(".duration-input[data-duration=days]")
.type(45, { force: true })
.blur({ force: true });
cy.wait(500);
cy.get(".duration-input[data-duration=minutes]").type(30).blur({ force: true });
cy.wait(500);
cy.get(".frappe-control[data-fieldname=duration] input")
.first()
.should("have.value", "45d 30m");
Expand Down
11 changes: 9 additions & 2 deletions cypress/integration/control_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ context("Control Link", () => {
}

function get_dialog_with_gender_link() {
return cy.dialog({
let dialog = cy.dialog({
title: "Link",
fields: [
{
Expand All @@ -38,6 +38,8 @@ context("Control Link", () => {
},
],
});
cy.wait(500);
return dialog;
}

it("should set the valid value", () => {
Expand All @@ -62,6 +64,7 @@ context("Control Link", () => {
cy.wait("@search_link");
cy.get("@input").type("todo for link", { delay: 200 });
cy.wait("@search_link");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=link]").findByRole("listbox").should("be.visible");
cy.get(".frappe-control[data-fieldname=link] input").type("{enter}", { delay: 100 });
cy.get(".frappe-control[data-fieldname=link] input").blur();
Expand All @@ -82,6 +85,7 @@ context("Control Link", () => {
.type("invalid value", { delay: 100 })
.blur();
cy.wait("@validate_link");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=link] input").should("have.value", "");
});

Expand All @@ -92,6 +96,7 @@ context("Control Link", () => {

cy.get(".frappe-control[data-fieldname=link] input").type(" ", { delay: 100 }).blur();
cy.wait("@validate_link");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=link] input").should("have.value", "");
cy.window()
.its("cur_dialog")
Expand Down Expand Up @@ -263,6 +268,7 @@ context("Control Link", () => {
cy.wait("@search_link");
cy.get("@input").type("Sonstiges", { delay: 100 });
cy.wait("@search_link");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=link] ul").should("be.visible");
cy.get(".frappe-control[data-fieldname=link] input").type("{enter}", { delay: 100 });
cy.get(".frappe-control[data-fieldname=link] input").blur();
Expand All @@ -285,7 +291,7 @@ context("Control Link", () => {
});

cy.clear_cache();
cy.wait(500);
cy.wait(1000);

get_dialog_with_gender_link().as("dialog");
cy.intercept("POST", "/api/method/frappe.desk.search.search_link").as("search_link");
Expand All @@ -294,6 +300,7 @@ context("Control Link", () => {
cy.wait("@search_link");
cy.get("@input").type("Non-Conforming", { delay: 100 });
cy.wait("@search_link");
cy.wait(500);
cy.get(".frappe-control[data-fieldname=link] ul").should("be.visible");
cy.get(".frappe-control[data-fieldname=link] input").type("{enter}", { delay: 100 });
cy.get(".frappe-control[data-fieldname=link] input").blur();
Expand Down
41 changes: 5 additions & 36 deletions cypress/integration/file_uploader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
context("FileUploader", () => {
before(() => {
cy.login();
});

beforeEach(() => {
cy.visit("/app");
cy.wait(2000); // workspace can load async and clear active dialog
});

function open_upload_dialog() {
Expand All @@ -10,6 +14,7 @@ context("FileUploader", () => {
.then((frappe) => {
new frappe.ui.FileUploader();
});
cy.wait(500);
}

it("upload dialog api works", () => {
Expand Down Expand Up @@ -47,40 +52,4 @@ context("FileUploader", () => {
.should("have.property", "file_name", "example.json");
cy.get(".modal:visible").should("not.exist");
});

it("should accept web links", () => {
open_upload_dialog();

cy.get_open_dialog().findByRole("button", { name: "Link" }).click();
cy.get_open_dialog()
.findByPlaceholderText("Attach a web link")
.type("https://github.com", { delay: 100, force: true });
cy.intercept("POST", "/api/method/upload_file").as("upload_file");
cy.get_open_dialog().findByRole("button", { name: "Upload" }).click();
cy.wait("@upload_file")
.its("response.body.message")
.should("have.property", "file_url", "https://github.com");
cy.get(".modal:visible").should("not.exist");
});

it("should allow cropping and optimization for valid images", () => {
open_upload_dialog();

cy.get_open_dialog()
.find(".file-upload-area")
.selectFile("cypress/fixtures/sample_image.jpg", {
action: "drag-drop",
});

cy.get_open_dialog().findAllByText("sample_image.jpg").should("exist");
cy.get_open_dialog().find(".btn-crop").first().click();
cy.get_open_dialog().findByRole("button", { name: "Crop" }).click();
cy.get_open_dialog().findAllByRole("checkbox", { name: "Optimize" }).should("exist");
cy.get_open_dialog().findAllByLabelText("Optimize").first().click();

cy.intercept("POST", "/api/method/upload_file").as("upload_file");
cy.get_open_dialog().findByRole("button", { name: "Upload" }).click();
cy.wait("@upload_file").its("response.statusCode").should("eq", 200);
cy.get(".modal:visible").should("not.exist");
});
});
26 changes: 0 additions & 26 deletions cypress/integration/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@ context("Form", () => {
cy.get(".list-row").should("contain", "this is a test todo");
});

it("navigates between documents with child table list filters applied", () => {
cy.visit("/app/contact");

cy.clear_filters();
cy.get('.standard-filter-section [data-fieldname="name"] input')
.type("Test Form Contact 3")
.blur();
cy.click_listview_row_item_with_text("Test Form Contact 3");

cy.get("#page-Contact .page-head").findByTitle("Test Form Contact 3").should("exist");
cy.get(".prev-doc").should("be.visible").click();
cy.get(".msgprint-dialog .modal-body").contains("No further records").should("be.visible");
cy.hide_dialog();

cy.get("#page-Contact .page-head").findByTitle("Test Form Contact 3").should("exist");
cy.get(".next-doc").should("be.visible").click();
cy.get(".msgprint-dialog .modal-body").contains("No further records").should("be.visible");
cy.hide_dialog();

cy.get("#page-Contact .page-head").findByTitle("Test Form Contact 3").should("exist");

// clear filters
cy.visit("/app/contact");
cy.clear_filters();
});

it("validates behaviour of Data options validations in child table", () => {
// test email validations for set_invalid controller
let website_input = "website.in";
Expand Down
42 changes: 0 additions & 42 deletions cypress/integration/list_paging.js

This file was deleted.

Loading

0 comments on commit 50e478f

Please sign in to comment.