This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up end-to-end tests with protractor #41
- Loading branch information
Vit Stanislav
authored and
Vit Stanislav
committed
Mar 3, 2017
1 parent
6ee05fc
commit a9e14a9
Showing
3 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,28 @@ Build package for Linux. | |
npm run dist:linux | ||
``` | ||
|
||
## Run end-to-end tests | ||
|
||
### Setup | ||
As described on http://www.protractortest.org/#/ run: | ||
``` | ||
npm install -g protractor | ||
webdriver-manager update | ||
webdriver-manager start | ||
``` | ||
|
||
### Run | ||
As described on http://www.protractortest.org/#/ run: | ||
Start the development version as described above. | ||
|
||
Run the tests: | ||
``` | ||
cd src | ||
protractor spec/conf.js | ||
``` | ||
|
||
|
||
|
||
## Authors | ||
|
||
Ricardo Ferro <[email protected]> | ||
|
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,7 @@ | ||
exports.config = { | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
specs: ['spec.js'], | ||
capabilities: { | ||
browserName: 'chrome' | ||
} | ||
}; |
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,60 @@ | ||
var testAcocunt = { | ||
passphrase: 'stay undo beyond powder sand laptop grow gloom apology hamster primary arrive', | ||
address: '5932438298200837883L', | ||
}; | ||
var EC = protractor.ExpectedConditions; | ||
|
||
describe('Lisk Nano functionality', function() { | ||
it('should allow to login', testLogin); | ||
it('should allow to logout', testLogout); | ||
it('should allow to create a new account', testUndefined); | ||
it('should show address', testAddress); | ||
it('should show peer', testUndefined); | ||
it('should allow to change peer', testUndefined); | ||
it('should show balance', testUndefined); | ||
it('should allow to send transaction when enough funds and correct address form', testUndefined); | ||
it('should not allow to send transaction when not enough funds', testUndefined); | ||
it('should not allow to send transaction when incorrect address form', testUndefined); | ||
it('should show transactions', testUndefined); | ||
it('should allow to load more transactions', testUndefined); | ||
}); | ||
|
||
|
||
function testUndefined() { | ||
throw 'Not defined yet.'; | ||
} | ||
|
||
function testLogin() { | ||
login(testAcocunt); | ||
|
||
var elem = element(by.css('.logout')); | ||
browser.wait(EC.presenceOf(elem), 10000); | ||
expect(elem.getText()).toEqual('LOGOUT'); | ||
} | ||
|
||
function testLogout() { | ||
login(testAcocunt); | ||
|
||
var logoutButton = element(by.css('.logout')); | ||
browser.wait(EC.presenceOf(logoutButton), 10000); | ||
logoutButton.click(); | ||
|
||
var loginButton = element(by.css('.md-button.md-primary.md-raised')); | ||
browser.wait(EC.presenceOf(loginButton), 10000); | ||
expect(loginButton.getText()).toEqual('LOGIN'); | ||
} | ||
|
||
function testAddress() { | ||
login(testAcocunt); | ||
|
||
var addressElem = element(by.css('.address')); | ||
browser.wait(EC.presenceOf(addressElem), 10000); | ||
expect(addressElem.getText()).toEqual(testAcocunt.address); | ||
} | ||
|
||
function login(account) { | ||
browser.ignoreSynchronization = true; | ||
browser.get('http://localhost:8080'); | ||
element(by.css('input[type="password"]')).sendKeys(account.passphrase); | ||
element(by.css('.md-button.md-primary.md-raised')).click(); | ||
} |