Functional Integration Tests for send ether flow. (#3119)
This commit is contained in:
parent
a9ecf9c6fc
commit
b63f0f3de2
|
@ -0,0 +1,154 @@
|
||||||
|
{
|
||||||
|
"metamask": {
|
||||||
|
"isInitialized": true,
|
||||||
|
"isUnlocked": true,
|
||||||
|
"featureFlags": {"betaUI": true},
|
||||||
|
"rpcTarget": "https://rawtestrpc.metamask.io/",
|
||||||
|
"identities": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"name": "Send Account 1"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"name": "Send Account 2"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"name": "Send Account 3"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"name": "Send Account 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unapprovedTxs": {},
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"conversionRate": 1200.88200327,
|
||||||
|
"conversionDate": 1489013762,
|
||||||
|
"noActiveNotices": true,
|
||||||
|
"frequentRpcList": [],
|
||||||
|
"network": "3",
|
||||||
|
"accounts": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x47c9d71831c76efe",
|
||||||
|
"nonce": "0x1b",
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x37452b1315889f80",
|
||||||
|
"nonce": "0xa",
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x30c9d71831c76efe",
|
||||||
|
"nonce": "0x1c",
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x0",
|
||||||
|
"nonce": "0x0",
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"addressBook": [
|
||||||
|
{
|
||||||
|
"address": "0x06195827297c7a80a443b6894d3bdb8824b43896",
|
||||||
|
"name": "Address Book Account 1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokens": [],
|
||||||
|
"transactions": {},
|
||||||
|
"selectedAddressTxList": [],
|
||||||
|
"unapprovedTxs": {
|
||||||
|
"4768706228115573": {
|
||||||
|
"id": 4768706228115573,
|
||||||
|
"time": 1487363153561,
|
||||||
|
"status": "unapproved",
|
||||||
|
"gasMultiplier": 1,
|
||||||
|
"metamaskNetworkId": "3",
|
||||||
|
"txParams": {
|
||||||
|
"from": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"to": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"value": "0x1bc16d674ec80000",
|
||||||
|
"metamaskId": 4768706228115573,
|
||||||
|
"metamaskNetworkId": "3",
|
||||||
|
"gas": "0xea60",
|
||||||
|
"gasPrice": "0xba43b7400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unapprovedMsgs": {},
|
||||||
|
"unapprovedMsgCount": 0,
|
||||||
|
"unapprovedPersonalMsgs": {},
|
||||||
|
"unapprovedPersonalMsgCount": 0,
|
||||||
|
"keyringTypes": [
|
||||||
|
"Simple Key Pair",
|
||||||
|
"HD Key Tree"
|
||||||
|
],
|
||||||
|
"keyrings": [
|
||||||
|
{
|
||||||
|
"type": "HD Key Tree",
|
||||||
|
"accounts": [
|
||||||
|
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Simple Key Pair",
|
||||||
|
"accounts": [
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selectedAddress": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"provider": {
|
||||||
|
"type": "testnet"
|
||||||
|
},
|
||||||
|
"shapeShiftTxList": [],
|
||||||
|
"lostAccounts": [],
|
||||||
|
"send": {
|
||||||
|
"gasLimit": "0xea60",
|
||||||
|
"gasPrice": "0xba43b7400",
|
||||||
|
"gasTotal": "0xb451dc41b578",
|
||||||
|
"tokenBalance": null,
|
||||||
|
"from": {
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"balance": "0x37452b1315889f80"
|
||||||
|
},
|
||||||
|
"to": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"amount": "0x1bc16d674ec80000",
|
||||||
|
"memo": "",
|
||||||
|
"errors": {},
|
||||||
|
"maxModeOn": false,
|
||||||
|
"editingTransactionId": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"appState": {
|
||||||
|
"menuOpen": false,
|
||||||
|
"currentView": {
|
||||||
|
"name": "confTx",
|
||||||
|
"detailView": null,
|
||||||
|
"context": 0
|
||||||
|
},
|
||||||
|
"accountDetail": {
|
||||||
|
"subview": "transactions"
|
||||||
|
},
|
||||||
|
"modal": {
|
||||||
|
"modalState": {},
|
||||||
|
"previousModalState": {}
|
||||||
|
},
|
||||||
|
"transForward": true,
|
||||||
|
"isLoading": false,
|
||||||
|
"warning": null,
|
||||||
|
"scrollToBottom": false,
|
||||||
|
"forgottenPassword": null
|
||||||
|
},
|
||||||
|
"identities": {}
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
{
|
||||||
|
"metamask": {
|
||||||
|
"isInitialized": true,
|
||||||
|
"isUnlocked": true,
|
||||||
|
"featureFlags": {"betaUI": true},
|
||||||
|
"rpcTarget": "https://rawtestrpc.metamask.io/",
|
||||||
|
"identities": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"name": "Send Account 1"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"name": "Send Account 2"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"name": "Send Account 3"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"name": "Send Account 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unapprovedTxs": {},
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"conversionRate": 1200.88200327,
|
||||||
|
"conversionDate": 1489013762,
|
||||||
|
"noActiveNotices": true,
|
||||||
|
"frequentRpcList": [],
|
||||||
|
"network": "3",
|
||||||
|
"accounts": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x47c9d71831c76efe",
|
||||||
|
"nonce": "0x1b",
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x37452b1315889f80",
|
||||||
|
"nonce": "0xa",
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x30c9d71831c76efe",
|
||||||
|
"nonce": "0x1c",
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x0",
|
||||||
|
"nonce": "0x0",
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"addressBook": [
|
||||||
|
{
|
||||||
|
"address": "0x06195827297c7a80a443b6894d3bdb8824b43896",
|
||||||
|
"name": "Address Book Account 1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokens": [],
|
||||||
|
"transactions": {},
|
||||||
|
"selectedAddressTxList": [],
|
||||||
|
"unapprovedTxs": {
|
||||||
|
"4768706228115573": {
|
||||||
|
"id": 4768706228115573,
|
||||||
|
"time": 1487363153561,
|
||||||
|
"status": "unapproved",
|
||||||
|
"gasMultiplier": 1,
|
||||||
|
"metamaskNetworkId": "3",
|
||||||
|
"txParams": {
|
||||||
|
"from": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"to": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"value": "0x1bc16d674ec80000",
|
||||||
|
"metamaskId": 4768706228115573,
|
||||||
|
"metamaskNetworkId": "3",
|
||||||
|
"gas": "0xea60",
|
||||||
|
"gasPrice": "0xba43b7400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unapprovedMsgs": {},
|
||||||
|
"unapprovedMsgCount": 0,
|
||||||
|
"unapprovedPersonalMsgs": {},
|
||||||
|
"unapprovedPersonalMsgCount": 0,
|
||||||
|
"keyringTypes": [
|
||||||
|
"Simple Key Pair",
|
||||||
|
"HD Key Tree"
|
||||||
|
],
|
||||||
|
"keyrings": [
|
||||||
|
{
|
||||||
|
"type": "HD Key Tree",
|
||||||
|
"accounts": [
|
||||||
|
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Simple Key Pair",
|
||||||
|
"accounts": [
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selectedAddress": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"provider": {
|
||||||
|
"type": "testnet"
|
||||||
|
},
|
||||||
|
"shapeShiftTxList": [],
|
||||||
|
"lostAccounts": [],
|
||||||
|
"send": {
|
||||||
|
"gasLimit": "0xea60",
|
||||||
|
"gasPrice": "0xba43b7400",
|
||||||
|
"gasTotal": "0xb451dc41b578",
|
||||||
|
"tokenBalance": null,
|
||||||
|
"from": {
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"balance": "0x37452b1315889f80"
|
||||||
|
},
|
||||||
|
"to": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"amount": "0x1bc16d674ec80000",
|
||||||
|
"memo": "",
|
||||||
|
"errors": {},
|
||||||
|
"maxModeOn": false,
|
||||||
|
"editingTransactionId": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"appState": {
|
||||||
|
"menuOpen": false,
|
||||||
|
"currentView": {
|
||||||
|
"name": "confTx",
|
||||||
|
"detailView": null,
|
||||||
|
"context": 0
|
||||||
|
},
|
||||||
|
"accountDetail": {
|
||||||
|
"subview": "transactions"
|
||||||
|
},
|
||||||
|
"modal": {
|
||||||
|
"modalState": {},
|
||||||
|
"previousModalState": {}
|
||||||
|
},
|
||||||
|
"transForward": true,
|
||||||
|
"isLoading": false,
|
||||||
|
"warning": null,
|
||||||
|
"scrollToBottom": false,
|
||||||
|
"forgottenPassword": null
|
||||||
|
},
|
||||||
|
"identities": {}
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
{
|
||||||
|
"metamask": {
|
||||||
|
"isInitialized": true,
|
||||||
|
"isUnlocked": true,
|
||||||
|
"featureFlags": {"betaUI": true},
|
||||||
|
"rpcTarget": "https://rawtestrpc.metamask.io/",
|
||||||
|
"identities": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"name": "Send Account 1"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"name": "Send Account 2"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
|
||||||
|
"name": "Send Account 3"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"name": "Send Account 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unapprovedTxs": {},
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"conversionRate": 1200.88200327,
|
||||||
|
"conversionDate": 1489013762,
|
||||||
|
"noActiveNotices": true,
|
||||||
|
"frequentRpcList": [],
|
||||||
|
"network": "3",
|
||||||
|
"accounts": {
|
||||||
|
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x47c9d71831c76efe",
|
||||||
|
"nonce": "0x1b",
|
||||||
|
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
|
||||||
|
},
|
||||||
|
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x37452b1315889f80",
|
||||||
|
"nonce": "0xa",
|
||||||
|
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
|
||||||
|
},
|
||||||
|
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x30c9d71831c76efe",
|
||||||
|
"nonce": "0x1c",
|
||||||
|
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
},
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb": {
|
||||||
|
"code": "0x",
|
||||||
|
"balance": "0x0",
|
||||||
|
"nonce": "0x0",
|
||||||
|
"address": "0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"addressBook": [
|
||||||
|
{
|
||||||
|
"address": "0x06195827297c7a80a443b6894d3bdb8824b43896",
|
||||||
|
"name": "Address Book Account 1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokens": [],
|
||||||
|
"transactions": {},
|
||||||
|
"selectedAddressTxList": [],
|
||||||
|
"unapprovedMsgs": {},
|
||||||
|
"unapprovedMsgCount": 0,
|
||||||
|
"unapprovedPersonalMsgs": {},
|
||||||
|
"unapprovedPersonalMsgCount": 0,
|
||||||
|
"keyringTypes": [
|
||||||
|
"Simple Key Pair",
|
||||||
|
"HD Key Tree"
|
||||||
|
],
|
||||||
|
"keyrings": [
|
||||||
|
{
|
||||||
|
"type": "HD Key Tree",
|
||||||
|
"accounts": [
|
||||||
|
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
|
||||||
|
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
|
||||||
|
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Simple Key Pair",
|
||||||
|
"accounts": [
|
||||||
|
"0xd85a4b6a394794842887b8284293d69163007bbb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selectedAddress": "0xd85a4b6a394794842887b8284293d69163007bbb",
|
||||||
|
"currentCurrency": "USD",
|
||||||
|
"provider": {
|
||||||
|
"type": "testnet"
|
||||||
|
},
|
||||||
|
"shapeShiftTxList": [],
|
||||||
|
"lostAccounts": [],
|
||||||
|
"send": {
|
||||||
|
"gasLimit": null,
|
||||||
|
"gasPrice": null,
|
||||||
|
"gasTotal": "0xb451dc41b578",
|
||||||
|
"tokenBalance": null,
|
||||||
|
"from": "",
|
||||||
|
"to": "",
|
||||||
|
"amount": "0x0",
|
||||||
|
"memo": "",
|
||||||
|
"errors": {},
|
||||||
|
"maxModeOn": false,
|
||||||
|
"editingTransactionId": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"appState": {
|
||||||
|
"menuOpen": false,
|
||||||
|
"currentView": {
|
||||||
|
"name": "accountDetail",
|
||||||
|
"detailView": null,
|
||||||
|
"context": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
|
||||||
|
},
|
||||||
|
"accountDetail": {
|
||||||
|
"subview": "transactions"
|
||||||
|
},
|
||||||
|
"modal": {
|
||||||
|
"modalState": {},
|
||||||
|
"previousModalState": {}
|
||||||
|
},
|
||||||
|
"transForward": true,
|
||||||
|
"isLoading": false,
|
||||||
|
"warning": null,
|
||||||
|
"scrollToBottom": false,
|
||||||
|
"forgottenPassword": null
|
||||||
|
},
|
||||||
|
"identities": {}
|
||||||
|
}
|
|
@ -0,0 +1,229 @@
|
||||||
|
const reactTriggerChange = require('react-trigger-change')
|
||||||
|
|
||||||
|
const PASSWORD = 'password123'
|
||||||
|
|
||||||
|
QUnit.module('new ui send flow')
|
||||||
|
|
||||||
|
QUnit.test('successful send flow', (assert) => {
|
||||||
|
const done = assert.async()
|
||||||
|
runSendFlowTest(assert).then(done).catch((err) => {
|
||||||
|
assert.notOk(err, `Error was thrown: ${err.stack}`)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
global.ethQuery = {
|
||||||
|
sendTransaction: () => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runSendFlowTest(assert, done) {
|
||||||
|
console.log('*** start runSendFlowTest')
|
||||||
|
const selectState = $('select')
|
||||||
|
selectState.val('send new ui')
|
||||||
|
reactTriggerChange(selectState[0])
|
||||||
|
|
||||||
|
await timeout(2000)
|
||||||
|
|
||||||
|
const sendScreenButton = $('button.btn-clear.hero-balance-button')
|
||||||
|
assert.ok(sendScreenButton[1], 'send screen button present')
|
||||||
|
sendScreenButton[1].click()
|
||||||
|
|
||||||
|
await timeout(1000)
|
||||||
|
|
||||||
|
const sendContainer = $('.send-v2__container')
|
||||||
|
assert.ok(sendContainer[0], 'send container renders')
|
||||||
|
|
||||||
|
const sendHeader = $('.send-v2__send-header-icon')
|
||||||
|
assert.ok(sendHeader[0], 'send screen has a header icon')
|
||||||
|
|
||||||
|
const sendTitle = $('.send-v2__title')
|
||||||
|
assert.equal(sendTitle[0].textContent, 'Send Funds', 'Send screen title is correct')
|
||||||
|
|
||||||
|
const sendCopy = $('.send-v2__copy')
|
||||||
|
assert.equal(sendCopy[0].textContent, 'Only send ETH to an Ethereum address.', 'Send screen has copy')
|
||||||
|
|
||||||
|
const sendFromField = $('.send-v2__form-field')
|
||||||
|
assert.ok(sendFromField[0], 'send screen has a from field')
|
||||||
|
|
||||||
|
let sendFromFieldItemAddress = $('.account-list-item__account-name')
|
||||||
|
assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 4', 'send from field shows correct account name')
|
||||||
|
|
||||||
|
const sendFromFieldItem = $('.account-list-item')
|
||||||
|
sendFromFieldItem[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendFromDropdownList = $('.send-v2__from-dropdown__list')
|
||||||
|
assert.equal(sendFromDropdownList.children().length, 4, 'send from dropdown shows all accounts')
|
||||||
|
console.log(`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sendFromDropdownList.children()[1]`, sendFromDropdownList.children()[1]);
|
||||||
|
sendFromDropdownList.children()[1].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
sendFromFieldItemAddress = $('.account-list-item__account-name')
|
||||||
|
console.log(`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sendFromFieldItemAddress[0]`, sendFromFieldItemAddress[0]);
|
||||||
|
assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field dropdown changes account name')
|
||||||
|
|
||||||
|
let sendToFieldInput = $('.send-v2__to-autocomplete__input')
|
||||||
|
sendToFieldInput[0].focus()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendToDropdownList = $('.send-v2__from-dropdown__list')
|
||||||
|
assert.equal(sendToDropdownList.children().length, 5, 'send to dropdown shows all accounts and address book accounts')
|
||||||
|
|
||||||
|
sendToDropdownList.children()[2].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendToAccountAddress = sendToFieldInput.val()
|
||||||
|
assert.equal(sendToAccountAddress, '0x2f8d4a878cfa04a6e60d46362f5644deab66572d', 'send to dropdown selects the correct address')
|
||||||
|
|
||||||
|
const sendAmountField = $('.send-v2__form-row:eq(2)')
|
||||||
|
sendAmountField.find('.currency-display')[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendAmountFieldInput = sendAmountField.find('input:text')
|
||||||
|
sendAmountFieldInput.val('5.1')
|
||||||
|
reactTriggerChange(sendAmountField.find('input')[0])
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
let errorMessage = $('.send-v2__error')
|
||||||
|
assert.equal(errorMessage[0].textContent, 'Insufficient funds.', 'send should render an insufficient fund error message')
|
||||||
|
|
||||||
|
sendAmountFieldInput.val('2.0')
|
||||||
|
reactTriggerChange(sendAmountFieldInput[0])
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
errorMessage = $('.send-v2__error')
|
||||||
|
assert.equal(errorMessage.length, 0, 'send should stop rendering amount error message after amount is corrected')
|
||||||
|
|
||||||
|
const sendGasField = $('.send-v2__gas-fee-display')
|
||||||
|
assert.equal(
|
||||||
|
sendGasField.find('.currency-display__input-wrapper > input').val(),
|
||||||
|
'0.000198',
|
||||||
|
'send gas field should show estimated gas total'
|
||||||
|
)
|
||||||
|
assert.equal(
|
||||||
|
sendGasField.find('.currency-display__converted-value')[0].textContent,
|
||||||
|
'0.24 USD',
|
||||||
|
'send gas field should show estimated gas total converted to USD'
|
||||||
|
)
|
||||||
|
|
||||||
|
const sendGasOpenCustomizeModalButton = $('.send-v2__sliders-icon-container'
|
||||||
|
)
|
||||||
|
sendGasOpenCustomizeModalButton[0].click()
|
||||||
|
|
||||||
|
await timeout(1000)
|
||||||
|
|
||||||
|
const customizeGasModal = $('.send-v2__customize-gas')
|
||||||
|
assert.ok(customizeGasModal[0], 'should render the customize gas modal')
|
||||||
|
|
||||||
|
const customizeGasPriceInput = $('.send-v2__gas-modal-card').first().find('input')
|
||||||
|
customizeGasPriceInput.val(50)
|
||||||
|
reactTriggerChange(customizeGasPriceInput[0])
|
||||||
|
const customizeGasLimitInput = $('.send-v2__gas-modal-card').last().find('input')
|
||||||
|
customizeGasLimitInput.val(60000)
|
||||||
|
reactTriggerChange(customizeGasLimitInput[0])
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const customizeGasSaveButton = $('.send-v2__customize-gas__save')
|
||||||
|
customizeGasSaveButton[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
sendGasField.find('.currency-display__input-wrapper > input').val(),
|
||||||
|
'0.003',
|
||||||
|
'send gas field should show customized gas total'
|
||||||
|
)
|
||||||
|
assert.equal(
|
||||||
|
sendGasField.find('.currency-display__converted-value')[0].textContent,
|
||||||
|
'3.60 USD',
|
||||||
|
'send gas field should show customized gas total converted to USD'
|
||||||
|
)
|
||||||
|
|
||||||
|
const sendButton = $('.send-v2__next-btn')
|
||||||
|
sendButton[0].click()
|
||||||
|
|
||||||
|
await timeout(2000)
|
||||||
|
|
||||||
|
selectState.val('send edit')
|
||||||
|
reactTriggerChange(selectState[0])
|
||||||
|
|
||||||
|
await timeout(2000)
|
||||||
|
|
||||||
|
const confirmFromName = $('.confirm-screen-account-name').first()
|
||||||
|
assert.equal(confirmFromName[0].textContent, 'Send Account 2', 'confirm screen should show correct from name')
|
||||||
|
|
||||||
|
const confirmToName = $('.confirm-screen-account-name').last()
|
||||||
|
assert.equal(confirmToName[0].textContent, 'Send Account 3', 'confirm screen should show correct to name')
|
||||||
|
|
||||||
|
const confirmScreenRows = $('.confirm-screen-rows')
|
||||||
|
const confirmScreenGas = confirmScreenRows.find('.confirm-screen-row-info')[2]
|
||||||
|
assert.equal(confirmScreenGas.textContent, '3.6 USD', 'confirm screen should show correct gas')
|
||||||
|
const confirmScreenTotal = confirmScreenRows.find('.confirm-screen-row-info')[3]
|
||||||
|
assert.equal(confirmScreenTotal.textContent, '2405.36 USD', 'confirm screen should show correct total')
|
||||||
|
|
||||||
|
const confirmScreenBackButton = $('.confirm-screen-back-button')
|
||||||
|
confirmScreenBackButton[0].click()
|
||||||
|
|
||||||
|
await timeout(1000)
|
||||||
|
|
||||||
|
const sendFromFieldItemInEdit = $('.account-list-item')
|
||||||
|
sendFromFieldItemInEdit[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendFromDropdownListInEdit = $('.send-v2__from-dropdown__list')
|
||||||
|
sendFromDropdownListInEdit.children()[2].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendToFieldInputInEdit = $('.send-v2__to-autocomplete__input')
|
||||||
|
sendToFieldInputInEdit[0].focus()
|
||||||
|
sendToFieldInputInEdit.val('0xd85a4b6a394794842887b8284293d69163007bbb')
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendAmountFieldInEdit = $('.send-v2__form-row:eq(2)')
|
||||||
|
sendAmountFieldInEdit.find('.currency-display')[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendAmountFieldInputInEdit = sendAmountFieldInEdit.find('input:text')
|
||||||
|
sendAmountFieldInputInEdit.val('1.0')
|
||||||
|
reactTriggerChange(sendAmountFieldInputInEdit[0])
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
const sendButtonInEdit = $('.send-v2__next-btn')
|
||||||
|
sendButtonInEdit[0].click()
|
||||||
|
|
||||||
|
await timeout()
|
||||||
|
|
||||||
|
// TODO: Need a way to mock background so that we can test correct transition from editing to confirm
|
||||||
|
selectState.val('confirm new ui')
|
||||||
|
reactTriggerChange(selectState[0])
|
||||||
|
|
||||||
|
await timeout(2000)
|
||||||
|
const confirmScreenConfirmButton = $('.confirm-screen-confirm-button')
|
||||||
|
console.log(`+++++++++++++++++++++++++++++++= confirmScreenConfirmButton[0]`, confirmScreenConfirmButton[0]);
|
||||||
|
confirmScreenConfirmButton[0].click()
|
||||||
|
|
||||||
|
await timeout(2000)
|
||||||
|
|
||||||
|
const txView = $('.tx-view')
|
||||||
|
console.log(`++++++++++++++++++++++++++++++++ txView[0]`, txView[0]);
|
||||||
|
|
||||||
|
assert.ok(txView[0], 'Should return to the account details screen after confirming')
|
||||||
|
}
|
||||||
|
|
||||||
|
function timeout (time) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
setTimeout(resolve, time || 1500)
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue