You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

94 regels
4.5 KiB

  1. import custom_submittable_doctype from '../fixtures/custom_submittable_doctype';
  2. context('Timeline', () => {
  3. before(() => {
  4. cy.visit('/login');
  5. cy.login();
  6. cy.visit('/app/todo');
  7. });
  8. it('Adding new ToDo, adding new comment, verifying comment addition & deletion and deleting ToDo', () => {
  9. //Adding new ToDo
  10. cy.click_listview_primary_button('Add ToDo');
  11. cy.get('.modal-footer > .custom-actions > .btn').contains('Edit in full page').click();
  12. cy.get('.row > .section-body > .form-column > form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .ql-container > .ql-editor').eq(0).type('Test ToDo', {force: true});
  13. cy.wait(200);
  14. cy.get('#page-ToDo > .page-head > .container > .row > .col > .standard-actions > .primary-action').contains('Save').click();
  15. cy.wait(700);
  16. cy.visit('/app/todo');
  17. cy.get('.list-row > .level-left > .list-subject > .level-item.ellipsis > .ellipsis').eq(0).click();
  18. //To check if the comment box is initially empty and tying some text into it
  19. cy.get('.comment-input-container > .frappe-control > .ql-container > .ql-editor').should('contain', '').type('Testing Timeline');
  20. //Adding new comment
  21. cy.get('.comment-input-wrapper > .btn').contains('Comment').click();
  22. //To check if the commented text is visible in the timeline content
  23. cy.get('.timeline-content').should('contain', 'Testing Timeline');
  24. //Editing comment
  25. cy.click_timeline_action_btn(0);
  26. cy.get('.timeline-content > .timeline-message-box > .comment-edit-box > .frappe-control > .ql-container > .ql-editor').first().type(' 123');
  27. cy.click_timeline_action_btn(0);
  28. //To check if the edited comment text is visible in timeline content
  29. cy.get('.timeline-content').should('contain', 'Testing Timeline 123');
  30. //Discarding comment
  31. cy.click_timeline_action_btn(0);
  32. cy.get('.actions > .btn').eq(1).first().click();
  33. //To check if after discarding the timeline content is same as previous
  34. cy.get('.timeline-content').should('contain', 'Testing Timeline 123');
  35. //Deleting the added comment
  36. cy.get('.actions > .btn > .icon').first().click();
  37. cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click();
  38. cy.click_modal_primary_button('Yes');
  39. //Deleting the added ToDo
  40. cy.get('#page-ToDo > .page-head > .container > .row > .col > .standard-actions > .menu-btn-group > .btn').click({force: true});
  41. cy.get('.menu-btn-group > .dropdown-menu > li > .grey-link').eq(17).click({force: true});
  42. cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').contains('Yes').click({force: true});
  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.get('.modal-footer > .standard-actions > .btn-primary').contains('Save').click();
  53. cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Submit').click();
  54. cy.visit('/app/custom-submittable-doctype');
  55. cy.get('.list-subject > .bold > .ellipsis').eq(0).click();
  56. //To check if the submission of the documemt is visible in the timeline content
  57. cy.get('.timeline-content').should('contain', 'Administrator submitted this document');
  58. cy.get('.page-actions > .standard-actions > .btn-secondary').contains('Cancel').click({delay: 900});
  59. cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click();
  60. //To check if the cancellation of the documemt is visible in the timeline content
  61. cy.get('.timeline-content').should('contain', 'Administrator cancelled this document');
  62. //Deleting the document
  63. cy.visit('/app/custom-submittable-doctype');
  64. cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click();
  65. cy.get('.page-actions > .standard-actions > .actions-btn-group > .btn').contains('Actions').click();
  66. cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(7).click();
  67. cy.click_modal_primary_button('Yes', {force: true, delay: 700});
  68. //Deleting the custom doctype
  69. cy.visit('/app/doctype');
  70. cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click();
  71. cy.get('.page-actions > .standard-actions > .actions-btn-group > .btn').contains('Actions').click();
  72. cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click();
  73. cy.click_modal_primary_button('Yes');
  74. });
  75. });