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