-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
147 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export function login() { | ||
cy.clearLocalStorage() | ||
|
||
cy.visit('/#/') | ||
// Label | ||
cy.get('label#label-username').should('contain', 'Username') | ||
cy.get('label#label-password').should('contain', 'Password') | ||
|
||
// Typing the form | ||
cy.get('input#username').type('demo').should('have.value', 'demo') | ||
cy.get('input#password').type('password') | ||
cy.get('button.btn').click() | ||
} | ||
|
||
export function login_as_user() { | ||
cy.clearLocalStorage() | ||
|
||
cy.visit('/#/') | ||
// Label | ||
cy.get('label#label-username').should('contain', 'Username') | ||
cy.get('label#label-password').should('contain', 'Password') | ||
|
||
// Typing the form | ||
cy.get('input#username').type('user').should('have.value', 'user') | ||
cy.get('input#password').type('password') | ||
cy.get('button.btn').click() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export function filled_farm() { | ||
// Label | ||
cy.get('label#label-name').should('contain', 'Farm Name') | ||
cy.get('label#label-description').should('contain', 'Farm Description') | ||
cy.get('label#label-type').should('contain', 'Farm Type') | ||
cy.get('label#label-location').should('contain', 'Location') | ||
cy.get('label#label-country').should('contain', 'Country') | ||
cy.get('label#label-city').should('contain', 'City') | ||
|
||
// Typing the form | ||
cy.get('input#name').type('FarmName2').should('have.value', 'FarmName2') | ||
cy.get('textarea#description').type('Farm long description criteria').should('have.value','Farm long description criteria') | ||
cy.get('select#type').select('organic') | ||
cy.get('input#latitude').type('-6.2499848').should('have.value', '-6.2499848') | ||
cy.get('input#longitude').type('106.68292059999999').should('have.value', '106.68292059999999') | ||
cy.get('select#country').select('ID') | ||
cy.get('select#city').select('JK') | ||
cy.get('button.btn[type=submit]').click() | ||
} | ||
|
||
export function filled_reservoir() { | ||
// Label | ||
cy.get('label#label-name').should('contain', 'Reservoir Name') | ||
cy.get('label#label-source').should('contain', 'Source') | ||
|
||
// Typing the form | ||
cy.get('#name').type('Reservoir1').should('have.value', 'Reservoir1') | ||
cy.get('#type').select('TAP') | ||
cy.get('#capacity').should('not.exist') | ||
cy.get('#type').select('BUCKET') | ||
cy.get('#capacity').should('exist').type('12').should('have.value', '12') | ||
cy.get('button.btn[type=submit]').click() | ||
} | ||
|
||
export function filled_area() { | ||
// Label | ||
cy.get('label#label-name').should('contain', 'Area Name') | ||
cy.get('label#label-size').should('contain', 'Size') | ||
cy.get('label#label-type').should('contain', 'Type') | ||
cy.get('label#label-location').should('contain', 'Locations') | ||
cy.get('label#label-reservoir').should('contain', 'Select Reservoir') | ||
|
||
// Typing the form | ||
cy.get('#name').type('Area1').should('have.value', 'Area1') | ||
cy.get('#size').type('2').should('have.value', '2') | ||
cy.get('#size_unit').select('Ha') | ||
cy.get('#type').select('SEEDING') | ||
cy.get('#location').select('OUTDOOR') | ||
cy.get('#reservoir').select('Reservoir1') | ||
cy.get('button.btn[type=submit]').click() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { login_as_user } from '../factory/auth' | ||
|
||
describe('Logout specs', () => { | ||
it ('should have logout link', () => { | ||
login_as_user() | ||
cy.get('#signout').should('contain', 'Sign Out') | ||
cy.get('#signout').click() | ||
cy.location().should( location => { | ||
expect(location.hash).to.eq('#/auth/login') | ||
}) | ||
}) | ||
|
||
it ('should not visit the dashboard page if the user already logout', () => { | ||
login_as_user() | ||
cy.get('#signout').should('contain', 'Sign Out') | ||
cy.get('#signout').click() | ||
|
||
cy.visit('/#/') | ||
cy.location().should( location => { | ||
expect(location.hash).to.eq('#/auth/login?redirect=%2F') | ||
}) | ||
|
||
cy.visit('/#/intro/area') | ||
cy.location().should( location => { | ||
expect(location.hash).to.eq('#/auth/login?redirect=%2Fintro%2Farea') | ||
}) | ||
}) | ||
|
||
it ('should not have localstorage with vuex key in the browser', () => { | ||
login_as_user() | ||
cy.get('#signout').should('contain', 'Sign Out') | ||
cy.get('#signout').click() | ||
|
||
expect(localStorage.getItem('vuex')).to.eq(null) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters