Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

80 linhas
3.2 KiB

  1. context('Discussions', () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit('/app');
  5. return cy.window().its('frappe').then(frappe => {
  6. return frappe.call('frappe.tests.ui_test_helpers.create_data_for_discussions');
  7. });
  8. });
  9. const reply_through_modal = () => {
  10. cy.visit('/test-page-discussions');
  11. // Open the modal
  12. cy.get('.reply').click();
  13. cy.wait(500);
  14. cy.get('.discussion-modal').should('be.visible');
  15. // Enter title
  16. cy.get('.modal .topic-title').type('Discussion from tests')
  17. .should('have.value', 'Discussion from tests');
  18. // Enter comment
  19. cy.get('.modal .comment-field')
  20. .type('This is a discussion from the cypress ui tests.')
  21. .should('have.value', 'This is a discussion from the cypress ui tests.');
  22. // Submit
  23. cy.get('.modal .submit-discussion').click();
  24. cy.wait(2000);
  25. // Check if discussion is added to page and content is visible
  26. cy.get('.sidebar-parent:first .discussion-topic-title').should('have.text', 'Discussion from tests');
  27. cy.get('.discussion-on-page:visible').should('have.class', 'show');
  28. cy.get('.discussion-on-page:visible .reply-card .reply-text')
  29. .should('have.text', 'This is a discussion from the cypress ui tests.\n');
  30. };
  31. const reply_through_comment_box = () => {
  32. cy.get('.discussion-on-page:visible .comment-field')
  33. .type('This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.')
  34. .should('have.value', 'This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.');
  35. cy.get('.discussion-on-page:visible .submit-discussion').click();
  36. cy.wait(3000);
  37. cy.get('.discussion-on-page:visible').should('have.class', 'show');
  38. cy.get('.discussion-on-page:visible').children(".reply-card").eq(1).children(".reply-text")
  39. .should('have.text', 'This is a discussion from the cypress ui tests. \n\nThis comment was entered through the commentbox on the page.\n');
  40. };
  41. const cancel_and_clear_comment_box = () => {
  42. cy.get('.discussion-on-page:visible .comment-field')
  43. .type('This is a discussion from the cypress ui tests.')
  44. .should('have.value', 'This is a discussion from the cypress ui tests.');
  45. cy.get('.discussion-on-page:visible .cancel-comment').click();
  46. cy.get('.discussion-on-page:visible .comment-field').should('have.value', '');
  47. };
  48. const single_thread_discussion = () => {
  49. cy.visit('/test-single-thread');
  50. cy.get('.discussions-sidebar').should('have.length', 0);
  51. cy.get('.reply').should('have.length', 0);
  52. cy.get('.discussion-on-page .comment-field')
  53. .type('This comment is being made on a single thread discussion.')
  54. .should('have.value', 'This comment is being made on a single thread discussion.');
  55. cy.get('.discussion-on-page .submit-discussion').click();
  56. cy.wait(3000);
  57. cy.get('.discussion-on-page').children(".reply-card").eq(-1).children(".reply-text")
  58. .should('have.text', 'This comment is being made on a single thread discussion.\n');
  59. };
  60. it('reply through modal', reply_through_modal);
  61. it('reply through comment box', reply_through_comment_box);
  62. it('cancel and clear comment box', cancel_and_clear_comment_box);
  63. it('single thread discussion', single_thread_discussion);
  64. });