@ -289,13 +289,13 @@ describe('MetaMask', function () {
} )
} )
it ( 'finds the transaction in the transactions list' , async function ( ) {
it ( 'finds the transaction in the transactions list' , async function ( ) {
const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
await driver . wait ( async ( ) => {
assert . equal ( transactions . length , 1 )
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
return confirmedTxes . length === 1
} , 10000 )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
}
} )
} )
} )
} )
@ -332,13 +332,13 @@ describe('MetaMask', function () {
} )
} )
it ( 'finds the transaction in the transactions list' , async function ( ) {
it ( 'finds the transaction in the transactions list' , async function ( ) {
const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
await driver . wait ( async ( ) => {
assert . equal ( transactions . length , 2 )
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
return confirmedTxes . length === 2
} , 10000 )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
}
} )
} )
} )
} )
@ -385,13 +385,13 @@ describe('MetaMask', function () {
} )
} )
it ( 'finds the transaction in the transactions list' , async function ( ) {
it ( 'finds the transaction in the transactions list' , async function ( ) {
const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
await driver . wait ( async ( ) => {
assert . equal ( transactions . length , 3 )
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
return confirmedTxes . length === 3
} , 10000 )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
const txValues = await findElement ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
await driver . wait ( until . elementTextMatches ( txValues , /-1\s*ETH/ ) , 10000 )
}
} )
} )
} )
} )
@ -838,12 +838,10 @@ describe('MetaMask', function () {
it ( 'renders the correct ETH balance' , async ( ) => {
it ( 'renders the correct ETH balance' , async ( ) => {
const balance = await findElement ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
const balance = await findElement ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
await delay ( regularDelayMs )
await delay ( regularDelayMs )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
await driver . wait ( until . elementTextMatches ( balance , /^87.*\s*ETH.*$/ ) , 10000 )
await driver . wait ( until . elementTextMatches ( balance , /^87.*\s*ETH.*$/ ) , 10000 )
const tokenAmount = await balance . getText ( )
const tokenAmount = await balance . getText ( )
assert . ok ( /^87.*\s*ETH.*$/ . test ( tokenAmount ) )
assert . ok ( /^87.*\s*ETH.*$/ . test ( tokenAmount ) )
await delay ( regularDelayMs )
await delay ( regularDelayMs )
}
} )
} )
} )
} )
@ -1002,22 +1000,15 @@ describe('MetaMask', function () {
} )
} )
it ( 'finds the transaction in the transactions list' , async function ( ) {
it ( 'finds the transaction in the transactions list' , async function ( ) {
const transactions = await findElements ( driver , By . css ( '.transaction-list-item' ) )
assert . equal ( transactions . length , 1 )
const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
assert . equal ( txValues . length , 1 )
// test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
// or possibly until we use latest version of firefox in the tests
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , /-1\s*TST/ ) , 10000 )
}
await driver . wait ( async ( ) => {
await driver . wait ( async ( ) => {
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
return confirmedTxes . length === 1
return confirmedTxes . length === 1
} , 10000 )
} , 10000 )
const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
assert . equal ( txValues . length , 1 )
await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , /-1\s*TST/ ) , 10000 )
const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
await driver . wait ( until . elementTextMatches ( txStatuses [ 0 ] , /Sent\sToken/i ) , 10000 )
await driver . wait ( until . elementTextMatches ( txStatuses [ 0 ] , /Sent\sToken/i ) , 10000 )
} )
} )
@ -1104,7 +1095,6 @@ describe('MetaMask', function () {
return confirmedTxes . length === 2
return confirmedTxes . length === 2
} , 10000 )
} , 10000 )
await delay ( regularDelayMs )
const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
const txValues = await findElements ( driver , By . css ( '.transaction-list-item__amount--primary' ) )
await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , /-1.5\s*TST/ ) )
await driver . wait ( until . elementTextMatches ( txValues [ 0 ] , /-1.5\s*TST/ ) )
const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
const txStatuses = await findElements ( driver , By . css ( '.transaction-list-item__action' ) )
@ -1115,14 +1105,10 @@ describe('MetaMask', function () {
const tokenListItems = await findElements ( driver , By . css ( '.token-list-item' ) )
const tokenListItems = await findElements ( driver , By . css ( '.token-list-item' ) )
await tokenListItems [ 0 ] . click ( )
await tokenListItems [ 0 ] . click ( )
await delay ( regularDelayMs )
await delay ( 1000 )
// test cancelled on firefox until https://github.com/mozilla/geckodriver/issues/906 is resolved,
const tokenBalanceAmount = await findElements ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
// or possibly until we use latest version of firefox in the tests
await driver . wait ( until . elementTextMatches ( tokenBalanceAmount [ 0 ] , /7.500\s*TST/ ) , 10000 )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
const tokenBalanceAmount = await findElements ( driver , By . css ( '.transaction-view-balance__primary-balance' ) )
await driver . wait ( until . elementTextMatches ( tokenBalanceAmount [ 0 ] , /7.500\s*TST/ ) , 10000 )
}
} )
} )
} )
} )
@ -1141,9 +1127,6 @@ describe('MetaMask', function () {
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Approve Tokens')] ` ) )
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Approve Tokens')] ` ) )
await transferTokens . click ( )
await transferTokens . click ( )
if ( process . env . SELENIUM _BROWSER !== 'firefox' ) {
await closeAllWindowHandlesExcept ( driver , [ extension , dapp ] )
}
await driver . switchTo ( ) . window ( extension )
await driver . switchTo ( ) . window ( extension )
await delay ( regularDelayMs )
await delay ( regularDelayMs )
@ -1232,10 +1215,6 @@ describe('MetaMask', function () {
} )
} )
it ( 'finds the transaction in the transactions list' , async function ( ) {
it ( 'finds the transaction in the transactions list' , async function ( ) {
if ( process . env . SELENIUM _BROWSER === 'firefox' ) {
this . skip ( )
}
await driver . wait ( async ( ) => {
await driver . wait ( async ( ) => {
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
const confirmedTxes = await findElements ( driver , By . css ( '.transaction-list__completed-transactions .transaction-list-item' ) )
return confirmedTxes . length === 3
return confirmedTxes . length === 3
@ -1249,12 +1228,6 @@ describe('MetaMask', function () {
} )
} )
describe ( 'Tranfers a custom token from dapp when no gas value is specified' , ( ) => {
describe ( 'Tranfers a custom token from dapp when no gas value is specified' , ( ) => {
before ( function ( ) {
if ( process . env . SELENIUM _BROWSER === 'firefox' ) {
this . skip ( )
}
} )
it ( 'transfers an already created token, without specifying gas' , async ( ) => {
it ( 'transfers an already created token, without specifying gas' , async ( ) => {
const windowHandles = await driver . getAllWindowHandles ( )
const windowHandles = await driver . getAllWindowHandles ( )
const extension = windowHandles [ 0 ]
const extension = windowHandles [ 0 ]
@ -1267,7 +1240,6 @@ describe('MetaMask', function () {
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Transfer Tokens Without Gas')] ` ) )
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Transfer Tokens Without Gas')] ` ) )
await transferTokens . click ( )
await transferTokens . click ( )
await closeAllWindowHandlesExcept ( driver , [ extension , dapp ] )
await driver . switchTo ( ) . window ( extension )
await driver . switchTo ( ) . window ( extension )
await delay ( regularDelayMs )
await delay ( regularDelayMs )
@ -1304,12 +1276,6 @@ describe('MetaMask', function () {
} )
} )
describe ( 'Approves a custom token from dapp when no gas value is specified' , ( ) => {
describe ( 'Approves a custom token from dapp when no gas value is specified' , ( ) => {
before ( function ( ) {
if ( process . env . SELENIUM _BROWSER === 'firefox' ) {
this . skip ( )
}
} )
it ( 'approves an already created token' , async ( ) => {
it ( 'approves an already created token' , async ( ) => {
const windowHandles = await driver . getAllWindowHandles ( )
const windowHandles = await driver . getAllWindowHandles ( )
const extension = windowHandles [ 0 ]
const extension = windowHandles [ 0 ]
@ -1323,7 +1289,6 @@ describe('MetaMask', function () {
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Approve Tokens Without Gas')] ` ) )
const transferTokens = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Approve Tokens Without Gas')] ` ) )
await transferTokens . click ( )
await transferTokens . click ( )
await closeAllWindowHandlesExcept ( driver , extension )
await driver . switchTo ( ) . window ( extension )
await driver . switchTo ( ) . window ( extension )
await delay ( regularDelayMs )
await delay ( regularDelayMs )
@ -1346,7 +1311,7 @@ describe('MetaMask', function () {
} )
} )
it ( 'submits the transaction' , async function ( ) {
it ( 'submits the transaction' , async function ( ) {
await delay ( regularDelayMs )
await delay ( 1000 )
const confirmButton = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Confirm')] ` ) )
const confirmButton = await findElement ( driver , By . xpath ( ` //button[contains(text(), 'Confirm')] ` ) )
await confirmButton . click ( )
await confirmButton . click ( )
await delay ( regularDelayMs )
await delay ( regularDelayMs )