Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Release Acceptance Tests #355

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cypress/fixtures/project.json
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions cypress/fixtures/releases.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
37 changes: 13 additions & 24 deletions cypress/integration/authorization_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
describe('Authorization tests', () => {
beforeEach(() => {
cy.visit('localhost:8080/#/');

cy.server();

// Stubing server response
Expand All @@ -14,6 +12,8 @@ describe('Authorization tests', () => {
});

it('should access homepage', () => {
cy.visit('localhost:8080/#/');

cy.title().should('include', 'Falko');

cy.get('#loginRegisterComponent').within(() => {
Expand All @@ -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('[email protected]')
.should('have.value', '[email protected]');

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');
});
Expand All @@ -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')
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -127,6 +122,8 @@ describe('Authorization tests', () => {
response: {},
}).as('invalidRegister');

cy.visit('localhost:8080/#/');

cy.get('#pills-register-tab').click();

cy.get('form').within(() => {
Expand All @@ -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('[email protected]')
.should('have.value', '[email protected]');

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');

Expand All @@ -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')
})
Expand Down
54 changes: 7 additions & 47 deletions cypress/integration/projects_spec.js
Original file line number Diff line number Diff line change
@@ -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('[email protected]').should('have.value', '[email protected]')

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({
Expand All @@ -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(){
Expand Down Expand Up @@ -74,7 +52,7 @@ describe('Projects tests', function(){
]
}).as('addProject')

login()
cy.login()

cy.get('.falko-button').eq(0).click()

Expand Down Expand Up @@ -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()

Expand All @@ -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()
Expand Down Expand Up @@ -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({
Expand Down
43 changes: 43 additions & 0 deletions cypress/integration/releases_spec.js
Original file line number Diff line number Diff line change
@@ -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');
})
})
25 changes: 1 addition & 24 deletions cypress/integration/users_spec.js
Original file line number Diff line number Diff line change
@@ -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('[email protected]')
.should('have.value', '[email protected]');

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({
Expand All @@ -32,7 +9,7 @@ describe('Users tests', () => {
response: 'fixture:projects.json',
}).as('getProjects');

login();
cy.login();

cy.route({
method: 'GET',
Expand Down
32 changes: 32 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]',
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', '[email protected]');

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')
})
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ label {
min-height: 7em;
}

.grey {
color: #777;
}

::-webkit-scrollbar {
width: 0.5em;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Projects/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
<div class="row">
<div align="center">
<router-link v-bind:to="'/projects/'+project.id+'/issues'">
<button type="button" class="btn btn-info btn-md falko-button" v-if="isFromProjectGitHub()">
<button type="button" class="btn btn-info btn-md falko-button" id="backlog" v-if="isFromProjectGitHub()">
Backlog
</button>
</router-link>
</div>
<div align="center">
<router-link v-bind:to="'/projects/'+project.id+'/releases'">
<button type="button" class="btn btn-info btn-md falko-button">
<button type="button" class="btn btn-info btn-md falko-button" id="releases">
Releases
</button>
</router-link>
</div>
<div align="center">
<addGrade></addGrade>
<addGrade id="addGrade"></addGrade>
</div>
<div align="center">
<edit-project v-on:edited-project="refreshProject()"></edit-project>
Expand Down
Loading