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.
 
 
 
 
 
 

66 rivejä
2.3 KiB

  1. context('Dashboard links', () => {
  2. before(() => {
  3. cy.visit('/login');
  4. cy.login();
  5. });
  6. it('Adding a new contact, checking for the counter on the dashboard and deleting the created contact', () => {
  7. cy.visit('/app/contact');
  8. cy.clear_filters();
  9. cy.visit('/app/user');
  10. cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });
  11. //To check if initially the dashboard contains only the "Contact" link and there is no counter
  12. cy.get('[data-doctype="Contact"]').should('contain', 'Contact');
  13. //Adding a new contact
  14. cy.get('.document-link-badge[data-doctype="Contact"]').click();
  15. cy.wait(300);
  16. cy.findByRole('button', {name: 'Add Contact'}).should('be.visible');
  17. cy.findByRole('button', {name: 'Add Contact'}).click();
  18. cy.get('[data-doctype="Contact"][data-fieldname="first_name"]').type('Admin');
  19. cy.findByRole('button', {name: 'Save'}).click();
  20. cy.visit('/app/user');
  21. cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });
  22. //To check if the counter for contact doc is "1" after adding the contact
  23. cy.get('[data-doctype="Contact"] > .count').should('contain', '1');
  24. cy.get('[data-doctype="Contact"]').contains('Contact').click();
  25. //Deleting the newly created contact
  26. cy.visit('/app/contact');
  27. cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click({ force: true });
  28. cy.findByRole('button', {name: 'Actions'}).click();
  29. cy.get('.actions-btn-group [data-label="Delete"]').click();
  30. cy.findByRole('button', {name: 'Yes'}).click({delay: 700});
  31. //To check if the counter from the "Contact" doc link is removed
  32. cy.wait(700);
  33. cy.visit('/app/user');
  34. cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });
  35. cy.get('[data-doctype="Contact"]').should('contain', 'Contact');
  36. });
  37. it('Report link in dashboard', () => {
  38. cy.visit('/app/user');
  39. cy.visit('/app/user/Administrator');
  40. cy.get('[data-doctype="Contact"]').should('contain', 'Contact');
  41. cy.findByText('Connections');
  42. cy.window()
  43. .its('cur_frm')
  44. .then(cur_frm => {
  45. cur_frm.dashboard.data.reports = [
  46. {
  47. 'label': 'Reports',
  48. 'items': ['Website Analytics']
  49. }
  50. ];
  51. cur_frm.dashboard.render_report_links();
  52. cy.get('[data-report="Website Analytics"]').contains('Website Analytics').click();
  53. cy.findByText('Website Analytics');
  54. });
  55. });
  56. });