Merge pull request #21400 from surajshetty3416/fix-tests

This commit is contained in:
Suraj Shetty 2023-06-16 13:27:33 +05:30 committed by GitHub
commit 53b074c16a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 17 deletions

View file

@ -42,14 +42,14 @@ context("Control Icon", () => {
it("search for icon and clear search input", () => {
let search_text = "ed";
cy.get(".icon-picker").findByRole("searchbox").click().type(search_text);
cy.get(".icon-picker").get(".search-icons > input").click().type(search_text);
cy.get(".icon-section .icon-wrapper:not(.hidden)").then((i) => {
cy.get(`.icon-section .icon-wrapper[id*='${search_text}']`).then((icons) => {
expect(i.length).to.equal(icons.length);
});
});
cy.get(".icon-picker").findByRole("searchbox").clear().blur();
cy.get(".icon-picker").get(".search-icons > input").clear().blur();
cy.get(".icon-section .icon-wrapper").should("not.have.class", "hidden");
});
});

View file

@ -133,8 +133,7 @@ context("Control Link", () => {
true
);
cy.clear_cache();
cy.wait(500);
cy.reload();
get_dialog_with_link().as("dialog");
cy.window()
@ -177,7 +176,7 @@ context("Control Link", () => {
cy.intercept("POST", "/api/method/frappe.client.validate_link").as("validate_link");
cy.get(".frappe-control[data-fieldname=assigned_by] input").focus().as("input");
cy.get("@input").type(cy.config("testUser"), { delay: 100 }).blur();
cy.get("@input").clear().type(cy.config("testUser"), { delay: 300 }).blur();
cy.wait("@validate_link");
cy.get(".frappe-control[data-fieldname=assigned_by_full_name] .control-value").should(
"contain",

View file

@ -47,7 +47,7 @@ context("Control Phone", () => {
it("case insensitive search for country and clear search", () => {
let search_text = "india";
cy.get(".selected-phone").click().first();
cy.get(".phone-picker").findByRole("searchbox").click().type(search_text);
cy.get(".phone-picker").get(".search-phones").click().type(search_text);
cy.get(".phone-section .phone-wrapper:not(.hidden)").then((i) => {
cy.get(`.phone-section .phone-wrapper[id*="${search_text.toLowerCase()}"]`).then(
(countries) => {
@ -56,7 +56,7 @@ context("Control Phone", () => {
);
});
cy.get(".phone-picker").findByRole("searchbox").clear().blur();
cy.get(".phone-picker").get(".search-phones").clear();
cy.get(".phone-section .phone-wrapper").should("not.have.class", "hidden");
});

View file

@ -11,9 +11,9 @@ context("Folder Navigation", () => {
cy.click_filter_button();
cy.get(".filter-action-buttons > .text-muted").findByText("+ Add a Filter").click();
cy.get(".fieldname-select-area > .awesomplete > .form-control:last").type("Fol{enter}");
cy.get(
".filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback"
).type("Home{enter}");
cy.get(".filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback")
.first()
.type("Home{enter}");
cy.get(".filter-action-buttons > div > .btn-primary").findByText("Apply Filters").click();
//Adding folder (Test Folder)
@ -24,6 +24,7 @@ context("Folder Navigation", () => {
it("Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct", () => {
//Navigating inside the Attachments folder
cy.clear_filters();
cy.wait(500);
cy.get('[title="Attachments"] > span').click();

View file

@ -100,15 +100,15 @@ context("Kanban Board", () => {
it("Checks if Kanban Board edits are blocked for non-System Manager and non-owner of the Board", () => {
cy.switch_to_user("Administrator");
const noSystemManager = "nosysmanager@example.com";
const not_system_manager = "nosysmanager@example.com";
cy.call("frappe.tests.ui_test_helpers.create_test_user", {
username: noSystemManager,
username: not_system_manager,
});
cy.remove_role(noSystemManager, "System Manager");
cy.remove_role(not_system_manager, "System Manager");
cy.call("frappe.tests.ui_test_helpers.create_todo", { description: "Frappe User ToDo" });
cy.call("frappe.tests.ui_test_helpers.create_admin_kanban");
cy.switch_to_user(noSystemManager);
cy.switch_to_user(not_system_manager);
cy.visit("/app/todo/view/kanban/Admin Kanban");
@ -125,7 +125,7 @@ context("Kanban Board", () => {
cy.get(".kanban .column-options").should("have.length", 0);
cy.switch_to_user("Administrator");
cy.call("frappe.client.delete", { doctype: "User", name: noSystemManager });
cy.call("frappe.client.delete", { doctype: "User", name: not_system_manager });
});
after(() => {

View file

@ -34,7 +34,7 @@ Cypress.Commands.add("login", (email, password) => {
if (!password) {
password = Cypress.env("adminPassword");
}
cy.request({
return cy.request({
url: "/api/method/login",
method: "POST",
body: {
@ -373,7 +373,9 @@ Cypress.Commands.add("update_doc", (doctype, docname, args) => {
Cypress.Commands.add("switch_to_user", (user) => {
cy.call("logout");
cy.wait(200);
cy.login(user);
cy.reload();
});
Cypress.Commands.add("add_role", (user, role) => {

View file

@ -163,7 +163,7 @@ $.extend(frappe.model, {
if (!user_default) {
user_default = frappe.defaults.get_user_default(df.fieldname);
}
}
if (
!user_default &&
df.remember_last_selected_value &&