From 823cbf43fbfa437469cf9c81a6dedabb105d1b9a Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Fri, 3 Jul 2020 15:24:29 +0200 Subject: [PATCH] M #~: fix code node (#77) Signed-off-by: Jorge Lobo --- .gitignore | 8 + src/fireedge/config.yml | 14 +- src/fireedge/cypress.json | 9 +- .../integration/dashboard/index.spec.js | 34 ++ .../cypress/integration/login/index.spec.js | 296 ++++++++++++++++++ src/fireedge/cypress/plugins/index.js | 17 + src/fireedge/package.json | 16 +- src/fireedge/src/routes/entrypoints/Api.js | 167 ++++++++++ .../entrypoints/middlewares/api/index.js | 142 +++++++++ .../routes/entrypoints/middlewares/index.js | 37 +++ src/fireedge/src/utils/index.js | 1 + .../system_config --- toda la configuración | 2 + src/fireedge/yarn.lock | 26 +- 13 files changed, 744 insertions(+), 25 deletions(-) create mode 100644 src/fireedge/cypress/integration/dashboard/index.spec.js create mode 100644 src/fireedge/cypress/integration/login/index.spec.js create mode 100644 src/fireedge/cypress/plugins/index.js create mode 100644 src/fireedge/src/routes/entrypoints/Api.js create mode 100644 src/fireedge/src/routes/entrypoints/middlewares/api/index.js create mode 100644 src/fireedge/src/routes/entrypoints/middlewares/index.js create mode 100644 src/fireedge/system_config --- toda la configuración diff --git a/.gitignore b/.gitignore index 80129c6c86..9cd7c76d19 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,14 @@ src/sunstone/public/locale/languages/*.js src/sunstone/public/package-lock.json .tx/config +src/fireedge/node_modules +src/fireedge/dist +src/fireedge/test +src/fireedge/.vscode/launch.json +src/fireedge/yarn-error.log +src/fireedge/.DS_Store +src/fireedge/cypress/screenshots + src/onedb/local/ src/onedb/shared/ diff --git a/src/fireedge/config.yml b/src/fireedge/config.yml index 74235a92b6..c86e3ca745 100644 --- a/src/fireedge/config.yml +++ b/src/fireedge/config.yml @@ -35,16 +35,4 @@ OPENNEBULA_ZONES: - ID: 1 RPC: http://localhost:2633/RPC2 ZEROMQ: - VNC: - - -# Presentation information system (Config information) -SYSTEM_DATA: - NO_AUTH: - - MODE - AUTH: - - MODE - - OPENNEBULA_ZONES: - - ID - - VNC - - ZEROMQ \ No newline at end of file + VNC: \ No newline at end of file diff --git a/src/fireedge/cypress.json b/src/fireedge/cypress.json index 0967ef424b..b415b2aab6 100644 --- a/src/fireedge/cypress.json +++ b/src/fireedge/cypress.json @@ -1 +1,8 @@ -{} +{ + "port": 3001, + "numTestsKeptInMemory": 20, + "env":{}, + "video": false, + "viewportHeight": 720, + "viewportWidth": 1280 +} diff --git a/src/fireedge/cypress/integration/dashboard/index.spec.js b/src/fireedge/cypress/integration/dashboard/index.spec.js new file mode 100644 index 0000000000..b8044d7146 --- /dev/null +++ b/src/fireedge/cypress/integration/dashboard/index.spec.js @@ -0,0 +1,34 @@ +// / + +context('dashboard', () => { + beforeEach(() => { + cy.visit('https://localhost:3000'); + }); + + it('!!!!See menu', () => { + // https://on.cypress.io/type + cy.get('.action-email') + .type('fake@email.com') + .should('have.value', 'fake@email.com') + + // .type() with special character sequences + .type('{leftarrow}{rightarrow}{uparrow}{downarrow}') + .type('{del}{selectall}{backspace}') + + // .type() with key modifiers + .type('{alt}{option}') // these are equivalent + .type('{ctrl}{control}') // these are equivalent + .type('{meta}{command}{cmd}') // these are equivalent + .type('{shift}') + + // Delay each keypress by 0.1 sec + .type('slow.typing@email.com', { delay: 100 }) + .should('have.value', 'slow.typing@email.com'); + + cy.get('.action-disabled') + // Ignore error checking prior to type + // like whether the input is visible or disabled + .type('disabled error checking', { force: true }) + .should('have.value', 'disabled error checking'); + }); +}); diff --git a/src/fireedge/cypress/integration/login/index.spec.js b/src/fireedge/cypress/integration/login/index.spec.js new file mode 100644 index 0000000000..1e788edf1f --- /dev/null +++ b/src/fireedge/cypress/integration/login/index.spec.js @@ -0,0 +1,296 @@ +// / + +context('login', () => { + beforeEach(() => { + cy.visit('https://localhost:3000'); + }); + + it('Login without 2FA', () => { + // https://on.cypress.io/type + cy.get('.action-email') + .type('fake@email.com') + .should('have.value', 'fake@email.com') + + // .type() with special character sequences + .type('{leftarrow}{rightarrow}{uparrow}{downarrow}') + .type('{del}{selectall}{backspace}') + + // .type() with key modifiers + .type('{alt}{option}') // these are equivalent + .type('{ctrl}{control}') // these are equivalent + .type('{meta}{command}{cmd}') // these are equivalent + .type('{shift}') + + // Delay each keypress by 0.1 sec + .type('slow.typing@email.com', { delay: 100 }) + .should('have.value', 'slow.typing@email.com'); + + cy.get('.action-disabled') + // Ignore error checking prior to type + // like whether the input is visible or disabled + .type('disabled error checking', { force: true }) + .should('have.value', 'disabled error checking'); + }); + + it('.focus() - focus on a DOM element', () => { + // https://on.cypress.io/focus + cy.get('.action-focus') + .focus() + .should('have.class', 'focus') + .prev() + .should('have.attr', 'style', 'color: orange;'); + }); + + it('.blur() - blur off a DOM element', () => { + // https://on.cypress.io/blur + cy.get('.action-blur') + .type('About to blur') + .blur() + .should('have.class', 'error') + .prev() + .should('have.attr', 'style', 'color: red;'); + }); + + it('.clear() - clears an input or textarea element', () => { + // https://on.cypress.io/clear + cy.get('.action-clear') + .type('Clear this text') + .should('have.value', 'Clear this text') + .clear() + .should('have.value', ''); + }); + + it('.submit() - submit a form', () => { + // https://on.cypress.io/submit + cy.get('.action-form') + .find('[type="text"]') + .type('HALFOFF'); + cy.get('.action-form') + .submit() + .next() + .should('contain', 'Your form has been submitted!'); + }); + + it('.click() - click on a DOM element', () => { + // https://on.cypress.io/click + cy.get('.action-btn').click(); + + // You can click on 9 specific positions of an element: + // ----------------------------------- + // | topLeft top topRight | + // | | + // | | + // | | + // | left center right | + // | | + // | | + // | | + // | bottomLeft bottom bottomRight | + // ----------------------------------- + + // clicking in the center of the element is the default + cy.get('#action-canvas').click(); + + cy.get('#action-canvas').click('topLeft'); + cy.get('#action-canvas').click('top'); + cy.get('#action-canvas').click('topRight'); + cy.get('#action-canvas').click('left'); + cy.get('#action-canvas').click('right'); + cy.get('#action-canvas').click('bottomLeft'); + cy.get('#action-canvas').click('bottom'); + cy.get('#action-canvas').click('bottomRight'); + + // .click() accepts an x and y coordinate + // that controls where the click occurs :) + + cy.get('#action-canvas') + .click(80, 75) // click 80px on x coord and 75px on y coord + .click(170, 75) + .click(80, 165) + .click(100, 185) + .click(125, 190) + .click(150, 185) + .click(170, 165); + + // click multiple elements by passing multiple: true + cy.get('.action-labels>.label').click({ multiple: true }); + + // Ignore error checking prior to clicking + cy.get('.action-opacity>.btn').click({ force: true }); + }); + + it('.dblclick() - double click on a DOM element', () => { + // https://on.cypress.io/dblclick + + // Our app has a listener on 'dblclick' event in our 'scripts.js' + // that hides the div and shows an input on double click + cy.get('.action-div') + .dblclick() + .should('not.be.visible'); + cy.get('.action-input-hidden').should('be.visible'); + }); + + it('.check() - check a checkbox or radio element', () => { + // https://on.cypress.io/check + + // By default, .check() will check all + // matching checkbox or radio elements in succession, one after another + cy.get('.action-checkboxes [type="checkbox"]') + .not('[disabled]') + .check() + .should('be.checked'); + + cy.get('.action-radios [type="radio"]') + .not('[disabled]') + .check() + .should('be.checked'); + + // .check() accepts a value argument + cy.get('.action-radios [type="radio"]') + .check('radio1') + .should('be.checked'); + + // .check() accepts an array of values + cy.get('.action-multiple-checkboxes [type="checkbox"]') + .check(['checkbox1', 'checkbox2']) + .should('be.checked'); + + // Ignore error checking prior to checking + cy.get('.action-checkboxes [disabled]') + .check({ force: true }) + .should('be.checked'); + + cy.get('.action-radios [type="radio"]') + .check('radio3', { force: true }) + .should('be.checked'); + }); + + it('.uncheck() - uncheck a checkbox element', () => { + // https://on.cypress.io/uncheck + + // By default, .uncheck() will uncheck all matching + // checkbox elements in succession, one after another + cy.get('.action-check [type="checkbox"]') + .not('[disabled]') + .uncheck() + .should('not.be.checked'); + + // .uncheck() accepts a value argument + cy.get('.action-check [type="checkbox"]') + .check('checkbox1') + .uncheck('checkbox1') + .should('not.be.checked'); + + // .uncheck() accepts an array of values + cy.get('.action-check [type="checkbox"]') + .check(['checkbox1', 'checkbox3']) + .uncheck(['checkbox1', 'checkbox3']) + .should('not.be.checked'); + + // Ignore error checking prior to unchecking + cy.get('.action-check [disabled]') + .uncheck({ force: true }) + .should('not.be.checked'); + }); + + it('.select() - select an option in a