test: Fix failing tests

This commit is contained in:
Suraj Shetty 2023-09-25 11:46:03 +05:30
parent 4ee8db9515
commit de3a93bb0c
4 changed files with 11 additions and 9 deletions

View file

@ -243,13 +243,17 @@ context("Form Builder", () => {
cy.get(".sidebar-container .frappe-control[data-fieldname='fieldname'] input")
.click()
.as("input");
cy.get("@input").clear({ force: true }).type("data3");
cy.get(".sidebar-container .frappe-control[data-fieldname='fieldname'] input")
.clear({ force: true })
.type("data3");
cy.click_doc_primary_button("Save");
cy.get_open_dialog().find(".msgprint").should("contain", "appears multiple times");
cy.hide_dialog();
cy.get(first_field).click();
cy.get("@input").clear({ force: true });
cy.get(".sidebar-container .frappe-control[data-fieldname='fieldname'] input").clear({
force: true,
});
// validate reqd + hidden without default
cy.get(".sidebar-container .field label .label-area").contains("Mandatory").click();

View file

@ -36,7 +36,7 @@ context("Login", () => {
cy.get("#login_password").type(Cypress.env("adminPassword"));
cy.findByRole("button", { name: "Login" }).click();
cy.location("pathname").should("eq", "/app");
cy.location("pathname").should("eq", "/app/users");
cy.window().its("frappe.session.user").should("eq", "Administrator");
});

View file

@ -36,9 +36,9 @@ const attach_file = (file, no_of_files = 1) => {
context("Sidebar", () => {
before(() => {
cy.visit("/login");
cy.visit("/");
cy.login();
cy.visit("/app");
return cy
.window()
.its("frappe")

View file

@ -34,7 +34,7 @@ Cypress.Commands.add("login", (email, password) => {
if (!password) {
password = Cypress.env("adminPassword");
}
cy.session(
return cy.session(
[email, password] || "",
() => {
return cy.request({
@ -53,9 +53,6 @@ Cypress.Commands.add("login", (email, password) => {
});
Cypress.Commands.add("call", (method, args) => {
if (method === "logout") {
cy.visit("/");
}
return cy
.window()
.its("frappe.csrf_token")
@ -173,6 +170,7 @@ Cypress.Commands.add("fill_field", (fieldname, value, fieldtype = "Data") => {
}
if (fieldtype === "Select") {
cy.log("Selecting value", value);
cy.get("@input").select(value);
} else {
cy.get("@input").type(value, {