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

89 行
2.9 KiB

  1. context('Form Tour', () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit('/app/form-tour');
  5. return cy.window().its('frappe').then(frappe => {
  6. return frappe.call("frappe.tests.ui_test_helpers.create_form_tour");
  7. });
  8. });
  9. const open_test_form_tour = () => {
  10. cy.visit('/app/form-tour/Test Form Tour');
  11. cy.findByRole('button', {name: 'Show Tour'}).should('be.visible').as('show_tour');
  12. cy.get('@show_tour').click();
  13. cy.wait(500);
  14. cy.url().should('include', '/app/contact');
  15. };
  16. it('jump to a form tour', open_test_form_tour);
  17. it('navigates a form tour', () => {
  18. open_test_form_tour();
  19. cy.get('.frappe-driver').should('be.visible');
  20. cy.get('.frappe-control[data-fieldname="first_name"]').as('first_name');
  21. cy.get('@first_name').should('have.class', 'driver-highlighted-element');
  22. cy.get('.frappe-driver').findByRole('button', {name: 'Next'}).as('next_btn');
  23. // next btn shouldn't move to next step, if first name is not entered
  24. cy.get('@next_btn').click();
  25. cy.wait(500);
  26. cy.get('@first_name').should('have.class', 'driver-highlighted-element');
  27. // after filling the field, next step should be highlighted
  28. cy.fill_field('first_name', 'Test Name', 'Data');
  29. cy.wait(500);
  30. cy.get('@next_btn').click();
  31. cy.wait(500);
  32. // assert field is highlighted
  33. cy.get('.frappe-control[data-fieldname="last_name"]').as('last_name');
  34. cy.get('@last_name').should('have.class', 'driver-highlighted-element');
  35. // after filling the field, next step should be highlighted
  36. cy.fill_field('last_name', 'Test Last Name', 'Data');
  37. cy.wait(500);
  38. cy.get('@next_btn').click();
  39. cy.wait(500);
  40. // assert field is highlighted
  41. cy.get('.frappe-control[data-fieldname="phone_nos"]').as('phone_nos');
  42. cy.get('@phone_nos').should('have.class', 'driver-highlighted-element');
  43. // move to next step
  44. cy.wait(500);
  45. cy.get('@next_btn').click();
  46. cy.wait(500);
  47. // assert add row btn is highlighted
  48. cy.get('@phone_nos').find('.grid-add-row').as('add_row');
  49. cy.get('@add_row').should('have.class', 'driver-highlighted-element');
  50. // add a row & move to next step
  51. cy.wait(500);
  52. cy.get('@add_row').click();
  53. cy.wait(500);
  54. // assert table field is highlighted
  55. cy.get('.grid-row-open .frappe-control[data-fieldname="phone"]').as('phone');
  56. cy.get('@phone').should('have.class', 'driver-highlighted-element');
  57. // enter value in a table field
  58. let field = cy.fill_table_field('phone_nos', '1', 'phone', '1234567890');
  59. field.blur();
  60. // move to collapse row step
  61. cy.wait(500);
  62. cy.get('.driver-popover-title').contains('Test Title 4').siblings().get('@next_btn').click();
  63. cy.wait(500);
  64. // collapse row
  65. cy.get('.grid-row-open .grid-collapse-row').click();
  66. cy.wait(500);
  67. // assert save btn is highlighted
  68. cy.get('.primary-action').should('have.class', 'driver-highlighted-element');
  69. cy.wait(500);
  70. cy.get('.frappe-driver').findByRole('button', {name: 'Save'}).should('be.visible');
  71. });
  72. });