collab/mermaid/cypress/integration/other/interaction.spec.jsblame
View source
6dd74de1describe('Interaction', () => {
6dd74de2 const baseUrl = Cypress.config('baseUrl');
6dd74de3
6dd74de4 describe('Security level loose', () => {
6dd74de5 beforeEach(() => {
6dd74de6 cy.visit('/click_security_loose.html');
6dd74de7 });
6dd74de8
6dd74de9 it('Graph: should handle a click on a node with a bound function', () => {
6dd74de10 cy.contains('FunctionTest1').parents('.node').click();
6dd74de11 cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
6dd74de12 });
6dd74de13
6dd74de14 it('Graph: should handle a click on a node with a bound function with args', () => {
6dd74de15 cy.contains('FunctionArgTest2').parents('.node').click();
6dd74de16 cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT');
6dd74de17 });
6dd74de18
6dd74de19 it('Flowchart: should handle a click on a node with a bound function where the node starts with a number', () => {
6dd74de20 cy.contains('2FunctionArg').parents('.node').click();
6dd74de21 cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT');
6dd74de22 });
6dd74de23
6dd74de24 it('Graph: should handle a click on a node with a bound url', () => {
6dd74de25 // 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`.
6dd74de26 cy.contains('URLTest1').find('.node').click();
6dd74de27 cy.location().should(({ href }) => {
6dd74de28 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de29 });
6dd74de30 });
6dd74de31
6dd74de32 it('Graph: should handle a click on a node with a bound url where the node starts with a number', () => {
6dd74de33 cy.contains('2URL').find('.node').click();
6dd74de34 cy.location().should(({ href }) => {
6dd74de35 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de36 });
6dd74de37 });
6dd74de38
6dd74de39 it('Flowchart-v2: should handle a click on a node with a bound function', () => {
6dd74de40 cy.contains('FunctionTest2').parents('.node').click();
6dd74de41 cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
6dd74de42 });
6dd74de43
6dd74de44 it('Flowchart-v2: should handle a click on a node with a bound function where the node starts with a number', () => {
6dd74de45 cy.contains('10Function').parents('.node').click();
6dd74de46 cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
6dd74de47 });
6dd74de48
6dd74de49 it('Flowchart-v2: should handle a click on a node with a bound url', () => {
6dd74de50 cy.contains('URLTest2').find('.node').click();
6dd74de51 cy.location().should(({ href }) => {
6dd74de52 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de53 });
6dd74de54 });
6dd74de55
6dd74de56 it('Flowchart-v2: should handle a click on a node with a bound url where the node starts with a number', () => {
6dd74de57 cy.contains('20URL').find('.node').click();
6dd74de58 cy.location().should(({ href }) => {
6dd74de59 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de60 });
6dd74de61 });
6dd74de62
6dd74de63 it('should handle a click on a task with a bound URL clicking on the rect', () => {
6dd74de64 cy.get('rect#cl1').click({ force: true });
6dd74de65 cy.location().should(({ href }) => {
6dd74de66 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de67 });
6dd74de68 });
6dd74de69
6dd74de70 it('should handle a click on a task with a bound URL clicking on the text', () => {
6dd74de71 cy.get('text#cl1-text').click({ force: true });
6dd74de72 cy.location().should(({ href }) => {
6dd74de73 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de74 });
6dd74de75 });
6dd74de76
6dd74de77 it('should handle a click on a task with a bound function without args', () => {
6dd74de78 cy.get('rect#cl2').click({ force: true });
6dd74de79 cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2');
6dd74de80 });
6dd74de81
6dd74de82 it('should handle a click on a task with a bound function with args', () => {
6dd74de83 cy.get('rect#cl3').click({ force: true });
6dd74de84 cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3');
6dd74de85 });
6dd74de86
6dd74de87 it('should handle a click on a task with a bound function without args', () => {
6dd74de88 cy.get('text#cl2-text').click({ force: true });
6dd74de89 cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2');
6dd74de90 });
6dd74de91
6dd74de92 it('should handle a click on a task with a bound function with args ', () => {
6dd74de93 cy.get('text#cl3-text').click({ force: true });
6dd74de94 cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3');
6dd74de95 });
6dd74de96 });
6dd74de97
6dd74de98 describe('Interaction - security level tight', () => {
6dd74de99 beforeEach(() => {
6dd74de100 cy.visit('/click_security_strict.html');
6dd74de101 });
6dd74de102 it('should handle a click on a node without a bound function', () => {
6dd74de103 cy.contains('Function1').parents('.node').click();
6dd74de104 cy.get('.created-by-click').should('not.exist');
6dd74de105 });
6dd74de106
6dd74de107 it('should handle a click on a node with a bound function where the node starts with a number', () => {
6dd74de108 cy.contains('1Function').parents('.node').click();
6dd74de109 cy.get('.created-by-click').should('not.exist');
6dd74de110 });
6dd74de111
6dd74de112 it('should handle a click on a node with a bound url', () => {
6dd74de113 cy.contains('URL1').find('.node').click();
6dd74de114 cy.location().should(({ href }) => {
6dd74de115 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de116 });
6dd74de117 });
6dd74de118
6dd74de119 it('should handle a click on a node with a bound url where the node starts with a number', () => {
6dd74de120 cy.contains('2URL').find('.node').click();
6dd74de121 cy.location().should(({ href }) => {
6dd74de122 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de123 });
6dd74de124 });
6dd74de125
6dd74de126 it('should handle a click on a task with a bound URL clicking on the rect', () => {
6dd74de127 cy.get('rect#cl1').click({ force: true });
6dd74de128 cy.location().should(({ href }) => {
6dd74de129 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de130 });
6dd74de131 });
6dd74de132
6dd74de133 it('should handle a click on a task with a bound URL clicking on the text', () => {
6dd74de134 cy.get('text#cl1-text').click({ force: true });
6dd74de135 cy.location().should(({ href }) => {
6dd74de136 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de137 });
6dd74de138 });
6dd74de139
6dd74de140 it('should handle a click on a task with a bound function', () => {
6dd74de141 cy.get('rect#cl2').click({ force: true });
6dd74de142 cy.get('.created-by-gant-click').should('not.exist');
6dd74de143 });
6dd74de144
6dd74de145 it('should handle a click on a task with a bound function', () => {
6dd74de146 cy.get('text#cl2-text').click({ force: true });
6dd74de147 cy.get('.created-by-gant-click').should('not.exist');
6dd74de148 });
6dd74de149 });
6dd74de150
6dd74de151 describe('Interaction - security level other, misspelling', () => {
6dd74de152 beforeEach(() => {
6dd74de153 cy.visit('/click_security_other.html');
6dd74de154 });
6dd74de155
6dd74de156 it('should handle a click on a node with a bound function', () => {
6dd74de157 cy.contains('Function1').parents('.node').click();
6dd74de158 cy.get('.created-by-click').should('not.exist');
6dd74de159 });
6dd74de160
6dd74de161 it('should handle a click on a node with a bound function where the node starts with a number', () => {
6dd74de162 cy.contains('1Function').parents('.node').click();
6dd74de163 cy.get('.created-by-click').should('not.exist');
6dd74de164 });
6dd74de165
6dd74de166 it('should handle a click on a node with a bound url', () => {
6dd74de167 cy.contains('URL1').find('.node').click();
6dd74de168 cy.location().should(({ href }) => {
6dd74de169 expect(href).to.eq(`${baseUrl}/empty.html`);
6dd74de170 });
6dd74de171 });
6dd74de172
6dd74de173 it('should handle a click on a task with a bound function', () => {
6dd74de174 cy.get('rect#cl2').click({ force: true });
6dd74de175 cy.get('.created-by-gant-click').should('not.exist');
6dd74de176 });
6dd74de177
6dd74de178 it('should handle a click on a task with a bound function', () => {
6dd74de179 cy.get('text#cl2-text').click({ force: true });
6dd74de180 cy.get('.created-by-gant-click').should('not.exist');
6dd74de181 });
6dd74de182 });
6dd74de183});