Skip to content

Commit

Permalink
Fix: e2e tests, update js-conflux-sdk to 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Apr 16, 2020
1 parent e4a0112 commit b538513
Show file tree
Hide file tree
Showing 25 changed files with 725 additions and 659 deletions.
6 changes: 3 additions & 3 deletions app/scripts/controllers/transactions/tx-gas-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ class TxGasUtil {
}

/**
Writes the gas/stroage on the txParams in the txMeta
Writes the gas/storage on the txParams in the txMeta
@param {Object} txMeta - the txMeta object to write to
@param {string} blockGasLimitHex - the block gas limit hex
@param {string} estimatedGasHex - the estimated gas hex
*/
setTxGas (txMeta, blockGasLimitHex, { estimatedGasHex, estimatedStorageHex }) {
txMeta.estimatedGas = addHexPrefix(estimatedGasHex)
txMeta.estimatedStroage = addHexPrefix(estimatedStorageHex)
txMeta.estimatedStorage = addHexPrefix(estimatedStorageHex)
const txParams = txMeta.txParams

if (txMeta.simpleSend) {
Expand Down Expand Up @@ -165,7 +165,7 @@ class TxGasUtil {
txParams.gas = recommendedGasHex

if (!txMeta.storageLimitSpecified) {
txParams.storageLimit = txMeta.estimatedStroage
txParams.storageLimit = txMeta.estimatedStorage
}
return
}
Expand Down
5 changes: 5 additions & 0 deletions development/local-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const ganacheserver = new Ganache({ verbose: true, genBlockInterval: 300, killPo
'0x21041DD5AEBE8CD184965BA4AAE490F3B0C2500D87306FE9F32E276757BFDA68',
balance: 1e23,
},
{
secretKey:
'0x32A0D91B3930E625501C11F959BCBA312121A181C315751EA219813EDB0822A3',
balance: 1e20,
},
],
})
})()
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"gaba": "^1.10.0",
"human-standard-token-abi": "^2.0.0",
"jazzicon": "^2.0.0",
"js-conflux-sdk": "^0.9.0-alpha",
"js-conflux-sdk": "^0.9.1",
"json-rpc-engine": "^5.1.6",
"json-rpc-middleware-stream": "^2.1.1",
"jsonschema": "^1.2.4",
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/address-book.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')
await driver.delay(regularDelayMs)

