25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

form_tour.js 3.0 KiB

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