-
Notifications
You must be signed in to change notification settings - Fork 33
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
20 changed files
with
638 additions
and
435 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 |
---|---|---|
@@ -1,38 +1,71 @@ | ||
import { AddressDetailPage } from './address-detail.po'; | ||
import { GeneralPageFunctions } from "../general.po"; | ||
|
||
describe('skycoin-explorer Address Page', () => { | ||
const page = new AddressDetailPage(); | ||
const generalFunctions = new GeneralPageFunctions(); | ||
|
||
beforeEach(() => { }); | ||
|
||
it('should show the Address Text and its length should be l>26 and l<36', () => { | ||
page.navigateTo(); | ||
let address = page.getAddressText(); | ||
expect(address).toBeLessThan(36); | ||
expect(address).toBeGreaterThan(26); | ||
it('should display the correct title', () => { | ||
generalFunctions.navigateTo('/app/address/24ooGeabUGQLnJmoyviqA8h2y7Cgz2CY4x7'); | ||
expect(generalFunctions.getPageTitle()).toBe("24ooGeabUGQLnJmoyviqA8h2y7Cgz2CY4x7"); | ||
}); | ||
|
||
it('should show the Address Info row and its length should be 5', () => { | ||
page.navigateTo(); | ||
expect(page.getAddressInfo()).toEqual(5); | ||
it('should have the title for small screens', () => { | ||
expect(page.getPageTitleForSmallScreens()).toBe("Address"); | ||
}); | ||
|
||
it('should show the Transactions Rows and its length should be more than 0', () => { | ||
page.navigateTo(); | ||
expect(page.getTransactions()).toBe(true); | ||
it('should have 5 address details rows', () => { | ||
expect(generalFunctions.getDetailsRowCount()).toEqual(5); | ||
}); | ||
|
||
it('should show One Transaction Input and its length should be l>26 and l<36', () => { | ||
page.navigateTo(); | ||
let inputAddress = page.getOneTransactionInput(); | ||
expect(inputAddress).toBeLessThan(36); | ||
expect(inputAddress).toBeGreaterThan(26); | ||
it('should have the correct address for small screens', () => { | ||
expect(page.getAddressForSmallScreens()).toEqual("24ooGeabUGQLnJmoyviqA8h2y7Cgz2CY4x7"); | ||
}); | ||
|
||
it('should show tOne Transaction Output and its length should be l>26 and l<36', () => { | ||
page.navigateTo(); | ||
let outputAddress = page.getOneTransactionOutput(); | ||
expect(outputAddress).toBeLessThan(36); | ||
expect(outputAddress).toBeGreaterThan(26); | ||
it('should show the correct # of transactions', () => { | ||
expect(page.getNumberOfTransactions()).toBe(1); | ||
}); | ||
|
||
it('should show the correct received amount', () => { | ||
expect(page.getTotalReceived()).toBe(0.001); | ||
}); | ||
|
||
it('should show the correct current balance', () => { | ||
expect(page.getCurrentBalance()).toBe(0.001); | ||
}); | ||
|
||
it('should show the correct transaction ID', () => { | ||
expect(generalFunctions.getTransactionId(0)).toEqual('f375dfb0cea3f082daa03341f6283a483a9857206442feabc94f2b05b1df1fab'); | ||
}); | ||
|
||
it('should show a valid transaction date', () => { | ||
expect(generalFunctions.getTransactionDateValidity(0)).toBeTruthy(); | ||
}); | ||
|
||
it('should show the correct transaction inputs', () => { | ||
expect(generalFunctions.getTransactionInputs(0)).toBe('TXXyvkvs7Lt3EFtvTh51i4BagiJaGARsva'); | ||
}); | ||
|
||
it('should show the correct transaction outputs', () => { | ||
expect(generalFunctions.getTransactionOutputs(0)).toBe('24ooGeabUGQLnJmoyviqA8h2y7Cgz2CY4x7,TXXyvkvs7Lt3EFtvTh51i4BagiJaGARsva'); | ||
}); | ||
|
||
it('should have the correct coins amount', () => { | ||
expect(generalFunctions.getTransactionInputsAndOutputsTotalCoins()).toBe(6.002); | ||
}); | ||
|
||
it('should show the correct final address balance', () => { | ||
expect(page.getFinalBalance(0)).toBe(0.001); | ||
}); | ||
|
||
it('should show the correct balance variation', () => { | ||
expect(page.getBalanceChange(0)).toBe(0.001); | ||
}); | ||
|
||
it('should show the error message', () => { | ||
generalFunctions.navigateTo('/app/address/24ooGeabUGQLnJmoyviqA8h2y7Cgz2CY4x8'); | ||
expect(generalFunctions.getErrorMessage()).toBeDefined(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,72 +1,49 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class AddressDetailPage { | ||
navigateTo() { | ||
return browser.get('/'); | ||
getPageTitleForSmallScreens() { | ||
return element(by.css('.element-details-wrapper > h2:nth-child(2)')) | ||
.getAttribute('textContent'); | ||
} | ||
|
||
goToAddressPage() { | ||
return element(by.css('.table a.-row')) | ||
.click() | ||
.then(() => { | ||
return element(by.css('.transaction > .-data > .row > div:nth-of-type(2) a')) | ||
.click(); | ||
}); | ||
getAddressForSmallScreens() { | ||
return element(by.css('.element-details > div:nth-of-type(1) > span:nth-of-type(2)')) | ||
.getAttribute('textContent'); | ||
} | ||
|
||
getAddressText() { | ||
return this.goToAddressPage().then(() => { | ||
return element(by.css('.element-details-wrapper h2:nth-of-type(1)')) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
getNumberOfTransactions() { | ||
return element(by.css('.element-details > div:nth-of-type(2) > div')) | ||
.getText() | ||
.then(text => Number(text)); | ||
} | ||
|
||
getAddressInfo() { | ||
return this.goToAddressPage().then(() => { | ||
return element | ||
.all(by.css('.element-details > div')) | ||
.count() | ||
.then(count => count); | ||
}); | ||
getTotalReceived() { | ||
return element(by.css('.element-details > div:nth-of-type(3) > div')) | ||
.getText() | ||
.then(text => Number(text.replace(new RegExp(',', 'g'), ''))); | ||
} | ||
|
||
getTransactions() { | ||
return this.goToAddressPage().then(() => { | ||
return element | ||
.all(by.css('.transaction')) | ||
.count() | ||
.then(count => count > 0); | ||
}); | ||
getCurrentBalance() { | ||
return element(by.css('.element-details > div:nth-of-type(3) > div')) | ||
.getText() | ||
.then(text => Number(text.replace(new RegExp(',', 'g'), ''))); | ||
} | ||
|
||
getOneTransactionId() { | ||
return this.goToAddressPage().then(() => { | ||
return element | ||
.all(by.css('.transaction .-title .col-sm-8.-left a')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
getFinalBalance(transsactionIndex: number) { | ||
return element | ||
.all(by.css('.transaction')) | ||
.get(transsactionIndex) | ||
.element(by.css('.-final-balance > div > div:nth-of-type(3)')) | ||
.getText() | ||
.then(text => Number(text.replace(new RegExp(',', 'g'), ''))); | ||
} | ||
|
||
getOneTransactionInput() { | ||
return this.goToAddressPage().then(() => { | ||
return element | ||
.all(by.css('.transaction > .-data > .row > div:nth-of-type(1) a')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
} | ||
|
||
getOneTransactionOutput() { | ||
return this.goToAddressPage().then(() => { | ||
return element | ||
.all(by.css('.transaction > .-data > .row > div:nth-of-type(2) a')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
getBalanceChange(transsactionIndex: number) { | ||
return element | ||
.all(by.css('.transaction')) | ||
.get(transsactionIndex) | ||
.element(by.css('.-label')) | ||
.getText() | ||
.then(text => Number(text.split(' ')[0].replace(new RegExp(',', 'g'), ''))); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,46 +1,63 @@ | ||
import { BlockDetailsPage } from './block-details.po'; | ||
import { GeneralPageFunctions } from "../general.po"; | ||
|
||
describe('skycoin-explorer Block Details Page', () => { | ||
const page = new BlockDetailsPage(); | ||
const generalFunctions = new GeneralPageFunctions(); | ||
|
||
beforeEach(() => { }); | ||
|
||
it('should display block details text', () => { | ||
page.navigateTo(); | ||
expect(page.getOneBlockDetailsText()).toEqual('Block Details'); | ||
it('should display the title', () => { | ||
generalFunctions.navigateTo('/app/block/5'); | ||
expect(generalFunctions.getPageTitle()).toEqual('Block Details'); | ||
}); | ||
|
||
it('should display 6 block details rows', () => { | ||
page.navigateTo(); | ||
expect(page.getDetailsRow()).toEqual(6); | ||
expect(generalFunctions.getDetailsRowCount()).toEqual(6); | ||
}); | ||
|
||
it('should show the details of the Hash and its length should be 64', () => { | ||
page.navigateTo(); | ||
expect(page.getHash()).toEqual(64); | ||
it('should show the correct block hight', () => { | ||
expect(page.getBlockHeight()).toBe(5); | ||
}); | ||
|
||
it('should show the details of the Parent Hash and its length should be 64', () => { | ||
page.navigateTo(); | ||
expect(page.getParentHash()).toEqual(64); | ||
it('should show a valid timestamp', () => { | ||
expect(page.getTimestampValidity()).toBeTruthy(); | ||
}); | ||
|
||
it('should show the Transaction Id and its length should be 64', () => { | ||
page.navigateTo(); | ||
expect(page.getTransactionId()).toEqual(64); | ||
it('should show the correct size', () => { | ||
expect(page.getSize()).toBe(317); | ||
}); | ||
|
||
it('should show one Transaction Input address and its length should be l>26 and l<36', () => { | ||
page.navigateTo(); | ||
let inputAddress = page.getOneTransactionInput(); | ||
expect(inputAddress).toBeLessThan(36); | ||
expect(inputAddress).toBeGreaterThan(26); | ||
it('should show the correct block hash', () => { | ||
expect(page.getBlockHash()).toEqual("114fe60587a158428a47e0f9571d764f495912c299aa4e67fc88004cf21b0c24"); | ||
}); | ||
|
||
it('should show One Transaction Output address and its length should be l>26 and l<36', () => { | ||
page.navigateTo(); | ||
let outputAddress = page.getOneTransactionOutput(); | ||
expect(outputAddress).toBeLessThan(36); | ||
expect(outputAddress).toBeGreaterThan(26); | ||
it('should show the correct parent block hash', () => { | ||
expect(page.getParentHash()).toEqual("415e47348a1e642cb2e31d00ee500747d3aed0336aabfff7d783ed21465251c7"); | ||
}); | ||
|
||
it('should show the correct amount', () => { | ||
expect(page.getAmount()).toBe(999990); | ||
}); | ||
|
||
it('should show the correct transaction ID', () => { | ||
expect(generalFunctions.getTransactionId(0)).toEqual('0579e7727627cd9815a8a8b5e1df86124f45a4132cc0dbd00d2f110e4f409b69'); | ||
}); | ||
|
||
it('should show the correct transaction inputs', () => { | ||
expect(generalFunctions.getTransactionInputs(0)).toBe('R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ,R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ'); | ||
}); | ||
|
||
it('should show the correct transaction outputs', () => { | ||
expect(generalFunctions.getTransactionOutputs(0)).toBe('R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ,2fGC7kwAM9yZyEF1QqBqp8uo9RUsF6ENGJF'); | ||
}); | ||
|
||
it('should have the correct coins amount', () => { | ||
expect(generalFunctions.getTransactionInputsAndOutputsTotalCoins()).toBe(1999980); | ||
}); | ||
|
||
it('should show the error message', () => { | ||
generalFunctions.navigateTo('/app/block/-1'); | ||
expect(generalFunctions.getErrorMessage()).toBeDefined(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,76 +1,42 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class BlockDetailsPage { | ||
navigateTo() { | ||
return browser.get('/'); | ||
} | ||
|
||
goToOneBlockDetails() { | ||
return element(by.css('.table a.-row')).click(); | ||
getBlockHeight() { | ||
return element(by.css('.element-details > div:nth-of-type(1) > div')) | ||
.getText() | ||
.then(text => Number(text)); | ||
} | ||
|
||
getOneBlockDetailsText() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element(by.css('.element-details-wrapper h2')).getText(); | ||
}); | ||
getTimestampValidity() { | ||
return element(by.css('.element-details > div:nth-of-type(2) > div')) | ||
.getText() | ||
.then(text => !isNaN((new Date(text)).getTime())); | ||
} | ||
|
||
getDetailsRow() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element | ||
.all(by.css('.element-details .-row')) | ||
.count() | ||
.then(count => { | ||
return count; | ||
}); | ||
}); | ||
getSize() { | ||
return element(by.css('.element-details > div:nth-of-type(3) > div')) | ||
.getText() | ||
.then(text => Number(text.split(' ')[0])); | ||
} | ||
|
||
getHash() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element | ||
.all(by.css('.element-details .-row a.-link')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
getBlockHash() { | ||
return element | ||
.all(by.css('.element-details .-row a.-link')) | ||
.get(0) | ||
.getText(); | ||
} | ||
|
||
getParentHash() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element | ||
.all(by.css('.element-details .-row a.-link')) | ||
.get(1) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
} | ||
|
||
getTransactionId() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element(by.css('.transaction .-row a')) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
} | ||
|
||
getOneTransactionInput() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element | ||
.all(by.css('.transaction > .-data > .row > div:nth-of-type(1) a')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
return element | ||
.all(by.css('.element-details .-row a.-link')) | ||
.get(1) | ||
.getText(); | ||
} | ||
|
||
getOneTransactionOutput() { | ||
return this.goToOneBlockDetails().then(() => { | ||
return element | ||
.all(by.css('.transaction > .-data > .row > div:nth-of-type(2) a')) | ||
.get(0) | ||
.getText() | ||
.then(text => text.length); | ||
}); | ||
getAmount() { | ||
return element(by.css('.element-details > div:nth-of-type(6) > div')) | ||
.getText() | ||
.then(text => Number(text.split(' ')[0].replace(new RegExp(',', 'g'), ''))); | ||
} | ||
} |
Oops, something went wrong.