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

grid_pagination.js 3.8 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. context("Grid Pagination", () => {
  2. beforeEach(() => {
  3. cy.login();
  4. cy.visit("/app/website");
  5. });
  6. before(() => {
  7. cy.login();
  8. cy.visit("/app/website");
  9. return cy
  10. .window()
  11. .its("xhiveframework")
  12. .then((xhiveframework) => {
  13. return xhiveframework.call(
  14. "xhiveframework.tests.ui_test_helpers.create_contact_phone_nos_records"
  15. );
  16. });
  17. });
  18. it("creates pages for child table", () => {
  19. cy.visit("/app/contact/Test Contact");
  20. cy.get('.xhiveframework-control[data-fieldname="phone_nos"]').as("table");
  21. cy.get("@table").find(".current-page-number").should("have.value", "1");
  22. cy.get("@table").find(".total-page-number").should("contain", "20");
  23. cy.get("@table").find(".grid-body .grid-row").should("have.length", 50);
  24. });
  25. it("goes to the next and previous page", () => {
  26. cy.visit("/app/contact/Test Contact");
  27. cy.get('.xhiveframework-control[data-fieldname="phone_nos"]').as("table");
  28. cy.get("@table").find(".next-page").click();
  29. cy.get("@table").find(".current-page-number").should("have.value", "2");
  30. cy.get("@table")
  31. .find(".grid-body .grid-row")
  32. .first()
  33. .should("have.attr", "data-idx", "51");
  34. cy.get("@table").find(".prev-page").click();
  35. cy.get("@table").find(".current-page-number").should("have.value", "1");
  36. cy.get("@table").find(".grid-body .grid-row").first().should("have.attr", "data-idx", "1");
  37. });
  38. it("adds and deletes rows and changes page", () => {
  39. cy.visit("/app/contact/Test Contact");
  40. cy.get('.xhiveframework-control[data-fieldname="phone_nos"]').as("table");
  41. cy.get("@table").findByRole("button", { name: "Add Row" }).click();
  42. cy.get("@table").find(".grid-body .row-index").should("contain", 1001);
  43. cy.get("@table").find(".current-page-number").should("have.value", "21");
  44. cy.get("@table").find(".total-page-number").should("contain", "21");
  45. cy.get("@table").find(".grid-body .grid-row .grid-row-check").click({ force: true });
  46. cy.get("@table").findByRole("button", { name: "Delete" }).click();
  47. cy.get("@table").find(".grid-body .row-index").last().should("contain", 1000);
  48. cy.get("@table").find(".current-page-number").should("have.value", "20");
  49. cy.get("@table").find(".total-page-number").should("contain", "20");
  50. });
  51. it("go to specific page, use up and down arrow, type characters, 0 page and more than existing page", () => {
  52. cy.visit("/app/contact/Test Contact");
  53. cy.get('.xhiveframework-control[data-fieldname="phone_nos"]').as("table");
  54. cy.get("@table").find(".current-page-number").focus().clear().type("17").blur();
  55. cy.get("@table").find(".grid-body .row-index").should("contain", 801);
  56. cy.get("@table").find(".current-page-number").focus().type("{uparrow}{uparrow}");
  57. cy.get("@table").find(".current-page-number").should("have.value", "19");
  58. cy.get("@table").find(".current-page-number").focus().type("{downarrow}{downarrow}");
  59. cy.get("@table").find(".current-page-number").should("have.value", "17");
  60. cy.get("@table").find(".current-page-number").focus().clear().type("700").blur();
  61. cy.get("@table").find(".current-page-number").should("have.value", "20");
  62. cy.get("@table").find(".current-page-number").focus().clear().type("0").blur();
  63. cy.get("@table").find(".current-page-number").should("have.value", "1");
  64. cy.get("@table").find(".current-page-number").focus().clear().type("abc").blur();
  65. cy.get("@table").find(".current-page-number").should("have.value", "1");
  66. });
  67. // it('deletes all rows', ()=> {
  68. // cy.visit('/app/contact/Test Contact');
  69. // cy.get('.xhiveframework-control[data-fieldname="phone_nos"]').as('table');
  70. // cy.get('@table').find('.grid-heading-row .grid-row-check').click({force: true});
  71. // cy.get('@table').find('button.grid-remove-all-rows').click();
  72. // cy.get('.modal-dialog .btn-primary').contains('Yes').click();
  73. // cy.get('@table').find('.grid-body .grid-row').should('have.length', 0);
  74. // });
  75. });