From 9e5288d04f4e7bdaa92ee028a38cb2a96bdf88a7 Mon Sep 17 00:00:00 2001 From: Mathias Betancurt Date: Mon, 13 Jul 2020 17:37:36 +0200 Subject: [PATCH] test: fixed remaining broken tests CU-1k6t94[closed] --- cypress/integration/dsh_list_users.js | 9 ++---- cypress/integration/dsh_sidemenu.js | 43 +++++++-------------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/cypress/integration/dsh_list_users.js b/cypress/integration/dsh_list_users.js index 4e5032e..4ff4a90 100644 --- a/cypress/integration/dsh_list_users.js +++ b/cypress/integration/dsh_list_users.js @@ -21,13 +21,8 @@ const users = [ describe('SP2: (Dashboard): All Users', function () { beforeEach('Auth', function () { - cy - .request('POST', API + 'auth/login', { username: 'admin', password: 'admin' }) - .then((response) => { - // response.body is automatically serialized into JSON - cy.setCookie('user', 'admin'); - cy.setCookie('jwt', response.body); - }); + cy.setCookie('sneaky', 'admin'); + cy.setCookie('hummingbird', 'admin'); cy.server(); // enable response stubbing cy.route({ method: 'GET', // Route all GET requests diff --git a/cypress/integration/dsh_sidemenu.js b/cypress/integration/dsh_sidemenu.js index 81ae5fa..81931b6 100644 --- a/cypress/integration/dsh_sidemenu.js +++ b/cypress/integration/dsh_sidemenu.js @@ -4,26 +4,15 @@ UseCase 01A: Create new Operation import {API} from '../../src/consts'; describe('SP: Dashboard', function () { it('All buttons of the sidemenu - admin', function() { - cy - .request('POST', API + 'auth/login', { username: 'admin', password: 'admin' }) - .then((response) => { - // response.body is automatically serialized into JSON - cy.setCookie('user', 'admin'); - cy.setCookie('jwt', response.body); - }); - + cy.setCookie('sneaky', 'admin'); + cy.setCookie('hummingbird', 'admin'); cy.visit('http://localhost:2000/dashboard/'); cy.contains('dsh.returnmap').click(); cy.visit('http://localhost:2000/dashboard/'); }); it('All buttons of the sidemenu - admin', function() { - cy - .request('POST', API + 'auth/login', { username: 'admin', password: 'admin' }) - .then((response) => { - // response.body is automatically serialized into JSON - cy.setCookie('user', 'admin'); - cy.setCookie('jwt', response.body); - }); + cy.setCookie('sneaky', 'admin'); + cy.setCookie('hummingbird', 'admin'); cy.visit('http://localhost:2000/dashboard/'); cy.contains('dsh.all_users').click(); cy.contains('dsh.operations_list').click(); @@ -31,25 +20,13 @@ describe('SP: Dashboard', function () { cy.contains('dsh.logout').click(); }); it('All buttons of the sidemenu - pilot', function() { - cy - .request('POST', API + 'auth/login', { username: 'RenatePenvarden', password: 'xD6lJ9ATuA' }) - .then((response) => { - // response.body is automatically serialized into JSON - cy.setCookie('user', 'RenatePenvarden'); - cy.setCookie('jwt', response.body); - }); - + cy.setCookie('sneaky', 'RenatePenvarden'); + cy.setCookie('hummingbird', 'xD6lJ9ATuA'); cy.visit('http://localhost:2000/dashboard/'); - cy.get('.dshSide > .bp3-menu > li:nth-child(1) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.dshSide > .bp3-menu > li:nth-child(2) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.dashboard > .dshSide > .bp3-menu > li:nth-child(2) > .bp3-menu-item').click(); - cy.get('.dshSide > .bp3-menu > li:nth-child(5) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.dshSide > .bp3-menu > li:nth-child(8) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.dashboard > .dshSide > .bp3-menu > li:nth-child(10) > .bp3-menu-item').click(); - cy.get('#dshContentCont > .bp3-form-group > .bp3-form-content > .bp3-input-group > #text-nNumber').click(); - cy.get('.dshSide > .bp3-menu > li:nth-child(11) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.dshSide > .bp3-menu > li:nth-child(6) > .bp3-menu-item > .bp3-text-overflow-ellipsis').click(); - cy.get('.bp3-dialog-container > .bp3-dialog > .logoutButtons > .bp3-intent-success > .bp3-button-text').click(); + cy.contains('dsh.edit_your_info').click(); + cy.contains('dsh.operations_list_pilot').click(); + cy.contains('dsh.vehicles_new').click(); + cy.contains('dsh.vehicles_list_pilot').click(); }); }); \ No newline at end of file