| 6dd74de | | | 1 | describe('Interaction', () => { |
| 6dd74de | | | 2 | const baseUrl = Cypress.config('baseUrl'); |
| 6dd74de | | | 3 | |
| 6dd74de | | | 4 | describe('Security level loose', () => { |
| 6dd74de | | | 5 | beforeEach(() => { |
| 6dd74de | | | 6 | cy.visit('/click_security_loose.html'); |
| 6dd74de | | | 7 | }); |
| 6dd74de | | | 8 | |
| 6dd74de | | | 9 | it('Graph: should handle a click on a node with a bound function', () => { |
| 6dd74de | | | 10 | cy.contains('FunctionTest1').parents('.node').click(); |
| 6dd74de | | | 11 | cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); |
| 6dd74de | | | 12 | }); |
| 6dd74de | | | 13 | |
| 6dd74de | | | 14 | it('Graph: should handle a click on a node with a bound function with args', () => { |
| 6dd74de | | | 15 | cy.contains('FunctionArgTest2').parents('.node').click(); |
| 6dd74de | | | 16 | cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT'); |
| 6dd74de | | | 17 | }); |
| 6dd74de | | | 18 | |
| 6dd74de | | | 19 | it('Flowchart: should handle a click on a node with a bound function where the node starts with a number', () => { |
| 6dd74de | | | 20 | cy.contains('2FunctionArg').parents('.node').click(); |
| 6dd74de | | | 21 | cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT'); |
| 6dd74de | | | 22 | }); |
| 6dd74de | | | 23 | |
| 6dd74de | | | 24 | it('Graph: should handle a click on a node with a bound url', () => { |
| 6dd74de | | | 25 | // When there is a URL, `cy.contains()` selects the `a` tag instead of the `span` tag. The .node is a child of `a`, so we have to use `find()` instead of `parent`. |
| 6dd74de | | | 26 | cy.contains('URLTest1').find('.node').click(); |
| 6dd74de | | | 27 | cy.location().should(({ href }) => { |
| 6dd74de | | | 28 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 29 | }); |
| 6dd74de | | | 30 | }); |
| 6dd74de | | | 31 | |
| 6dd74de | | | 32 | it('Graph: should handle a click on a node with a bound url where the node starts with a number', () => { |
| 6dd74de | | | 33 | cy.contains('2URL').find('.node').click(); |
| 6dd74de | | | 34 | cy.location().should(({ href }) => { |
| 6dd74de | | | 35 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 36 | }); |
| 6dd74de | | | 37 | }); |
| 6dd74de | | | 38 | |
| 6dd74de | | | 39 | it('Flowchart-v2: should handle a click on a node with a bound function', () => { |
| 6dd74de | | | 40 | cy.contains('FunctionTest2').parents('.node').click(); |
| 6dd74de | | | 41 | cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); |
| 6dd74de | | | 42 | }); |
| 6dd74de | | | 43 | |
| 6dd74de | | | 44 | it('Flowchart-v2: should handle a click on a node with a bound function where the node starts with a number', () => { |
| 6dd74de | | | 45 | cy.contains('10Function').parents('.node').click(); |
| 6dd74de | | | 46 | cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); |
| 6dd74de | | | 47 | }); |
| 6dd74de | | | 48 | |
| 6dd74de | | | 49 | it('Flowchart-v2: should handle a click on a node with a bound url', () => { |
| 6dd74de | | | 50 | cy.contains('URLTest2').find('.node').click(); |
| 6dd74de | | | 51 | cy.location().should(({ href }) => { |
| 6dd74de | | | 52 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 53 | }); |
| 6dd74de | | | 54 | }); |
| 6dd74de | | | 55 | |
| 6dd74de | | | 56 | it('Flowchart-v2: should handle a click on a node with a bound url where the node starts with a number', () => { |
| 6dd74de | | | 57 | cy.contains('20URL').find('.node').click(); |
| 6dd74de | | | 58 | cy.location().should(({ href }) => { |
| 6dd74de | | | 59 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 60 | }); |
| 6dd74de | | | 61 | }); |
| 6dd74de | | | 62 | |
| 6dd74de | | | 63 | it('should handle a click on a task with a bound URL clicking on the rect', () => { |
| 6dd74de | | | 64 | cy.get('rect#cl1').click({ force: true }); |
| 6dd74de | | | 65 | cy.location().should(({ href }) => { |
| 6dd74de | | | 66 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 67 | }); |
| 6dd74de | | | 68 | }); |
| 6dd74de | | | 69 | |
| 6dd74de | | | 70 | it('should handle a click on a task with a bound URL clicking on the text', () => { |
| 6dd74de | | | 71 | cy.get('text#cl1-text').click({ force: true }); |
| 6dd74de | | | 72 | cy.location().should(({ href }) => { |
| 6dd74de | | | 73 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 74 | }); |
| 6dd74de | | | 75 | }); |
| 6dd74de | | | 76 | |
| 6dd74de | | | 77 | it('should handle a click on a task with a bound function without args', () => { |
| 6dd74de | | | 78 | cy.get('rect#cl2').click({ force: true }); |
| 6dd74de | | | 79 | cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2'); |
| 6dd74de | | | 80 | }); |
| 6dd74de | | | 81 | |
| 6dd74de | | | 82 | it('should handle a click on a task with a bound function with args', () => { |
| 6dd74de | | | 83 | cy.get('rect#cl3').click({ force: true }); |
| 6dd74de | | | 84 | cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3'); |
| 6dd74de | | | 85 | }); |
| 6dd74de | | | 86 | |
| 6dd74de | | | 87 | it('should handle a click on a task with a bound function without args', () => { |
| 6dd74de | | | 88 | cy.get('text#cl2-text').click({ force: true }); |
| 6dd74de | | | 89 | cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2'); |
| 6dd74de | | | 90 | }); |
| 6dd74de | | | 91 | |
| 6dd74de | | | 92 | it('should handle a click on a task with a bound function with args ', () => { |
| 6dd74de | | | 93 | cy.get('text#cl3-text').click({ force: true }); |
| 6dd74de | | | 94 | cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3'); |
| 6dd74de | | | 95 | }); |
| 6dd74de | | | 96 | }); |
| 6dd74de | | | 97 | |
| 6dd74de | | | 98 | describe('Interaction - security level tight', () => { |
| 6dd74de | | | 99 | beforeEach(() => { |
| 6dd74de | | | 100 | cy.visit('/click_security_strict.html'); |
| 6dd74de | | | 101 | }); |
| 6dd74de | | | 102 | it('should handle a click on a node without a bound function', () => { |
| 6dd74de | | | 103 | cy.contains('Function1').parents('.node').click(); |
| 6dd74de | | | 104 | cy.get('.created-by-click').should('not.exist'); |
| 6dd74de | | | 105 | }); |
| 6dd74de | | | 106 | |
| 6dd74de | | | 107 | it('should handle a click on a node with a bound function where the node starts with a number', () => { |
| 6dd74de | | | 108 | cy.contains('1Function').parents('.node').click(); |
| 6dd74de | | | 109 | cy.get('.created-by-click').should('not.exist'); |
| 6dd74de | | | 110 | }); |
| 6dd74de | | | 111 | |
| 6dd74de | | | 112 | it('should handle a click on a node with a bound url', () => { |
| 6dd74de | | | 113 | cy.contains('URL1').find('.node').click(); |
| 6dd74de | | | 114 | cy.location().should(({ href }) => { |
| 6dd74de | | | 115 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 116 | }); |
| 6dd74de | | | 117 | }); |
| 6dd74de | | | 118 | |
| 6dd74de | | | 119 | it('should handle a click on a node with a bound url where the node starts with a number', () => { |
| 6dd74de | | | 120 | cy.contains('2URL').find('.node').click(); |
| 6dd74de | | | 121 | cy.location().should(({ href }) => { |
| 6dd74de | | | 122 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 123 | }); |
| 6dd74de | | | 124 | }); |
| 6dd74de | | | 125 | |
| 6dd74de | | | 126 | it('should handle a click on a task with a bound URL clicking on the rect', () => { |
| 6dd74de | | | 127 | cy.get('rect#cl1').click({ force: true }); |
| 6dd74de | | | 128 | cy.location().should(({ href }) => { |
| 6dd74de | | | 129 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 130 | }); |
| 6dd74de | | | 131 | }); |
| 6dd74de | | | 132 | |
| 6dd74de | | | 133 | it('should handle a click on a task with a bound URL clicking on the text', () => { |
| 6dd74de | | | 134 | cy.get('text#cl1-text').click({ force: true }); |
| 6dd74de | | | 135 | cy.location().should(({ href }) => { |
| 6dd74de | | | 136 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 137 | }); |
| 6dd74de | | | 138 | }); |
| 6dd74de | | | 139 | |
| 6dd74de | | | 140 | it('should handle a click on a task with a bound function', () => { |
| 6dd74de | | | 141 | cy.get('rect#cl2').click({ force: true }); |
| 6dd74de | | | 142 | cy.get('.created-by-gant-click').should('not.exist'); |
| 6dd74de | | | 143 | }); |
| 6dd74de | | | 144 | |
| 6dd74de | | | 145 | it('should handle a click on a task with a bound function', () => { |
| 6dd74de | | | 146 | cy.get('text#cl2-text').click({ force: true }); |
| 6dd74de | | | 147 | cy.get('.created-by-gant-click').should('not.exist'); |
| 6dd74de | | | 148 | }); |
| 6dd74de | | | 149 | }); |
| 6dd74de | | | 150 | |
| 6dd74de | | | 151 | describe('Interaction - security level other, misspelling', () => { |
| 6dd74de | | | 152 | beforeEach(() => { |
| 6dd74de | | | 153 | cy.visit('/click_security_other.html'); |
| 6dd74de | | | 154 | }); |
| 6dd74de | | | 155 | |
| 6dd74de | | | 156 | it('should handle a click on a node with a bound function', () => { |
| 6dd74de | | | 157 | cy.contains('Function1').parents('.node').click(); |
| 6dd74de | | | 158 | cy.get('.created-by-click').should('not.exist'); |
| 6dd74de | | | 159 | }); |
| 6dd74de | | | 160 | |
| 6dd74de | | | 161 | it('should handle a click on a node with a bound function where the node starts with a number', () => { |
| 6dd74de | | | 162 | cy.contains('1Function').parents('.node').click(); |
| 6dd74de | | | 163 | cy.get('.created-by-click').should('not.exist'); |
| 6dd74de | | | 164 | }); |
| 6dd74de | | | 165 | |
| 6dd74de | | | 166 | it('should handle a click on a node with a bound url', () => { |
| 6dd74de | | | 167 | cy.contains('URL1').find('.node').click(); |
| 6dd74de | | | 168 | cy.location().should(({ href }) => { |
| 6dd74de | | | 169 | expect(href).to.eq(`${baseUrl}/empty.html`); |
| 6dd74de | | | 170 | }); |
| 6dd74de | | | 171 | }); |
| 6dd74de | | | 172 | |
| 6dd74de | | | 173 | it('should handle a click on a task with a bound function', () => { |
| 6dd74de | | | 174 | cy.get('rect#cl2').click({ force: true }); |
| 6dd74de | | | 175 | cy.get('.created-by-gant-click').should('not.exist'); |
| 6dd74de | | | 176 | }); |
| 6dd74de | | | 177 | |
| 6dd74de | | | 178 | it('should handle a click on a task with a bound function', () => { |
| 6dd74de | | | 179 | cy.get('text#cl2-text').click({ force: true }); |
| 6dd74de | | | 180 | cy.get('.created-by-gant-click').should('not.exist'); |
| 6dd74de | | | 181 | }); |
| 6dd74de | | | 182 | }); |
| 6dd74de | | | 183 | }); |