await driver.clickElement(By.css('.dialog.send__dialog.dialog--message'))
Expand Down
9 changes: 4 additions & 5 deletions test/e2e/contract-test/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const initialize = () => {
type: 'constructor',
},
],
code: PiggyBankContractCode,
bytecode: PiggyBankContractCode,
})
deployButton.onclick = async () => {
contractStatus.innerHTML = 'Deploying'
Expand All @@ -189,7 +189,6 @@ const initialize = () => {
.constructor()
.sendTransaction({
from: accounts[0],
storageLimit: 700,
gasPrice: 10000000000,
})
.confirmed()
Expand All @@ -213,7 +212,6 @@ const initialize = () => {

depositButton.onclick = async () => {
contractStatus.innerHTML = 'Deposit initiated'
console.log(piggybankContract.deposit())
const depositResult = await piggybankContract
.deposit()
.sendTransaction({
Expand All @@ -231,6 +229,8 @@ const initialize = () => {
.withdraw('0xde0b6b3a7640000')
.sendTransaction({
from: accounts[0],
gas: 600000,
storageLimit: 0,
gasPrice: 10000000000,
})
.confirmed()
Expand Down Expand Up @@ -413,7 +413,7 @@ const initialize = () => {
type: 'event',
},
],
code: HumanStandardTokenContractCode,
bytecode: HumanStandardTokenContractCode,
})

const humanstandardtoken = await humanstandardtokenContract
Expand Down Expand Up @@ -480,7 +480,6 @@ const initialize = () => {
.sendTransaction({
from: accounts[0],
to: humanstandardtokenContract.address,
gas: 60000,
gasPrice: 10000000000,
})
.confirmed()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/ethereum-on.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/from-import-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Using MetaMask with an existing account', function () {

const testSeedPhrase =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress'
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3'
const testAddress = '0x1B5367BB0215070aD6EEF31576bbbB58B024A65c'
const testPrivateKey2 =
'14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'
const testPrivateKey3 =
Expand All @@ -28,7 +28,7 @@ describe('Using MetaMask with an existing account', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('Using MetaMask with an existing account', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/incremental-security.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('MetaMask', function () {
},
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/metamask-responsive-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x4CFD3E90FC78B0F86BF7524722150BB8DA9C60CD532564D7FF43F5716514F553',
'0xA7C2DFA78CCA35B33EBC3728BD6229D18A64C95B38E364A9CCE05FF5F832E5D2',
balance: 100000000000000000000,
},
],
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down
23 changes: 12 additions & 11 deletions test/e2e/metamask-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x4CFD3E90FC78B0F86BF7524722150BB8DA9C60CD532564D7FF43F5716514F553',
'0xA7C2DFA78CCA35B33EBC3728BD6229D18A64C95B38E364A9CCE05FF5F832E5D2',
balance: 100000000000000000000,
},
],
Expand Down Expand Up @@ -280,17 +280,18 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1000')

await driver.delay(tinyDelayMs)
const errorAmount = await driver.findElement(
By.css('.send-v2__error-amount')
By.css('.advanced-gas-inputs__gas-edit-row__error-text')
)
assert.equal(
await errorAmount.getText(),
'Insufficient funds.',
'Insufficient balance.',
'send screen should render an insufficient fund error message'
)

Expand Down Expand Up @@ -365,7 +366,7 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down Expand Up @@ -417,7 +418,7 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down Expand Up @@ -1188,7 +1189,7 @@ describe('MetaMask', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down Expand Up @@ -1239,7 +1240,7 @@ describe('MetaMask', function () {
await driver.delay(regularDelayMs)
assert(
confirmDataText.match(
/0xa9059cbb0000000000000000000000002f318c334780961fb129d2a6c30d0763d9a5c97/
/0xa9059cbb0000000000000000000000001f318c334780961fb129d2a6c30d0763d9a5c97/
)
)

Expand Down Expand Up @@ -1483,7 +1484,7 @@ describe('MetaMask', function () {
const confirmDataText = await confirmDataDiv.getText()
assert(
confirmDataText.match(
/0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef4/
/0x095ea7b30000000000000000000000008bc5baf874d2da8d216ae9f137804184ee5afef4/
)
)
})
Expand Down Expand Up @@ -1539,7 +1540,7 @@ describe('MetaMask', function () {
'.confirm-approve-content__transaction-details-content__secondary-fee'
)
)
assert.equal(await gasAndCollateralFeeInEth.getText(), '0.0006 CFX')
assert.equal(await gasAndCollateralFeeInEth.getText(), '0.0631 CFX')
})

it('edits the permission', async function () {
Expand Down Expand Up @@ -1716,7 +1717,7 @@ describe('MetaMask', function () {
By.css('.confirm-approve-content__medium-text')
)
const recipientDiv = permissionInfo[1]
assert.equal(await recipientDiv.getText(), '0x2f318C33...C970')
assert.equal(await recipientDiv.getText(), '0x1f318c33...C970')
})

it('submits the transaction', async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/permissions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/send-edit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Using MetaMask with an existing account', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Using MetaMask with an existing account', function () {
const inputAddress = await driver.findElement(
By.css('input[placeholder="Search, public address (0x)"]')
)
await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')
await inputAddress.sendKeys('0x1f318c334780961fb129d2a6c30d0763d9a5c970')

const inputAmount = await driver.findElement(By.css('.unit-input__input'))
await inputAmount.sendKeys('1')
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/signature-request.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('MetaMask', function () {
await fixtureServer.loadState(
path.join(__dirname, 'fixtures', 'imported-account')
)
publicAddress = '0x5cfe73b6021e818b776b421b1c4db2474086a7e1'
publicAddress = '0x1494e65ac65e076c4297a60d929ca5d3db7701b3'
const result = await buildWebDriver()
driver = result.driver
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/simple-send.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('MetaMask Browser Extension', function () {
By.css('[data-testid="ens-input"]')
)
await recipientAddressField.sendKeys(
'0x985c30949c92df7a0bd42e0f3e3d539ece98db24'
'0x185c30949c92df7a0bd42e0f3e3d539ece98db24'
)
const amountField = await driver.findElement(
By.css('.unit-input__input')
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/threebox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('MetaMask', function () {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
'0x57ED903454DEC7321ABB1729A7A3BB0F39B617109F610A74F9B402AAEF955333',
balance: 25000000000000000000,
},
],
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('MetaMask', function () {
await driver.delay(tinyDelayMs)

await addAddressInputs[1].sendKeys(
'0x2f318C334780961FB129D2a6c30D0763d9a5C970'
'0x1f318c334780961fb129d2a6c30d0763d9a5c970'
)

await driver.delay(largeDelayMs * 2)
Expand Down
Loading

0 comments on commit b538513

Please sign in to comment.