Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rontEnd into issue_199
  • Loading branch information
danieloda committed Dec 8, 2017
2 parents 44918c1 + 130beb1 commit 56bec7a
Show file tree
Hide file tree
Showing 23 changed files with 651 additions and 249 deletions.
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ after_success:
- git remote add dokkuprod [email protected]:falko-backend
- git remote -v
- git config --global push.default simple
- |
if [ "${TRAVIS_BRANCH}" == "devel" ]; then
echo "Deploying to homolog environment..."
git push -f dokku devel:master
else if [ "${TRAVIS_BRANCH}" == "master" ]; then
echo "Deploying to production environment..."
git push dokkuprod master:master
- >
if [[ "${TRAVIS_BRANCH}" == "devel" ]]; then
echo "Deploying to homolog environment...";
git push -f dokku devel:master;
else if [[ "${TRAVIS_BRANCH}" == "master" ]]; then
echo "Deploying to production environment...";
git push dokkuprod master:master;
else
echo "Skipping deploy..."
fi
echo "Skipping deploy...";
fi;
fi;
3 changes: 2 additions & 1 deletion build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = merge(baseWebpackConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env,
'API_URL': JSON.stringify('http://localhost:3000/')
'API_URL': JSON.stringify('http://localhost:3000/'),
'GITHUB_CLIENT_ID': JSON.stringify('1254ef5e2765397c4fb4')
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
Expand Down
4 changes: 2 additions & 2 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var webpackConfig = merge(baseWebpackConfig, {
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env,
'API_URL': JSON.stringify('http://45.55.176.99:3000/') //Homolog
// 'API_URL': JSON.stringify('http://104.236.12.198:3000/') //Production
'API_URL': JSON.stringify('https://45.55.176.99:3000/'),
'GITHUB_CLIENT_ID': JSON.stringify('cbd5f91719282354f09b')
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
Expand Down
8 changes: 8 additions & 0 deletions cypress/fixtures/login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"auth_token": "token123",
"user": {
"id": 1,
"name": "Carla",
"email": "[email protected]"
}
}
14 changes: 14 additions & 0 deletions cypress/fixtures/projects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"id": 1,
"name": "Owla",
"description": "Improving classes",
"user_id": 2
},
{
"id": 2,
"name": "Falko",
"description": "Agile Projects Manager",
"user_id": 2
}
]
7 changes: 7 additions & 0 deletions cypress/fixtures/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": 1,
"name": "Carla",
"email": "[email protected]",
"github": "carlaGit",
"access_token": null
}
38 changes: 22 additions & 16 deletions cypress/integration/authorization_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ describe('Authorization tests', function (){
method: 'POST',
url: '/authenticate',
status: 200,
response: {
'auth_token': 'token123',
'user': {
'id': 1,
'name': 'Carla',
'email': '[email protected]'
}
}
response: 'fixture:login.json'
}).as('login')
})

Expand Down Expand Up @@ -94,14 +87,7 @@ describe('Authorization tests', function (){
method: 'POST',
url: '/users',
status: 200,
response: {
'auth_token': 'token123',
'user': {
'id': 1,
'name': 'Carla',
'email': '[email protected]'
}
}
response: 'fixture:login.json'
}).as('register')

cy.get('#pills-register-tab').click()
Expand Down Expand Up @@ -160,4 +146,24 @@ describe('Authorization tests', function (){

cy.url().should('eq', 'http://localhost:8080/#/')
})

it('should logout user', function(){
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()

cy.get('#noProjects')

cy.get('.navbar').within(function(){
cy.get('#logout').click()
})

cy.url().should('eq', 'http://localhost:8080/#/')
})
})
169 changes: 147 additions & 22 deletions cypress/integration/projects_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ describe('Projects tests', function(){
method: 'POST',
url: '/authenticate',
status: 200,
response: {
'auth_token': 'token123',
'user': {
'id': 1,
'name': 'Carla',
'email': '[email protected]'
}
}
response: 'fixture:login.json'
}).as('login')

cy.get('form').within(function () {
Expand All @@ -35,20 +28,7 @@ describe('Projects tests', function(){
method: 'GET',
url: '/users\/1/projects',
status: 200,
response: [
{
"id": 1,
"name": "Owla",
"description": "Improving classes",
"user_id": 2,
},
{
"id": 2,
"name": "Falko",
"description": "Agile Projects Manager",
"user_id": 2,
}
]
response: 'fixture:projects.json'
}).as('getProjects')
})

Expand Down Expand Up @@ -143,5 +123,150 @@ describe('Projects tests', function(){
cy.get('.card-text').eq(11).contains('New Project Description')
})
})

it('should cancel add project process', function () {

login()

cy.get('#addButton').contains('Add a Project').click()

cy.wait(200)

cy.get('.modal-footer').eq(0).within(function () {
cy.get('.falko-button-grey').contains('Close').click()
})

cy.get('.card-header').eq(0).contains('Owla')
cy.get('.card-header').eq(1).contains('Falko')
})

it('should edit a project', function(){
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,
}
}).as('getProject')

cy.get('.card-body').eq(1).click()

cy.wait('@getProject')

cy.get('.card-title').contains('Falko')
cy.get('.card-text').contains('Agile Projects Manager')

cy.get('#editbutton').eq(0).click()
cy.get('.modal-header').contains('Edit Project')

cy.get('input').eq(1).type(' plus').should('have.value','Falko plus')
cy.get('input').eq(2).type(' plus').should('have.value','Agile Projects Manager plus')

cy.get('.v-switch-label').contains('off')

cy.route({
method: 'PUT',
url: '/projects\/2',
status: 200,
response:
{
"description":"AAgile Projects Manager plus" ,
"github_slug": "fga-gpp-mds/owla",
"id":2,
"is_project_from_github":true,
"is_scoring":false,
"name":"Falko plus",
"user_id":1,
},
}).as('updateProject')

cy.route({
method: 'GET',
url: '/projects\/2',
status: 200,
response:
{
"description":"Agile Projects Manager plus" ,
"github_slug": "fga-gpp-mds/owla",
"id":2,
"is_project_from_github":true,
"is_scoring":false,
"name":"Falko plus",
"user_id":1,
}
}).as('getProjectUp')


cy.get('.modal-footer').within(function(){
cy.get('.falko-button').eq(0).contains('Save').click()
})

cy.wait('@getProjectUp')

cy.get('.card-title').contains('Falko plus')
cy.get('.card-text').contains('Agile Projects Manager plus')
})

it('should delete project', function(){
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,
}
}).as('getProject')

cy.route({
method: 'DELETE',
url: '/projects/1',
status: 200,
response: {}
}).as('deleteProject')


cy.get('.card-header').eq(0).contains('Owla').click()

cy.route({
method: 'GET',
url: '/users\/1/projects',
status: 200,
response: [{
"id": 2,
"name": "Falko",
"description": "Agile Projects Manager",
"user_id": 2
}]
}).as('getProjectsAfterDelete')

cy.get('#deletebutton').contains('Delete').click()

cy.wait(200)

cy.get('.modal-footer').eq(1).within(function(){
cy.get('.falko-button').click()
})

cy.get('.card-header').contains('Falko')
})
})

Loading

0 comments on commit 56bec7a

Please sign in to comment.