diff --git a/cypress/fixtures/project.json b/cypress/fixtures/project.json new file mode 100644 index 00000000..db32d647 --- /dev/null +++ b/cypress/fixtures/project.json @@ -0,0 +1,9 @@ +{ + "description": "Agile Projects Manager", + "github_slug": "fga-gpp-mds/owla", + "id": 2, + "is_project_from_github": true, + "is_scoring": false, + "name": "Falko", + "user_id": 1 +} \ No newline at end of file diff --git a/cypress/fixtures/releases.json b/cypress/fixtures/releases.json new file mode 100644 index 00000000..daa38b70 --- /dev/null +++ b/cypress/fixtures/releases.json @@ -0,0 +1,20 @@ +[ + { + "id": 2, + "name": "R2", + "description": "Second Release", + "amount_of_sprints": 1, + "project_id": 1, + "initial_date": "2017-01-01", + "final_date": "2017-12-01" + }, + { + "id": 1, + "name": "R1", + "description": "First Rrelease", + "amount_of_sprints": 2, + "project_id": 1, + "initial_date": "2016-01-01", + "final_date": "2016-12-01" + } +] \ No newline at end of file diff --git a/cypress/integration/authorization_spec.js b/cypress/integration/authorization_spec.js index 9307c9ce..5dee08e2 100644 --- a/cypress/integration/authorization_spec.js +++ b/cypress/integration/authorization_spec.js @@ -1,7 +1,5 @@ describe('Authorization tests', () => { beforeEach(() => { - cy.visit('localhost:8080/#/'); - cy.server(); // Stubing server response @@ -14,6 +12,8 @@ describe('Authorization tests', () => { }); it('should access homepage', () => { + cy.visit('localhost:8080/#/'); + cy.title().should('include', 'Falko'); cy.get('#loginRegisterComponent').within(() => { @@ -28,16 +28,7 @@ describe('Authorization tests', () => { }); it('should log in user', () => { - cy.get('form').within(() => { - cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') - .type('carla@gmail.com') - .should('have.value', 'carla@gmail.com'); - - cy.get('input:last').eq(0).should('have.attr', 'placeholder', 'Password') - .type('123456789') - .should('have.value', '123456789'); - }); - cy.get('#loginButton').click(); + cy.login() cy.url().should('eq', 'http://localhost:8080/#/projects'); }); @@ -55,6 +46,8 @@ describe('Authorization tests', () => { }, }, }).as('invalidLogin'); + + cy.visit('localhost:8080/#/'); cy.get('form').within(() => { cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') @@ -94,6 +87,8 @@ describe('Authorization tests', () => { response: 'fixture:login.json', }).as('register'); + cy.visit('localhost:8080/#/'); + cy.get('#pills-register-tab').click(); cy.get('form').within(() => { @@ -127,6 +122,8 @@ describe('Authorization tests', () => { response: {}, }).as('invalidRegister'); + cy.visit('localhost:8080/#/'); + cy.get('#pills-register-tab').click(); cy.get('form').within(() => { @@ -153,17 +150,7 @@ describe('Authorization tests', () => { }); it('should logout user', () => { - cy.get('form').within(() => { - cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') - .type('carla@gmail.com') - .should('have.value', 'carla@gmail.com'); - - cy.get('input:last').eq(0).should('have.attr', 'placeholder', 'Password') - .type('123456789') - .should('have.value', '123456789'); - }); - - cy.get('#loginButton').click(); + cy.login(); cy.get('#noProjects'); @@ -183,7 +170,9 @@ describe('Authorization tests', () => { }) it('should not access any page with user logged out', function(){ - cy.visit('localhost:8080/#/asdfasdf') + cy.visit('localhost:8080/#/'); + + cy.visit('localhost:8080/#/invalidURL') cy.get('#loginComponent') }) diff --git a/cypress/integration/projects_spec.js b/cypress/integration/projects_spec.js index 11fd08d7..74588879 100644 --- a/cypress/integration/projects_spec.js +++ b/cypress/integration/projects_spec.js @@ -1,27 +1,5 @@ describe('Projects tests', function(){ - - function login(){ - cy.route({ - method: 'POST', - url: '/authenticate', - status: 200, - response: 'fixture:login.json' - }).as('login') - - cy.get('form').within(function () { - cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') - .type('carla@gmail.com').should('have.value', 'carla@gmail.com') - - cy.get('input:last').eq(0).should('have.attr', 'placeholder', 'Password') - .type('123456789').should('have.value', '123456789') - }) - - cy.get('.falko-button').eq(0).click() - } - beforeEach(function(){ - cy.visit('localhost:8080/#/') - cy.server() cy.route({ @@ -34,7 +12,7 @@ describe('Projects tests', function(){ it('should get projects', function(){ - login() + cy.login() cy.get('.card-header').eq(0).contains('Owla') cy.get('.card-body').within(function(){ @@ -74,7 +52,7 @@ describe('Projects tests', function(){ ] }).as('addProject') - login() + cy.login() cy.get('.falko-button').eq(0).click() @@ -126,7 +104,7 @@ describe('Projects tests', function(){ it('should cancel add project process', function () { - login() + cy.login() cy.get('#addButton').contains('Add a Project').click() @@ -141,22 +119,13 @@ describe('Projects tests', function(){ }) it('should edit a project', function(){ - login() + cy.login() cy.route({ method: 'GET', url: '/projects\/2', status: 200, - response: - { - "description":"Agile Projects Manager" , - "github_slug": "fga-gpp-mds/owla", - "id":2, - "is_project_from_github":true, - "is_scoring":false, - "name":"Falko", - "user_id":1, - } + response: 'fixture:project.json' }).as('getProject') cy.get('.card-body').eq(1).click() @@ -219,22 +188,13 @@ describe('Projects tests', function(){ }) it('should delete project', function(){ - login() + cy.login() cy.route({ method: 'GET', url: '/projects\/1', status: 200, - response: - { - "description": "Agile Projects Manager", - "github_slug": "fga-gpp-mds/owla", - "id": 2, - "is_project_from_github": true, - "is_scoring": false, - "name": "Falko", - "user_id": 1, - } + response: 'fixture:project.json' }).as('getProject') cy.route({ diff --git a/cypress/integration/releases_spec.js b/cypress/integration/releases_spec.js new file mode 100644 index 00000000..e8723b80 --- /dev/null +++ b/cypress/integration/releases_spec.js @@ -0,0 +1,43 @@ +describe('Releases tests', () => { + beforeEach(() => { + cy.server() + + cy.route({ + method: 'GET', + url: '/users\/1/projects', + status: 200, + response: 'fixture:projects.json' + }).as('getProjects'); + + cy.route({ + method: 'GET', + url: '/projects\/2', + status: 200, + response: 'fixture:project.json' + }).as('getProject') + + cy.route({ + method: 'GET', + url: '/projects\/2/releases', + status: 200, + response: 'fixture:releases.json' + }).as('getReleases'); + + cy.login(); + + }) + + + it('should get releases', () => { + cy.get('#projectCard2').click(); + + cy.get('#releases').click(); + + cy.get('div#release2').contains('R2'); + cy.get('h1#release0Name').should('contain', 'R2'); + cy.get('#release0Description').should('contain', 'Second Release'); + cy.get('#releasePeriod'); + cy.get('#addReleaseButton').should('contain', 'Add Release'); + cy.get('#addSprintButton').should('contain', 'Add a Sprint'); + }) +}) \ No newline at end of file diff --git a/cypress/integration/users_spec.js b/cypress/integration/users_spec.js index 688d34a1..3e053be8 100644 --- a/cypress/integration/users_spec.js +++ b/cypress/integration/users_spec.js @@ -1,28 +1,5 @@ describe('Users tests', () => { - function login() { - cy.route({ - method: 'POST', - url: '/authenticate', - status: 200, - response: 'fixture:login.json', - }).as('login'); - - cy.get('form').within(() => { - cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') - .type('carla@gmail.com') - .should('have.value', 'carla@gmail.com'); - - cy.get('input:last').eq(0).should('have.attr', 'placeholder', 'Password') - .type('123456789') - .should('have.value', '123456789'); - }); - - cy.get('#loginButton').click(); - } - beforeEach(() => { - cy.visit('localhost:8080/#/'); - cy.server(); cy.route({ @@ -32,7 +9,7 @@ describe('Users tests', () => { response: 'fixture:projects.json', }).as('getProjects'); - login(); + cy.login(); cy.route({ method: 'GET', diff --git a/cypress/support/commands.js b/cypress/support/commands.js index c1f5a772..5f6cb5be 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -23,3 +23,35 @@ // // -- This is will overwrite an existing command -- // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) + +Cypress.Commands.add('login', () => { + const user = { + email: 'carla@email.com', + password: '123456789', + } + + cy.visit('localhost:8080/#/'); + + cy.server(); + + cy.route({ + method: 'POST', + url: '/authenticate', + status: 200, + response: 'fixture:login.json', + }).as('login'); + + cy.get('form').within(() => { + cy.get('input:first').eq(0).should('have.attr', 'placeholder', 'Email') + .type(user.email) + .should('have.value', 'carla@email.com'); + + cy.get('input:last').eq(0).should('have.attr', 'placeholder', 'Password') + .type(user.password) + .should('have.value', '123456789'); + }); + + cy.get('#loginButton').click(); + + cy.wait('@login') +}) \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 21fcc1b7..f5870700 100644 --- a/src/App.vue +++ b/src/App.vue @@ -208,6 +208,10 @@ label { min-height: 7em; } +.grey { + color: #777; +} + ::-webkit-scrollbar { width: 0.5em; } diff --git a/src/components/Projects/Project.vue b/src/components/Projects/Project.vue index bef0ce99..0e0bc028 100644 --- a/src/components/Projects/Project.vue +++ b/src/components/Projects/Project.vue @@ -16,20 +16,20 @@
-
-
- +
diff --git a/src/components/Projects/Projects.vue b/src/components/Projects/Projects.vue index f53fe3cc..03ce009e 100644 --- a/src/components/Projects/Projects.vue +++ b/src/components/Projects/Projects.vue @@ -5,12 +5,12 @@
 
-
+
-
+
-
-
+
+

{{project.name}}

@@ -26,7 +26,7 @@

- +
@@ -151,21 +151,21 @@ div a { color: #28639A; } -#projectCard:hover { - box-shadow: 0 4px 12px 0 rgba(0,0,0,0.2); - border-color: #5D6A6F; -} - -#projectCard { +.project-card { box-shadow: 0 2px 4px 0 rgba(0,0,0,0.3); transition: 0.2s; } -#projectHeader { +.project-card:hover { + box-shadow: 0 4px 12px 0 rgba(0,0,0,0.2); + border-color: #5D6A6F; +} + +.project-header { background-color: #5D6A6F; } -#projectTitle { +.project-title { margin: 0; color: white; } @@ -175,7 +175,7 @@ div a { font-style: italic; } -#grade { +.grade { margin-left: 1.5em; } diff --git a/src/components/Releases/AddRelease.vue b/src/components/Releases/AddRelease.vue index 905e140a..e8dc3df2 100644 --- a/src/components/Releases/AddRelease.vue +++ b/src/components/Releases/AddRelease.vue @@ -25,7 +25,7 @@