Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

92 rindas
3.4 KiB

  1. import custom_submittable_doctype from "../fixtures/custom_submittable_doctype";
  2. context("Timeline", () => {
  3. before(() => {
  4. cy.visit("/login");
  5. cy.login();
  6. });
  7. it("Adding new ToDo, adding new comment, verifying comment addition & deletion and deleting ToDo", () => {
  8. //Adding new ToDo
  9. cy.visit("/app/todo/new-todo-1");
  10. cy.get('[data-fieldname="description"] .ql-editor.ql-blank')
  11. .type("Test ToDo", { force: true })
  12. .wait(200);
  13. cy.get(".page-head .page-actions").findByRole("button", { name: "Save" }).click();
  14. cy.go_to_list("ToDo");
  15. cy.clear_filters();
  16. cy.click_listview_row_item(0);
  17. //To check if the comment box is initially empty and tying some text into it
  18. cy.get('[data-fieldname="comment"] .ql-editor')
  19. .should("contain", "")
  20. .type("Testing Timeline");
  21. //Adding new comment
  22. cy.get(".comment-box").findByRole("button", { name: "Comment" }).click();
  23. //To check if the commented text is visible in the timeline content
  24. cy.get(".timeline-content").should("contain", "Testing Timeline");
  25. //Editing comment
  26. cy.click_timeline_action_btn("Edit");
  27. cy.get('.timeline-content [data-fieldname="comment"] .ql-editor').first().type(" 123");
  28. cy.click_timeline_action_btn("Save");
  29. //To check if the edited comment text is visible in timeline content
  30. cy.get(".timeline-content").should("contain", "Testing Timeline 123");
  31. //Discarding comment
  32. cy.click_timeline_action_btn("Edit");
  33. cy.click_timeline_action_btn("Dismiss");
  34. //To check if after discarding the timeline content is same as previous
  35. cy.get(".timeline-content").should("contain", "Testing Timeline 123");
  36. //Deleting the added comment
  37. cy.get(".timeline-message-box .more-actions > .action-btn").click(); //Menu button in timeline item
  38. cy.get(".timeline-message-box .more-actions .dropdown-item")
  39. .contains("Delete")
  40. .click({ force: true });
  41. cy.get_open_dialog().findByRole("button", { name: "Yes" }).click({ force: true });
  42. cy.get(".timeline-content").should("not.contain", "Testing Timeline 123");
  43. });
  44. it("Timeline should have submit and cancel activity information", () => {
  45. cy.visit("/app/doctype");
  46. //Creating custom doctype
  47. cy.insert_doc("DocType", custom_submittable_doctype, true);
  48. cy.visit("/app/custom-submittable-doctype");
  49. cy.click_listview_primary_button("Add Custom Submittable DocType");
  50. //Adding a new entry for the created custom doctype
  51. cy.fill_field("title", "Test");
  52. cy.click_modal_primary_button("Save");
  53. cy.click_modal_primary_button("Submit");
  54. cy.visit("/app/custom-submittable-doctype");
  55. cy.click_listview_row_item(0);
  56. //To check if the submission of the documemt is visible in the timeline content
  57. cy.get(".timeline-content").should("contain", "Frappe submitted this document");
  58. cy.get('[id="page-Custom Submittable DocType"] .page-actions')
  59. .findByRole("button", { name: "Cancel" })
  60. .click();
  61. cy.get_open_dialog().findByRole("button", { name: "Yes" }).click();
  62. //To check if the cancellation of the documemt is visible in the timeline content
  63. cy.get(".timeline-content").should("contain", "Frappe cancelled this document");
  64. //Deleting the document
  65. cy.visit("/app/custom-submittable-doctype");
  66. cy.select_listview_row_checkbox(0);
  67. cy.get(".page-actions").findByRole("button", { name: "Actions" }).click();
  68. cy.get('.page-actions .actions-btn-group [data-label="Delete"]').click();
  69. cy.click_modal_primary_button("Yes");
  70. });
  71. });