選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

149 行
5.4 KiB

  1. context("Data Control", () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit("/app/doctype");
  5. return cy
  6. .window()
  7. .its("xhiveframework")
  8. .then((xhiveframework) => {
  9. return xhiveframework.xcall("xhiveframework.tests.ui_test_helpers.create_doctype", {
  10. name: "Test Data Control",
  11. fields: [
  12. {
  13. label: "Name",
  14. fieldname: "name1",
  15. fieldtype: "Data",
  16. options: "Name",
  17. in_list_view: 1,
  18. reqd: 1,
  19. },
  20. {
  21. label: "Email-ID",
  22. fieldname: "email",
  23. fieldtype: "Data",
  24. options: "Email",
  25. in_list_view: 1,
  26. reqd: 1,
  27. },
  28. {
  29. label: "Phone No.",
  30. fieldname: "phone",
  31. fieldtype: "Data",
  32. options: "Phone",
  33. in_list_view: 1,
  34. reqd: 1,
  35. },
  36. ],
  37. });
  38. });
  39. });
  40. it("check custom formatters", () => {
  41. cy.visit(`/app/doctype/User`);
  42. cy.get(
  43. '[data-fieldname="fields"] .grid-row[data-idx="3"] [data-fieldname="fieldtype"] .static-area'
  44. ).should("have.text", "Section Break");
  45. });
  46. it('Verifying data control by inputting different patterns for "Name" field', () => {
  47. cy.new_form("Test Data Control");
  48. //Checking the URL for the new form of the doctype
  49. cy.location("pathname").should("contains", "/app/test-data-control/new-test-data-control");
  50. cy.get(".title-text").should("have.text", "New Test Data Control");
  51. cy.get('.xhiveframework-control[data-fieldname="name1"]')
  52. .find("label")
  53. .should("have.class", "reqd");
  54. cy.get('.xhiveframework-control[data-fieldname="email"]')
  55. .find("label")
  56. .should("have.class", "reqd");
  57. cy.get('.xhiveframework-control[data-fieldname="phone"]')
  58. .find("label")
  59. .should("have.class", "reqd");
  60. //Checking if the status is "Not Saved" initially
  61. cy.get(".indicator-pill").should("have.text", "Not Saved");
  62. //Inputting data in the field
  63. cy.fill_field("name1", "@@###", "Data");
  64. cy.fill_field("email", "test@example.com", "Data");
  65. cy.fill_field("phone", "9834280031", "Data");
  66. //Checking if the border color of the field changes to red
  67. cy.get('.xhiveframework-control[data-fieldname="name1"]').should("have.class", "has-error");
  68. cy.save();
  69. //Checking for the error message
  70. cy.get(".modal-title").should("have.text", "Message");
  71. cy.get(".msgprint").should("have.text", "@@### is not a valid Name");
  72. cy.hide_dialog();
  73. cy.get_field("name1", "Data").clear({ force: true });
  74. cy.fill_field("name1", "Komal{}/!", "Data");
  75. cy.get('.xhiveframework-control[data-fieldname="name1"]').should("have.class", "has-error");
  76. cy.save();
  77. cy.get(".modal-title").should("have.text", "Message");
  78. cy.get(".msgprint").should("have.text", "Komal{}/! is not a valid Name");
  79. cy.hide_dialog();
  80. });
  81. it('Verifying data control by inputting different patterns for "Email" field', () => {
  82. cy.get_field("name1", "Data").clear({ force: true });
  83. cy.fill_field("name1", "Komal", "Data");
  84. cy.get_field("email", "Data").clear({ force: true });
  85. cy.fill_field("email", "komal", "Data");
  86. cy.get('.xhiveframework-control[data-fieldname="email"]').should("have.class", "has-error");
  87. cy.save();
  88. cy.get(".modal-title").should("have.text", "Message");
  89. cy.get(".msgprint").should("have.text", "komal is not a valid Email Address");
  90. cy.hide_dialog();
  91. cy.get_field("email", "Data").clear({ force: true });
  92. cy.fill_field("email", "komal@test", "Data");
  93. cy.get('.xhiveframework-control[data-fieldname="email"]').should("have.class", "has-error");
  94. cy.save();
  95. cy.get(".modal-title").should("have.text", "Message");
  96. cy.get(".msgprint").should("have.text", "komal@test is not a valid Email Address");
  97. cy.hide_dialog();
  98. });
  99. it('Verifying data control by inputting different patterns for "Phone" field', () => {
  100. cy.get_field("email", "Data").clear({ force: true });
  101. cy.fill_field("email", "komal@test.com", "Data");
  102. cy.get_field("phone", "Data").clear({ force: true });
  103. cy.fill_field("phone", "komal", "Data");
  104. cy.get('.xhiveframework-control[data-fieldname="phone"]').should("have.class", "has-error");
  105. cy.findByRole("button", { name: "Save" }).click({ force: true });
  106. cy.get(".modal-title").should("have.text", "Message");
  107. cy.get(".msgprint").should("have.text", "komal is not a valid Phone Number");
  108. cy.hide_dialog();
  109. });
  110. it("Inputting correct data and saving the doc", () => {
  111. //Inputting the data as expected and saving the document
  112. cy.get_field("name1", "Data").clear({ force: true });
  113. cy.get_field("email", "Data").clear({ force: true });
  114. cy.get_field("phone", "Data").clear({ force: true });
  115. cy.fill_field("name1", "Komal", "Data");
  116. cy.fill_field("email", "komal@test.com", "Data");
  117. cy.fill_field("phone", "9432380001", "Data");
  118. cy.findByRole("button", { name: "Save" }).click({ force: true });
  119. //Checking if the fields contains the data which has been filled in
  120. cy.location("pathname").should(
  121. "not.contains",
  122. "/app/test-data-control/new-test-data-control"
  123. );
  124. cy.get_field("name1").should("have.value", "Komal");
  125. cy.get_field("email").should("have.value", "komal@test.com");
  126. cy.get_field("phone").should("have.value", "9432380001");
  127. });
  128. it("Deleting the doc", () => {
  129. //Deleting the inserted document
  130. cy.go_to_list("Test Data Control");
  131. cy.get(".list-row-checkbox").eq(0).click({ force: true });
  132. cy.get(".actions-btn-group > .btn").contains("Actions").click();
  133. cy.get('.actions-btn-group > .dropdown-menu [data-label="Delete"]').click();
  134. cy.click_modal_primary_button("Yes");
  135. });
  136. });