|
| 1 | +/// <reference types="cypress" /> |
| 2 | + |
| 3 | +describe('Example 28 - Tree Data (from a Hierarchical Dataset)', () => { |
| 4 | + const titles = ['Title', 'Duration', '% Complete', 'Start', 'Finish', 'Effort Driven']; |
| 5 | + |
| 6 | + it('should display Example title', () => { |
| 7 | + cy.visit(`${Cypress.config('baseExampleUrl')}/tree-data-parent-child`); |
| 8 | + cy.get('h2').should('contain', 'Example 28: Tree Data (from a flat dataset with parentId references)'); |
| 9 | + }); |
| 10 | + |
| 11 | + it('should have exact column titles in grid', () => { |
| 12 | + cy.get('#grid28') |
| 13 | + .find('.slick-header-columns') |
| 14 | + .children() |
| 15 | + .each(($child, index) => expect($child.text()).to.eq(titles[index])); |
| 16 | + }); |
| 17 | + |
| 18 | + it('should have a Grid Preset Filter on 3rd column "% Complete" and expect all rows to be filtered as well', () => { |
| 19 | + cy.get('.input-group-text.rangeOutput_percentComplete') |
| 20 | + .contains('25'); |
| 21 | + |
| 22 | + cy.get('.search-filter.filter-percentComplete') |
| 23 | + .find('.input-group-addon.operator select') |
| 24 | + .contains('>='); |
| 25 | + }); |
| 26 | + |
| 27 | + it('should collapsed all rows from "Collapse All" button', () => { |
| 28 | + cy.get('[data-test=collapse-all]') |
| 29 | + .contains('Collapse All') |
| 30 | + .click(); |
| 31 | + |
| 32 | + cy.get('#grid28') |
| 33 | + .find('.slick-group-toggle.expanded') |
| 34 | + .should('have.length', 0); |
| 35 | + |
| 36 | + cy.get('#grid28') |
| 37 | + .find('.slick-group-toggle.collapsed') |
| 38 | + .should(($rows) => expect($rows).to.have.length.greaterThan(0)); |
| 39 | + }); |
| 40 | + |
| 41 | + it('should expand all rows from "Expand All" button', () => { |
| 42 | + cy.get('[data-test=expand-all]') |
| 43 | + .contains('Expand All') |
| 44 | + .click(); |
| 45 | + |
| 46 | + cy.get('#grid28') |
| 47 | + .find('.slick-group-toggle.collapsed') |
| 48 | + .should('have.length', 0); |
| 49 | + |
| 50 | + cy.get('#grid28') |
| 51 | + .find('.slick-group-toggle.expanded') |
| 52 | + .should(($rows) => expect($rows).to.have.length.greaterThan(0)); |
| 53 | + }); |
| 54 | + |
| 55 | + it('should collapsed all rows from "Collapse All" context menu', () => { |
| 56 | + cy.get('#grid28') |
| 57 | + .contains('5 days'); |
| 58 | + |
| 59 | + cy.get('#grid28') |
| 60 | + .find('.slick-row .slick-cell:nth(1)') |
| 61 | + .rightclick({ force: true }); |
| 62 | + |
| 63 | + cy.get('.slick-context-menu.dropright .slick-context-menu-command-list') |
| 64 | + .find('.slick-context-menu-item') |
| 65 | + .find('.slick-context-menu-content') |
| 66 | + .contains('Collapse all Groups') |
| 67 | + .click(); |
| 68 | + |
| 69 | + cy.get('#grid28') |
| 70 | + .find('.slick-group-toggle.expanded') |
| 71 | + .should('have.length', 0); |
| 72 | + |
| 73 | + cy.get('#grid28') |
| 74 | + .find('.slick-group-toggle.collapsed') |
| 75 | + .should(($rows) => expect($rows).to.have.length.greaterThan(0)); |
| 76 | + }); |
| 77 | + |
| 78 | + it('should collapsed all rows from "Expand All" context menu', () => { |
| 79 | + cy.get('#grid28') |
| 80 | + .contains('5 days'); |
| 81 | + |
| 82 | + cy.get('#grid28') |
| 83 | + .find('.slick-row .slick-cell:nth(1)') |
| 84 | + .rightclick({ force: true }); |
| 85 | + |
| 86 | + cy.get('.slick-context-menu.dropright .slick-context-menu-command-list') |
| 87 | + .find('.slick-context-menu-item') |
| 88 | + .find('.slick-context-menu-content') |
| 89 | + .contains('Expand all Groups') |
| 90 | + .click(); |
| 91 | + |
| 92 | + cy.get('#grid28') |
| 93 | + .find('.slick-group-toggle.collapsed') |
| 94 | + .should('have.length', 0); |
| 95 | + |
| 96 | + cy.get('#grid28') |
| 97 | + .find('.slick-group-toggle.expanded') |
| 98 | + .should(($rows) => expect($rows).to.have.length.greaterThan(0)); |
| 99 | + }); |
| 100 | +}); |
0 commit comments